Does MoteinoMega require a hard reset when powered from external source?

Started by Tomega3, May 29, 2016, 03:21:44 PM

Tomega3

Having great fun programming my moteinomega with rfm69HW and Felix's FTDI adapter.
I have the code programmed via arduin ide using the ftdi adapter and debugged using a serial monitor using same ftdi adapter.

It now time to remove the ftdi adapter and just supply 5v and Gnd to the motes Vin and gnd pins.
I use the radio to send debug msgs to a remote laptop using a usb moteino that listens and sends to a serial monitor running on the laptop.

When the moteinomega is powered via the 5v supply, I have to press the reset button on the mote to get the code to start running. When using the ftdi adapter the mote resets when I connect the serial monitor. My ftdi adapter has the dtr solder jumper connected and the rst jumper open.

Is there a way to affect a board reset when external power is supplied without having to press the reset button?

A long time ago I might have setup a one shot timer ckt to hold a line low for xx milli or micro seconds then return to hi. If this is the solution, what ftdi interface pin should I connect this one shot timer ckt to?

Are there better/simpler ways to accomplish a power on reset rather than require a press of the boards reset button?

Thanks

Tom

TomWS

This problem has been noted several times on the forum but probably not in the Mega category.

In any case, a brief background:  The FDTI cable asserts DTR low whenever the serial port is opened or the cable is first powered up (ie, plugged into a USB port).  This resets the processor via a blocking capacitor connected to the Reset pin on the processor.

If the FTDI cable is not connected, there is no external reset pulse (unless you press the button on the Mega), however, the processor's power-on logic SHOULD reset the device.  In my experience this is VERY dependent on the power source and probably the rise time of the power source.  I have found a reasonably reliable 'fix' is to connect pin1 to pin 6 of the FTDI connector IF the FTDI cable is not being used.  This temporarily holds the RESET line low while the processor is powered on.  I just use a 6 pin connector with the two pins connected.

A more reliable solution would be an external Watchdog/Reset circuit, as you've indicated.  On my new PCBs, I'm using a TPL5010 watchdog circuit for keeping the processor alive and well throughout power cycles and software oopsies...  (For full disclosure, I haven't tested any of these newer designs yet, but the TPL5010 is pretty straightforward so I'm not expecting too many surprises.)

Tom

Tomega3

Thanks Tom

Just to be clear, the ftdi adapter is NOT connected to my mega. I am connecting 5v and Gnd from my external power source to the megas Vin and Gnd pins on its 6 pin ftdi connector.

If I connect pin 1 and pin 6 via a jumper I would be connecting Gnd to the DTR/RST pin on the megas 6 pin ftdi connector.

Is this correct?

Thanks

PS
I will probably be ordering another mega with built in usb and the rfm69HCW radio and flash chip to act as a test bed for new code and then use it as a gateway to reprogram my mega that's mounted on my autonomous robot.
Its almost ready for its first day out of my workshop. I developed a processing sketch to display the bots position and distance/direction to obstacles in it travel path. It can also send commands to the bot and receive debug info. Could not have done this without your and Felix's  help a long time ago with sending a structure of data where each structure identifies itself with a byte that indicates what structure is being sent/received.

TomWS

Quote from: Tomega3 on May 29, 2016, 06:18:41 PM
Thanks Tom

Just to be clear, the ftdi adapter is NOT connected to my mega. I am connecting 5v and Gnd from my external power source to the megas Vin and Gnd pins on its 6 pin ftdi connector.

If I connect pin 1 and pin 6 via a jumper I would be connecting Gnd to the DTR/RST pin on the megas 6 pin ftdi connector.

Is this correct?
Yes, this is correct.
Quote
PS
I will probably be ordering another mega with built in usb and the rfm69HCW radio and flash chip to act as a test bed for new code...
LOL!  Careful or you will get used to the GOBs of memory the Mega has and won't be able to implement your code on the anemic 328P!

Good to see you're still working at it!

Tom

Tomega3

Hi Tom
DTR pin on ftdi header to Gnd works like a champ to reset the mega upon power up via external supply
I wonder if a simple rc network would do the same on the DTR pin (Vcc to top of R, bottom of R to top of C, bottom of C to Gnd with a jumper connected to where the RC meet to DTR (I can draw it better then describe it)

My code uses the on board watchdog timer and in this app does not run in Low Power mode. It works on 328P and 1284P and the 2560 atmel chips. Let me know if you want to see the code.

Yes,  I am spoiled with the 1284P mega, Felix and you guys really made the Best arduino compatible board out there. I still code for efficient code use (had to when the only thing out there was a 328P and the 2560 board was just way to big.

Very few things on my wish list for the moteino mega with the on board USB:

Locate a source/distributor for a small case to mount the moteino mega, a small lipo battery and a dipole antenna (SMA connector) with a thru hole for the usb port available. Maybe a size of a pack of playing cards or smaller.

and
On board battery charger or a daughter board with it and an I2c battery monitor (Maxim I2c MAX17043 single cell Li-Poly/Li-Ion fuel gauge.or similar) - no need for a voltage divider on an analog pin)
The usb port can be used to power the board/charge the battery and comunicate with the ide. I would do both during developoment and connect a solar panel when the mote is deployed in the field.

Really love you RFM_ATC work and am looking forward to trying you RFM_Listener work for my next battery powered lots of remote motes communicating with a gateway.

TomWS

Quote from: Tomega3 on May 29, 2016, 08:36:22 PM
Hi Tom
DTR pin on ftdi header to Gnd works like a champ to reset the mega upon power up via external supply
I wonder if a simple rc network would do the same on the DTR pin (Vcc to top of R, bottom of R to top of C, bottom of C to Gnd with a jumper connected to where the RC meet to DTR (I can draw it better then describe it)
Oh, you mean something like this?

This is what I used on my own PCBs before I decided to use TPL5010.  You really can't go lower than 3.3k on the DTR pin, but this arrangement works well.

Tomega3

I was think of something like this for a simple Power On reset Ckt



I think I need help in learning how to insert and image
I read the help and it looked like you attach a file that may display after the post


TomWS

Quote from: Tomega3 on May 30, 2016, 02:52:07 PM
I was think of something like this for a simple Power On reset Ckt
Well, of course that reset circuit will work on its own, but it won't permit you to reset the processor with the FTDI cable...

Quote


I think I need help in learning how to insert and image
I read the help and it looked like you attach a file that may display after the post
You need to include a link to a web based photo between the 'img' tags...  This will place the image inline in your posting rather than as an attachment as I had done.   I don't use a publicly accessible image host so I don't imbed images.

Tom