RPi-Nano serial starts bootloader

Hi

I've got a sketch working on a Nano and it works well with the serial monitor window on my Win PC.

When I plug in the RPi (USB), the serial from the RPi causes the Loading LED to flash. That doesn't happen on the PC. The RPi just sends a few chars to trigger an standard reply from the Nano.

How do I keep from triggering the bootloader code on the Nano?

thanks

The Nano has circuitry that causes it to be reset every time a serial connection is made. The reason for this is that is that the bootloader must be activated to initiate a sketch upload so this allows that to be done automatically (auto-reset). In the old days you would need to press the reset button on the Arduino at the right time during the upload.

The way this works is that the state of the DTR and CTS pins on the USB-serial chip change state when the connection is made. A capacitor is used to momentarily pull the reset pin on the ATmega328P LOW.

You can temporarily disable auto-reset by connecting a 10 uF capacitor between the reset and ground pin on your Nano. A permanent fix would be to cut the trace between the USB-serial chip and the reset line. On the Uno there is a solder jumper you can cut to do this but I don't believe the Nano has that.

iabarryb:
How do I keep from triggering the bootloader code on the Nano?

It is normal for the Nano (and Uno and Mega) to reset when the PC (including RPi) opens the serial port. It will happen with the Arduino Serial Monitor also, although you may not have noticed it.

The solution is that your RPI program should open the serial port, allow time for the Nano to reset before sending the first data and then keep the serial port open until it is completely finished with the Arduino.

Have a look at how it is done in this Python - Arduino demo

...R

Thanks for the very useful replies. Not sure I want to go the HW mod route, but will keep it in mind. For now I've inserted a long delay after the fopen() and that seems to be working. There are numerous blog posts with folks just hooking the USB and gl with no consideration for this issue, which seems to make me wonder why I fell in the hole.

I'm a bit disappointed in this operation as I'd hoped to have the Nano sampling A/D's and doing some filtering which MAY be flushed by the Reset. Will have to look into that.

Again, thanks so much for the helpful info.

Another way to connect a PC to your Nano without causing a reset is by using a USB-TTL cable connected to the Nano's Rx Tx and GND pins.

...R

Additional clarification: on rereading my original post, I described the problem as being a RESET when first plugging in the Nano-RPI USB. This is incorrect.

The devices have been physically connected via USB for some time. It appears the fopen() is causing the DTR to toggle and reset. After the newly inserted sw delay, the subsequent W/R operate properly.

My RPi program runs and terminates. On further testing, it appears the DTR toggle only occurs on the first execution of the program. The plot thickens!

I’m posting this in the hope that it is of value to others who may run into this issue.

I’ve never had an issue with this - my serial
Coms are based on the coms examples provided with the Arduino IDE which don’t use the “fopen” command - maybe that’s the issue?

iabarryb:
My RPi program runs and terminates.

That is generally not a good idea when linking to an Arduino.

...R

Oh please tell me more than that! :o
I've considered having the Nano send data at about 1Hz and have the RPi ignore it until called. The idea is a user issues a cmd on the RPi which calls my C prog and then displays a result of data taken by the Nano.

I'd prefer not to say much more here, but would love to hear more from you regarding this overall topic. If interested try iabarryyy (at] gm

I much appreciate the comments.

iabarryb:
I'd prefer not to say much more here, but would love to hear more from you regarding this overall topic. If interested try iabarryyy (at] gm

Say it here, or not at all. I am not interested in having a private discussion about the matter. Why on earth would you need to keep it secret?

having the Nano send data at about 1Hz and have the RPi ignore it until called.

Nothing that I have suggested precludes that - just make sure the RPi program does not close the serial connection. And, think about it, if it did close the serial connection how could it know the Arduino sent data.

...R

Solutions:

  1. For now, on the RPi, inserting a 1 sec delay after doing fopen lets the Nano attempt to load and then return to foreground (running the program).

  2. The suggested hw fix of adding a 10ufd to Gnd can easily be implemented on the mother board hosting the Nano. Along with a 2pin header, I can open the 10ufd cap and allow a load to occur. This bit of manual intervention is ok as both the RPi and the Nano will be remotely located and not frequently updated.