This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

UART - Losing data when writing to nrf52840 with pyserial over JLink com port

I am using pyserial on OSX as well as Ubuntu to send commands to the serial CLI via the JLink virtual com port for testing, and am occasionally experiencing lost/mutated characters. For example sending 'stop\r\n' may result in the nrf52840 recieving 'stoH' or 'sto' at the CLI. I am using a baudrate of 230400, 8 data bits, no parity and 1 stop bit. We do not have capability for HW flow control so I cannot enable it. We are using nRF5 SDK v15.0.0.

I thought that maybe the baudrate was too high and this was cause of the dropped data, however decreasing the baudrate (I tried several lower baudrates down to 2400) seemed to only increase the frequency of the issue. I have also tried adding significant delay before and after sending data with pyserial's serialObj.write, as well as splitting up the strings into bytes and adding delays between sending the individual bytes, but this also didn't seem to make a difference... some bytes would still occasionally be dropped.

Note that the frequency of strings sent, as well as their length, is relatively short (frequency > 1s, length < 30 characters). The errors seem to occur randomly and in the middle of the write sequence, unrelated to the specific string sent or when the serial port was opened or closed.

Any ideas as to why this may be happening would be greatly appreciated. Thank you!

Related