USB haas operator panel interface

More
08 Mar 2021 21:50 #201488 by fupeama

That looks very interesting.

Does it create pins in HAL like a real sserial node?


Yes, it creates HAL pins. SSerial card tels LINUXCNC which data will be send/receive and LCNC create pins.
You can define read/write, size for each type in bits (8 bits are 256 steps) and min max value (IEEE-754). maximal 96 bits in and 96 out.
for type encoder are creates some parameters like scale automaticaly.....
you can add special parameters yourself, this value is not transfered in data packet but by address when changed (now I canot remember how).
M

Please Log in or Create an account to join the conversation.

More
08 Mar 2021 22:02 #201489 by fupeama


I started on that and needed to modify the code for strm32 - I didn't get it to work yet as I ran out of time for it.
Do you have code edits you could share?


Yes I can,
Tomorrow on work. I can make simpliest example. send 1 bit to sserial card stm32f103c8 bluepill and turn on/off led and 1 bit back with led status.
Now I am working on versatile template, where will be possible to do select types from predefined lines and program makes everything itself. calculete PTOC, create variables etc. Of course except for HW pin operation.
Martin

Please Log in or Create an account to join the conversation.

More
08 Mar 2021 22:43 #201495 by andypugh

You can define read/write, size for each type in bits (8 bits are 256 steps) and min max value (IEEE-754). maximal 96 bits in and 96 out.


In LinuxCNC Master the limit is now 224 bits if you use the sserialB GTAG (198)
github.com/LinuxCNC/linuxcnc/blob/master...mot2/hostmot2.h#L133

It was my intention to support the use of minifloats in addition to (part of) IEEE-754
github.com/LinuxCNC/linuxcnc/blob/master...mot2/sserial.c#L1531
ie 8, 16, 32 and 64 bit floats.
Though looking at the code it doesn't seem that 8 and 16 bits are implemented yet.
The following user(s) said Thank You: fupeama

Please Log in or Create an account to join the conversation.

More
09 Mar 2021 08:31 #201526 by fupeama
Hi,Here is very simple example
I change cca 10 lines in fdarling template
there is
1 bit from LCNC to stm32f103c8 turn on/off pc13 buildin led
1 bit from stm32f103c8 to LCNC copy input to output
I use int_8 for 1bit because opposit side automatically align size to whole byte.

File Attachment:

File Name: mesa-smart...-led.rar
File Size:56 KB








Sorry my arduino ide is automaticaly set to czech language. but perhaps the picture shows how to set it up.



Martin
Attachments:

Please Log in or Create an account to join the conversation.

More
09 Mar 2021 22:21 #201609 by cmorley
This is excellent! Thank you.
As soon as I get back from work rotation I'll try it out and let you know!

Please Log in or Create an account to join the conversation.

More
15 Mar 2021 12:51 #202344 by fupeama

You can define read/write, size for each type in bits (8 bits are 256 steps) and min max value (IEEE-754). maximal 96 bits in and 96 out.


In LinuxCNC Master the limit is now 224 bits if you use the sserialB GTAG (198)
github.com/LinuxCNC/linuxcnc/blob/master...mot2/hostmot2.h#L133

It was my intention to support the use of minifloats in addition to (part of) IEEE-754
github.com/LinuxCNC/linuxcnc/blob/master...mot2/sserial.c#L1531
ie 8, 16, 32 and 64 bit floats.
Though looking at the code it doesn't seem that 8 and 16 bits are implemented yet.


Hi Andy,
this is great news. I thing 96bits is not enought.
I spent a few nights reading (and writing) the code and I have a question.
When I try to write 4 bytes (32bits) to non volatile variable, linuxcnc only send 2 bytes. how can i send 4bytes information to my own sserial card? I want to add my own non volatile variables and control it.
Thanks Martin
Read is no problem. LCNC ask for forexample nvunitnumber with 4bytes and gets 4bytes. But, writing is different

Please Log in or Create an account to join the conversation.

More
16 Mar 2021 18:33 #202498 by andypugh

When I try to write 4 bytes (32bits) to non volatile variable, linuxcnc only send 2 bytes. how can i send 4bytes information to my own sserial card? I want to add my own non volatile variables and control it.


What datatype? is datalength correct?

The code looks like it should work:
               case 4: // Now send the data
                    switch (p->type){
                        case LBP_SIGNED:
                        case LBP_NONVOL_SIGNED:
                            *r->write[0] = (rtapi_u32) p->s32_param;
                            break;
                        case LBP_UNSIGNED:
                        case LBP_NONVOL_UNSIGNED:
                            *r->write[0] = p->u32_param;
                            break;
                        case LBP_FLOAT:
                        case LBP_NONVOL_FLOAT:
                            if (g->DataLength == sizeof(float) * 8 ){
                                float temp = p->float_param;
                                memcpy(r->write[0], &temp, sizeof(float));    // Data Value
                            } else if (g->DataLength == sizeof(double) * 8){
                                double temp = p->float_param;
                                memcpy(r->write[0], &temp, sizeof(double));
                            } else {
                                HM2_ERR("sserial write: LBP_FLOAT of bit-length %i not handled\n", g->DataLength);
                                p->type= LBP_PAD; // only warn once, then ignore
                            }
                            break;
                        default:
                            break;
                        }
                    switch (g->DataLength){
                        case 8:
                            *r->reg_cs_write = WRITE_REM_BYTE_CMD | g->ParmAddr;// Data Address
                            break;
                        case 16:
                            *r->reg_cs_write = WRITE_REM_WORD_CMD | g->ParmAddr;// Data Address
                            break;
                        case 32:
                            *r->reg_cs_write = WRITE_REM_LONG_CMD | g->ParmAddr;// Data Address
                            break;
                        case 64:
                            *r->reg_cs_write = WRITE_REM_DOUBLE_CMD | g->ParmAddr;// Data Address
                            break;
                        }
                    *inst->command_reg_write = 0x1000 | (1 << r->index); // doit command
                    inst->timer = 200000000;
                    *inst->state3 = 5;
                    break;

Seems to match

"REFERENCE INFORMATION
SSLBP
REMOTE WRITE EXAMPLE:
For a remote word write, the sequence of operations is as follows:
1. Issue a STOPALL (0x800) command, wait for COMMAND register clear to verify stop command completion.
2. Issue a setup START command (0xFNN) with bitmask (NN) of channels to start
3. Wait for COMMAND register clear to verify start command completion. (may be many mS)
4. Read data register to verify that all selected channels started (a 1 bit means a fault in the channel that the bit represents)
5. Write the new parameter data to the selected channels Interface0 register (right justified)
6. Write LBP word write command (0x65) in the MSByte ORed with the parameter address to the selected channels CS register. (0x6500PPPP)
7. Issue a DOIT Command
8. Wait for the command register to be clear
9. Check that the data register is clear, any set bits indicate an error . Repeat from step 5 for any additional remote parameter writes
Remote write byte, word, long and double are basically equivalent, the only difference being the LBP command (0x64,0x65,0x66,0x67 respectively) and the size of the data written to the interface register(s)"

The interface registers are 32 bits, so the data should fit.

Please Log in or Create an account to join the conversation.

More
17 Mar 2021 12:04 #202589 by fupeama
Hi Andy,
thanks for reply.
Now it is ok. in case I use sserial not setsserial
I had old LCNC 2.7.15, now it runs on 2.9.0 pre0 (17.3.2021 update to master branch)
I use 7i92 firmware 2x7i76 with one 7i76
here is my definition
LBP_PDD_RECORD_TYPE_NORMAL,.DataSize = 32,.DataType = LBP_PDD_DATA_TYPE_NONVOL_UNSIGNED,.DataDirection = LBP_PDD_DIRECTION_OUTPUT, .ParamMin = 0x0,.ParamMax = 0x0,.ParamAddress = PARAM_BASE_ADDRESS+16,"None\0NVNumber\0"}}
and lcnc create param
u32 RW hm2_7i92.0.cust.0.0.nvnumber
1. I tried to write param to card throught setsserial
halrun
loadrt hostmot
loadrt hm2_eth board_ip="192.168.1.121"
show param hm2_7i92.0.cust.0.0.nv......
loadrt setsserial cmd="set hm2_7i92.0.cust.0.0.nvunitnumber 0x12345678"


comunication is.
0xEC 0x01
0x00
0x65 addr addr 0x43 0x21 crc this is only 16bit
......
......

2. I tried set nvnumber in custom_postgui.hal
it is too late because comunication is already in progress

3. set param in cutom.hal
setp hm2_7i92.0.cust.0.0.nvunitnumber 0x87654321
lcnc say....A non-volatile smart-serial parameter has been changed
parameter is set now to 0x87654321. (only when it is different from read value)

comunication
0xEC 0x01
0x00
0x66 addr addr 0x21 0x43 0x65 0x87 crc this is 32bit.


thanks

I have ones more question,
I have second mesa card 7i76e
I made new firmware with another sserial on p1 (p2)
comunication is fine, lcnc start and can see all pin and param from my custom card.
but i cant get information from
mesaflash --device 7i76e --sserial --verbose.
there is no cookie send to card.
I tried original firmware 7i76e with 2x7i76 and situation is same.
there are
TXdata0 and RXdata0 on internal pin 7 8 onboard sserial
TXdata1 and RXdata1 on internal pin 9 10 mesaflash read ok
TXdata2 and RXdata2 on P1 pin 7 8 mesaflash dont comunicate
TXdata3 and RXdata3 on p1 pin 9 10 I didn't try
TXdata4 and RXdata4 on p2 pin 7 8 I didn't try
TXdata5 and RXdata5 on p2 pin 9 10 I didn't try

whats wrong?

Martin

Please Log in or Create an account to join the conversation.

More
17 Mar 2021 12:30 #202591 by andypugh

but i cant get information from
mesaflash --device 7i76e --sserial --verbose.
there is no cookie send to card.
I tried original firmware 7i76e with 2x7i76 and situation is same
....
whats wrong?


I know very little about Mesaflash. I suggest asking that question in the Driver Boards part of the forum where someone who does know Mesaflash migh see it.

Please Log in or Create an account to join the conversation.

More
12 Jul 2021 10:30 #214383 by Sviper
Hello

does anyone have the HAAS keyboard running on LinuxCNC using the Smart Serial? Could you provide all the important data and projects?

Greetings

Please Log in or Create an account to join the conversation.

Time to create page: 0.157 seconds
Powered by Kunena Forum