I’m trying to read and write data over the UART via a tcp/python script but am having some trouble. I think TX operations are successful but I’m failing to properly read data.
My goal is to use the Otii to enter a DUT bootloader by toggling the otii arc GPO pins, then be able to dynamically read/write data to program/configure the DUT. Once programed/configured, use the otii to characterize the power consumption. Ideally this is all handled through the Otii arc.
- Is there an example of reading and writing UART data via the TCP client/python or other?
- Are there any limitations on dynamically reading and writing data? I ask because it looks like I may be receiving data but only after I stop a recording. This wouldn’t really be appropriate given my use case. It feels like I shouldn’t have to start/stop a recording every time I want to fetch a response from the DUT.
- Is the correct approach to start a recording and use “get_channel_data()” or is there another approach to reading Rx traffic?
Any other pointers would be helpful.
I will follow up with a case.
- There aren’t CR/LF transmitted from my script or the DUT. The DUT bootloader uses very simple commands, single bytes or byte pairs to trigger actions. Is it possible that I’m not getting data because there are no CR/LFs, i.e. perhaps otii is waiting for a complete line before letting me fetch the data?
Yes, that is most likely the issue. Add CR and or LF, that should do the trick.
Hi, @bjorn.rosqvist. My DUT is a third-party component of the actual device. It sends by UART status messages with pre and post delimiters which are somewhat configurable (’<’ and ‘>’, for example) but CR and LR are not an option.
I made a temporal workaround connecting the DUT UART to an Arduino, which passes it through to its USB serial port, and inserts an CR when it detects an ‘>’. Then I connected the USB to my computer and configured it in Otii / Project Settings / UART / Logs (great feature, by the way!).
It worked like a charm. Now Otii can log the DUT status messages.
However, this requires an additional piece of hardware and USB port and adds a possible current/induction loop I’m not confortable with.
So… There is any chance of implementing in Otii a configurable terminating character or string? That would be great.
Thank you so much for this, it is very valuable to get feedback and improvement suggestions from you.
I will add this feature as a customer request in our backlog.
However, I cannot make any promises if and when this will be implemented.