I'm having issues with the Serial0.write() function when trying to write 0x00 to the serial port. Example - the following code produces NOTHING on the serial port. uint8_t val; while (1) { val = 0; Serial0.write(val); val = 1; Serial0.write(val); val = 2; Serial0.write(val); } But if you change val = 0 to val = 3 then it works as expected. I came across this issue while trying to use the ModbusMaster library. I'm missing bytes from the Modbus packets because any 0x00 bytes are getting dropped. Does anyone have a fix for this?
It is a known issue and no update on it yet unfortunately: http://www.udoo.org/forum/threads/solved-accessing-dev-ttymcc-kernel-panics-linux.4375/#post-19613
Thanks waltervl. Udoo team: Is there an estimated timeframe for when this will be fixed? I need a working serial port for the product I am working on. I have to decide whether I can wait for the fix, or try a different platform.
Is this something I can potentially fix myself? On my windows development machine I have a folder AppData\Local\Arduino15\packages\UDOO\hardware\solox\1.6.7\variants\udooneo. Inside this folder are a bunch of source files - some of which look like they are related to the UART. If I spend time digging through this am I likely to find the source code that is getting called when I invoke Serial0.write() ?
Yes you could try to fix it yourself in the sources in that folder. That would be highly appreciated! Be aware that there is also a MQX part in it that is proprietary software of NXP. So only compiled versions of that part.
This is exactly the same problem I have using Modbus RTU. Unfortunately I designed a board to host a Udoo NEO and now I discovered this incredible issue.
Got to workaround by putting Serial0.flush() after writing a byte. while (true){ Serial0.write(0); Serial0.flush(); }
No, you will need to flush just when sending a zero. I think the problem can be from somewhere in the serial buffer which assume that data is always a string.
It would be better if you cast to byte too. Serial0.write((byte)0x00) even if it doesn't solve the problem but flushing does.