pktUART setup help

10 Nov 2021 01:48 #225906 by ExcessiveO
Can someone help me out with setting up a pktUART interface? I am trying to interface to an Odrive over rs422, I have the tranceiver hooked up correctly(at least it appears to be). I can send data from linuxcnc to the Odrive, but am having a tough time being able to read any data the other way. I keep getting either "no new frames" or "overrun error, no stop bit". I'm thinking I don't have the rx and tx registers set correctly or I'm not clearing the buffers when they should be. It is supposed to send a single frame of control data and then read back ~8 bytes. Any help on the order of what functions to call and what setup parameters to use would be appreciated.

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

10 Nov 2021 17:02 #226014 by PCW
Replied by PCW on topic pktUART setup help
I suspect the lower level PktUART driver does not deal with the conditional reads required
to receive packets correctly. In addition the overrun error suggest a data length error

Since only one read function is done per thread, the RX driver must first read the mode
register to determine if packets are available (and how many are available), then on the _next_ read function invocation it must read the packet count(s) from the recieve count
FIFO then on the next read function the data corresponding to the received packets
must be read.

This 3 step process could be simplified to 2 steps if reading the receive count FIFO
when empty did not cause a FIFO error. If this were the case, the read function
could read the mode register and the receive count FIFO every time and only read data
on the next read function if there were packets available

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

18 Jan 2022 00:25 #232203 by ExcessiveO
Replied by ExcessiveO on topic pktUART setup help
I found the issue, the pktuart driver only sets 16 bits of the 32 bit rx mode register. Bits 22-29 are for the filter time and were set to zero. I changed the driver to send 32 bits and changed the rx mode value to 0x25801408 (115200 baud rs422). It appears to have fixed all the errors I was getting.

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

Time to create page: 0.104 seconds
Powered by Kunena Forum