Extra CR/LF (\r\n) in serial output

I bought three Nano Every's from the Arduino store. I foolishly assumed that my existing Nano code would run on it. OK, I can see that, since it is a different processor, has more memory. But some of the things should be the same.

The most curious one is the extra CR\LF. In order to debug, I print out single characters to indicate the state of various routines. [ Serial.print('x'); ] I have a 40 second delay [unsigned long i= millis();while(millis()-i<40000); ]to simulate the unit powering down. When the delay is complete, I print [ Serial.println("Awake"); ] I get a blank line where there should be none.

Here's the really curious thing: Only on two of the Nano Every's, the other is as expected, as it is on the other five Nano's I'm running.

I have carefully looked at my code and I have only 1 println() and no \r\n's in all the statements that are executed in loop().

This is disturbing because it makes me think that there are other quirks in the Every.

Please post a complete sketch that illustrates the problem.

NOTE: it need not be your actual project sketch

In passing, why complicate things by using millis() to implement a blocking delay when you could simply use delay() ?

1 Like

Thanks for responding UKHeliBob,

Here is a link to my project In order to recreate the issue, besides the Nano Every, you'll need an RPi and two nRF24l01 radios connected to each.

The radio is connected to the SPI with CE on D10 and CSN on D9, VCC 3V3. For the RPi configuration, see Automation/IoT with NRF24L01+ and MQTT

Good question about delay(). It is my understanding that delay() uses a timer and an interrupt. From reading the various projects of TMRh20, interrupts will interfere with the code written for the radio. This implementation of a blocking delay does not block interrupts.

Thanks again for responding.

OSD

It's an incomplete understanding. Because, millis() uses the same timer and interrupt.

Why ? If one of the Nano Every's is adding a CR/LF to Serial output then it should be trivial to demonstrate it with no extra hardware

Yeah, UKHeliBob, it should be easy. I wrote a very simple bit of code as you suggested and the anomaly did not present itself.

So it would appear that there is something about my code, though the anomaly only appears on the two Every's , not the third one I have, nor on five other older Nanos, nor a Uno.

Not really worth pursuing at this point, I just thought that someone else might have seen something like it. Maybe it's just me.