custom board for smart serial interface?
- SyNguyen
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
02 Jun 2018 04:53 #111442
by SyNguyen
Replied by SyNguyen on topic custom board for smart serial interface?
Hi Rene,
Thank you for your replay for my problem. I really need your help. My fault byte to respond for request of master is txbuf[0] = 0x00 in the process data step. Is it correct? Are there three files consist sserial.h, sserial.c and gentable.c that are enough for Smart Serial run?
If you have much free time, you can present for me a example so that i can understand timeout of smart serial to request and respond.
"//wait with timeout until rest of process data is received
do {
uint32_t t2 = hal_get_systick_value();
if(t1 < t2) {
t1 += hal_get_systick_reload();
}
wait_ticks = t1 - t2;
//next received packet will be written to bufferpos
bufferpos = sizeof(rxbuf) - DMA_GetCurrDataCounter(DMA2_Stream5);
//how many packets we have the the rx buffer for processing
available = (bufferpos - rxpos + sizeof(rxbuf)) % sizeof(rxbuf);
} while(available < discovery.output + 2 && wait_ticks <= max_waste_ticks);
"
I really appreciate your help. Once again, Thank you so much.
Thank you for your replay for my problem. I really need your help. My fault byte to respond for request of master is txbuf[0] = 0x00 in the process data step. Is it correct? Are there three files consist sserial.h, sserial.c and gentable.c that are enough for Smart Serial run?
If you have much free time, you can present for me a example so that i can understand timeout of smart serial to request and respond.
"//wait with timeout until rest of process data is received
do {
uint32_t t2 = hal_get_systick_value();
if(t1 < t2) {
t1 += hal_get_systick_reload();
}
wait_ticks = t1 - t2;
//next received packet will be written to bufferpos
bufferpos = sizeof(rxbuf) - DMA_GetCurrDataCounter(DMA2_Stream5);
//how many packets we have the the rx buffer for processing
available = (bufferpos - rxpos + sizeof(rxbuf)) % sizeof(rxbuf);
} while(available < discovery.output + 2 && wait_ticks <= max_waste_ticks);
"
I really appreciate your help. Once again, Thank you so much.
Please Log in or Create an account to join the conversation.
- SyNguyen
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
06 Jun 2018 09:58 #111734
by SyNguyen
Replied by SyNguyen on topic custom board for smart serial interface?
Hi everyone,
Currently, My board was fixed, It's complete connection. I can read/write I/O. But when i want to config more than I/O then the error appear again. Example,If I have s struct " sserial_process_data_in "which have a sizeof 16 byte, The error " remote error appear. If you know how to fix the error, can you help me? Please!
typedef struct {
float pos_fb1;
float pos_fb2;
float pos_fb3;
float pos_fb4;
uint32_t in_0 : 1;
uint32_t in_1 : 1;
uint32_t in_2 : 1;
uint32_t in_3 : 1;
uint32_t padding : 4;
} sserial_in_process_data_t; //size:17 bytes
_Static_assert(sizeof(sserial_in_process_data_t) == 17, "sserial_in_process_data_t size error!");
//global name:scale addr:0xbb size:32 dir:0x80
#define scale_address 187
Thank you so much!
Currently, My board was fixed, It's complete connection. I can read/write I/O. But when i want to config more than I/O then the error appear again. Example,If I have s struct " sserial_process_data_in "which have a sizeof 16 byte, The error " remote error appear. If you know how to fix the error, can you help me? Please!
typedef struct {
float pos_fb1;
float pos_fb2;
float pos_fb3;
float pos_fb4;
uint32_t in_0 : 1;
uint32_t in_1 : 1;
uint32_t in_2 : 1;
uint32_t in_3 : 1;
uint32_t padding : 4;
} sserial_in_process_data_t; //size:17 bytes
_Static_assert(sizeof(sserial_in_process_data_t) == 17, "sserial_in_process_data_t size error!");
//global name:scale addr:0xbb size:32 dir:0x80
#define scale_address 187
Thank you so much!
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
Less
More
- Posts: 17853
- Thank you received: 4774
06 Jun 2018 13:20 #111748
by PCW
Replied by PCW on topic custom board for smart serial interface?
SSLBP (the FPGA firmware the interfaces to smart serial devices) is currently limited to 12 bytes of process data in each direction
(you can kind of guess this from the fact that is has only 3x 32 bit process data interface registers to the host)
(you can kind of guess this from the fact that is has only 3x 32 bit process data interface registers to the host)
The following user(s) said Thank You: SyNguyen
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23310
- Thank you received: 4858
06 Jun 2018 13:31 #111751
by andypugh
Replied by andypugh on topic custom board for smart serial interface?
Note that 16, 32 and 64 bit floats as well as an 8-bit "minifloat" are all supported.
github.com/LinuxCNC/linuxcnc/blob/master...mot2/sserial.c#L1583
github.com/LinuxCNC/linuxcnc/blob/master...mot2/sserial.c#L1583
The following user(s) said Thank You: SyNguyen
Please Log in or Create an account to join the conversation.
- rene-dev
- Offline
- Senior Member
Less
More
- Posts: 57
- Thank you received: 25
06 Jun 2018 18:54 #111779
by rene-dev
Replied by rene-dev on topic custom board for smart serial interface?
the gentable doesnt run on the mcu, you just copy and paste its output to the code.
you also need crc8.c/.h
you also need crc8.c/.h
The following user(s) said Thank You: SyNguyen
Please Log in or Create an account to join the conversation.
- SyNguyen
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
08 Jun 2018 09:51 #111987
by SyNguyen
Replied by SyNguyen on topic custom board for smart serial interface?
Hi everyone,
Thank you so much for your recommend. I really appreciate it. I understand the problem that I meet.
But Currently, I want to read/write the channel analogs (x12bits), It's need only 2 byte to met. so I config " #define DATA_TYPE_UINT16_T 0x12 " on sserial.h and " case DATA_TYPE_UINT16_T:
if(pd->data_size != 16) {
printf("warning: unsupported uint16_t size!");
}
printf("uint16_t %s;\n", name);
break; " on the gentable.c. But when I run to connect with Linuxcnc the message to appear that is " Unsupported output datatype 18 (name pos_cmd) "
If you know why to have the message. you can explain it to me. Please! Once again, thank you so much.
Thank you so much for your recommend. I really appreciate it. I understand the problem that I meet.
But Currently, I want to read/write the channel analogs (x12bits), It's need only 2 byte to met. so I config " #define DATA_TYPE_UINT16_T 0x12 " on sserial.h and " case DATA_TYPE_UINT16_T:
if(pd->data_size != 16) {
printf("warning: unsupported uint16_t size!");
}
printf("uint16_t %s;\n", name);
break; " on the gentable.c. But when I run to connect with Linuxcnc the message to appear that is " Unsupported output datatype 18 (name pos_cmd) "
If you know why to have the message. you can explain it to me. Please! Once again, thank you so much.
Please Log in or Create an account to join the conversation.
- rene-dev
- Offline
- Senior Member
Less
More
- Posts: 57
- Thank you received: 25
21 Jun 2018 10:04 #112710
by rene-dev
Replied by rene-dev on topic custom board for smart serial interface?
Thats not now it works.
you specify a unsigned integer, and then give it 16 bits.
no need for a new datatype.
the struct should then contain a bitfield.
you specify a unsigned integer, and then give it 16 bits.
no need for a new datatype.
the struct should then contain a bitfield.
Please Log in or Create an account to join the conversation.
- nghung270192
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
15 Nov 2018 15:32 #120759
by nghung270192
Replied by nghung270192 on topic custom board for smart serial interface?
Hi All,
Do you have any ideas for implementing out DAC with sserial like mesa card.
Thanks.
Do you have any ideas for implementing out DAC with sserial like mesa card.
Thanks.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23310
- Thank you received: 4858
15 Nov 2018 15:36 #120760
by andypugh
Replied by andypugh on topic custom board for smart serial interface?
This has been done with the STMBL drive, I would suggest looking at their code.
Please Log in or Create an account to join the conversation.
- rene-dev
- Offline
- Senior Member
Less
More
- Posts: 57
- Thank you received: 25
15 Nov 2018 15:49 #120761
by rene-dev
Replied by rene-dev on topic custom board for smart serial interface?
you specify a float, or int, and output the value to a dac/pwm.
Please Log in or Create an account to join the conversation.
Moderators: PCW, jmelson
Time to create page: 0.097 seconds