Native Mode over UART (GPIO 1 and 2)


I was wondering if anyone could help with a native mode issue.

My objective is to talk to the O-Drive using a ttl level serial link from another micro but for the moment I have a PC, Python and an FTDI TTL cable connected to the odrive UART (GPIO 1 and 2). I have compiled and flashed the firmware with “CONFIG_UART_PROTOCOL=native” but occasionally, perhaps when there is a ‘\n’, ‘\r’ or ‘!’ in the binary message, I get an “unknown command” response either before or after the expected native protocol stream response.

If I querry endpoint zero at address 7946
od.sendPacket(0x0000, struct.pack(’<I’,7946), True, 512)
my sendPacket function sends:

Note the \n.

The oDrive responds with
b’unknown command\r\n\xaa \xe0\xe2\x80pe":“float”,“access”:“r”},{"naCn’

Note the “unknown command” preceding the expected native protocol response.

If I request other offsets into enpoint 0 (i.e. not 7946) which don’t generate a ‘\n’ in the message everything works as expected. Could it be that the ascii command interface is still running alongside the native interface? I have tried following CONFIG_UART_PROTOCOL through from the config file into the software but can’t work out how it affects the build - seems to be passed to gcc with a load of flags then I get stuck!

I downloaded the firmware a couple of days ago from github, the changelog suggests version [0.4.11] - 2019-07-25

Any thoughts on where best to fix would be much appreciated.

Many thanks


Following up:
Commenting out the calls to “ASCII_protocol_parse_stream” in “interface_uart.cpp” resolves this issue and allows be to download the full json definition from endpoint 0.