Tips for resetting the Arduino

For general Flowcode discussion that does not belong in the other sections.
Post Reply
max.tisc
Posts: 113
http://meble-kuchenne.info.pl
Joined: Thu Dec 10, 2020 5:40 pm
Been thanked: 10 times

Flowcode v9 Tips for resetting the Arduino

Post by max.tisc »

Hello everyone
I need to perform a reset on Arduino 2560 by passing the button on the board, browsing the forum it doesn't seem to me that anyone has already addressed the topic, my idea is to do it via hardware by setting the reset pin to 0 via a transistor connected to an output pin, but the path does not seem feasible as the pulse obtained would be too small and would not correctly trigger the reset of the device and it is not even recommended by Atmel, there are those who have done it using a NE555 to increase the reset time but it seems too elaborate as a solution, is there a software solution for example with the watchdog to force the reset? do you have any examples?
thanks
Attachments
Screenshot 2024-09-29 185415.png
Screenshot 2024-09-29 185415.png (62.74 KiB) Viewed 4632 times

mnfisher
Valued Contributor
Posts: 1551
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 138 times
Been thanked: 739 times

Re: Tips for resetting the Arduino

Post by mnfisher »

There are several ways to do this. Not entirely sure why you'd want to do this though - restart program? Would a loop (and some sleep) be better?

1) Connect a digital pin to the reset pin - pull pin high to reset
2) Call address 0 (see attached) This outputs some text to UART (at 115200 baud) - then resets after 5s and does it again...
3) Using the wdt timer (#import <avr/wdt.h> (for example wdt_enable(WDTO_15MS); )

Martin
Attachments
Reset.fcfx
(10.47 KiB) Downloaded 136 times

max.tisc
Posts: 113
Joined: Thu Dec 10, 2020 5:40 pm
Been thanked: 10 times

Re: Tips for resetting the Arduino

Post by max.tisc »

thanks mnfisher
I need this to reload the program after making changes to the settings of the instrument I'm building, this practice is used by some manufacturers.
the first point you propose does not seem to be feasible because the reset pulse would be too small (also discouraged by atmel)
the second point where you call the call address 0 I will try it as soon as possible and it was also proposed on other forums as feasible and working
for the third point how should I do?
in the settings auto clear watchdog implies something?
thanks

mnfisher
Valued Contributor
Posts: 1551
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 138 times
Been thanked: 739 times

Re: Tips for resetting the Arduino

Post by mnfisher »

I didn't try - but the pulse would stay high until the MCU resets?

The attached program demonstrates calling address 0... This works AOK.

WDT is used automatically - on PIC / esp32 etc but not so on AVR - again didn't test this.

Martin

mnfisher
Valued Contributor
Posts: 1551
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 138 times
Been thanked: 739 times

Re: Tips for resetting the Arduino

Post by mnfisher »

For fun - I tried using a jumper from a digital pin to the reset pin.

It seems to work perfectly - the pin needs to be pulled low to reset - so I set it high at the start of the program, which may not be necessary as it will be set as an input on reboot. I added a 'reset' pin to the properties (and I used d7)

The previous method seems better though - no external 'hardware' needed....

Tested without setting the pin high at the start (so left as an input) - and works well :-) The drawback with this method is you need to 'pull' the jumper to re-program the Arduino...

Martin
Attachments
Reset.fcfx
(11.64 KiB) Downloaded 129 times

max.tisc
Posts: 113
Joined: Thu Dec 10, 2020 5:40 pm
Been thanked: 10 times

Flowcode v9 Re: Tips for resetting the Arduino

Post by max.tisc »

Hi Martin
I put your software reset in my code and it works fine, that's exactly what I needed
Thank you for your availability

Post Reply