I think it has to be added to the known issues of the Neo Arduino documentation. When you have a sketch that sends data to the serial device (/dev/ttyMCC) it has to be read by the A9 part else it will slow down the execution: It will time out every Serial.println(). (note 1) For example when you use the following script that blinks the LED every second it will blink every 3-4 seconds when you are not reading /dev/ttyMCC on the A9 with for example minicom, Arduino IDE Serial monitor or a Python/PHP/C program. Code: void setup() { Serial.begin(115200); delay(100); pinMode(13, OUTPUT); } // the loop function runs over and over again forever void loop() { Serial.println("LED ON"); digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second Serial.println("LED OFF"); digitalWrite(13, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } Note 1: https://github.com/UDOOboard/linux_kernel/issues/14
Well this expected behavior is not documented here or here So when you not know this it will become a problem.... I did not ask to fix it, just to document it.
Is Serial.availableForWrite working for /dev/ttyMCC? If yes, that might be a way to prevent this effect on the M4-side by stopping sending something if the buffer is too small for the data to be sent.
Serial.available is working but not fully monkey proof. But perhaps I have to test it more. Serial.availableForWrite I had never heard about so that would be an extra option to test.
Well tried some options: void loop() { While ( Serial.available() >0 ) { -- Do something --- Serial.println("Some text"); } } This will work after a reboot. There is not data sent (and no other actions done) by Arduino until some data is send from the serial device from A9 side. But when Serial connection is closed from A9 Side it will continue and after a couple of cycles Serial.println will time out and slow down the execution of the loop by seconds. Starting the Serial connection again from A9 will solve this. void loop() { While ( Serial.availableForWrite() >0 ) { -- Do something --- Serial.println("Some text"); } } This is not working at all after reboot. As soon as the M4 is booted it wil start execution and Serial.println will time out and slow down the execution of the loop by seconds. Starting the Serial connection again from A9 will solve this. It seems that Serial.availableForWrite() is not implemented or not configured correctly. It does not give an compilation error.
Your test has a bug. You're checking the availability to be > 0 but are sending more than one byte to Serial. So if the result of availableForWrite is e.g. 5, you still run into the problem. So I adjusted your test a bit: Code: void setup() { pinMode(13, OUTPUT); Serial.begin(115200); delay(100); } void loop() { digitalWrite(13, LOW); while ( Serial.availableForWrite() < 12 ) { digitalWrite(13, HIGH); delay(500); digitalWrite(13, LOW); delay(500); } Serial.println(Serial.availableForWrite()); } But you're still right, the LED doesn't blink at all and when connecting to the serial port using minicom you always see lines with 896 as current value never decreasing.