Pages: 1 [2]   Go Down
Author Topic: How to reset Arduino UNO without pushing reset button?  (Read 1950 times)
0 Members and 1 Guest are viewing this topic.
Central MN, USA
Online Online
Tesla Member
***
Karma: 75
Posts: 7305
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Lefty. You and I and maybe a few are probably the only hold-outs with our MEGA1280s. The clone 2560 are so cheap on ebay that everyone that talks about MEGA to me lately have this or that version of MEGA2560. I even noticed the annoying fact that 2560 has moved one screw hole 0.05" from the 1280 footprint (bottom left hole 0.05" to the left from 1280 location). I'll try the jump to zero. I was seeking answer for UNO system and found the jump-to-zero solution and then came to know about the watch dog so went with watch dog. Now I want to explore the jump to zero again. I'll see how this affects the project I'm working on, which has a few serial devices on the serial-serial3, one Sd card on SPI, one RTC on I2C. I am assuming that these hardware registers will be set up by the bootloader once it runs after jump to zero, correct?
Logged


New River, Arizona
Offline Offline
God Member
*****
Karma: 19
Posts: 936
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Thanks. I know of the location zero but also vaguely remember people mentioning that just the execution is reset and other things aren't. Could you give me some hint on what does and doesn't reset by calling zero?
I spent spent several hours trying to get a definitive answer to that exact question with no success.  There are lots of opinions and suppositions out there, but I never found anything definitive, so I tested it.  I can't (over thousands of automatic reboots) tell any difference at all.  So, if there is a difference, it doesn't seem to matter.  Lefty is right that some of the registers don't get defaulted to the power on state, but subsequent initialization in both the bootloader and your code seems to take care of those problems.  Just make sure you set the things you use to the state you want them in in setup() and everything works, every time.  Been there, done that.....a lot.
Quote
BTW, your home page temperature scale is in DegF, right? Does it every go near 150F as the max scale is set there? Horrible heat.
Nope, it doesn't get to 150F, but it I have measured it at 126F a number of times.  I use 150 as the top point to leave a little play room.

Yes, there is a bootloader for the 2560 that fixes both the '!!!' bug where three exclamation points will stop the boot loader by kicking it into a little known debug mode, and the WDT problem that has plagued us for years.  Far as I can tell, it still isn't in the production boards, but you can get it and load it.  I was one of the first to try it out and wrote it up on my page at:

http://www.desert-home.com/2012/05/arduino-mega2560-wrapping-up-bootloader.html

My little trick of turning the WDT into a timer and using it to call location zero was my fallback for hardware for a very long time.  It worked every single time it was needed perfectly, so I've been testing the location zero jump long term on many different boards, old arduinos, new UNOs, 2560s of various revisions, etc.  Once I found out that I could have a WDT that would span 15 minutes I went a bit nuts.
Logged

Trying to keep my house under control http://www.desert-home.com/

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 362
Posts: 17307
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Lefty. You and I and maybe a few are probably the only hold-outs with our MEGA1280s. The clone 2560 are so cheap on ebay that everyone that talks about MEGA to me lately have this or that version of MEGA2560. I even noticed the annoying fact that 2560 has moved one screw hole 0.05" from the 1280 footprint (bottom left hole 0.05" to the left from 1280 location). I'll try the jump to zero. I was seeking answer for UNO system and found the jump-to-zero solution and then came to know about the watch dog so went with watch dog. Now I want to explore the jump to zero again. I'll see how this affects the project I'm working on, which has a few serial devices on the serial-serial3, one Sd card on SPI, one RTC on I2C. I am assuming that these hardware registers will be set up by the bootloader once it runs after jump to zero, correct?

Cool. But I have no idea what hardware register that are used and/or restored to default values by the bootloader.

So here is the mega1280 optiboot.hex file and the new entry for the boards.txt file if you ever want to upgrade your mega1280 boards bootloaders, faster upload time plus no WDT or !!! problems.

optiboot_atmega1280.hex

Code:
:020000000404F6
:020000021000EC
:10FC0000112484B714BE81FFF2D085E08093810077
:10FC100082E08093C00088E18093C10086E08093F9
:10FC2000C20080E18093C4008EE0CBD0279A86E0AA
:10FC300020E33CEF91E0309385002093840096BB55
:10FC4000B09BFECF1F9AA8958150A9F7CC24DD2444
:10FC500099249394A5E0BA2EF1E1AF2EA6D0813479
:10FC600061F4A3D0082FB3D0023811F0013811F499
:10FC700084E001C083E091D08DC0823411F484E12E
:10FC800003C0853419F485E0AAD084C08535A1F479
:10FC90008CD0082F10E089D0E82EFF24FE2CEE2413
:10FCA000E02AF12A8F2D881F8827881F8BBFEE0C32
:10FCB000FF1C8DD067016EC0863521F484E08FD0A3
:10FCC00080E0D9CF843609F042C06FD06ED0082FC3
:10FCD0006CD080E0C81680EED80620F483E0F601F0
:10FCE00087BFE895C0E0D2E060D089930C17E1F7B8
:10FCF000F0E0CF16F0EEDF0620F083E0F60187BFDC
:10FD0000E89565D007B600FCFDCFA601A0E0B2E003
:10FD10002C9130E011968C91119790E0982F8827C4
:10FD2000822B932B1296FA010C0197BEE8951124B1
:10FD30004E5F5F4FF3E0A030BF0751F7F601B7BE4B
:10FD4000E89507B600FCFDCFA7BEE89523C0843731
:10FD5000A1F42BD02AD0E82E28D039D0E6010E2DE0
:10FD6000FE0186911AD021960150D1F70894C11C4A
:10FD7000D11CEA94CE0CD11C0DC0853731F427D0AC
:10FD80008EE10BD087E909D075CF813511F488E079
:10FD900018D01DD080E101D061CF982F8091C00094
:10FDA00085FFFCCF9093C60008958091C00087FF27
:10FDB000FCCF8091C00084FD01C0A8958091C60051
:10FDC0000895E0E6F0E098E1908380830895EDDF08
:10FDD000803219F088E0F5DFFFCF84E1DECF1F939A
:10FDE000182FE3DF1150E9F7F2DF1F91089580E04B
:08FDF000E8DFEE27FF2709946C
:040000031000FC00ED
:00000001FF

New entry to be added at the end of the arduino core boards.txt file

Quote
##############################################################

megao.name=Arduino Mega1280 Optiboot
megao.upload.protocol=arduino
megao.upload.maximum_size=130048
megao.upload.speed=115200
megao.bootloader.low_fuses=0xff
megao.bootloader.high_fuses=0xdc
megao.bootloader.extended_fuses=0xf5
megao.bootloader.path=optiboot
megao.bootloader.file=optiboot_atmega1280.hex
megao.bootloader.unlock_bits=0x3F
megao.bootloader.lock_bits=0x0F
megao.build.mcu=atmega1280
megao.build.f_cpu=16000000L
megao.build.core=arduino
megao.build.variant=mega


Tested on both a Seeeduino mega1280 and an arduino mega1280 board.

Lefty
« Last Edit: January 29, 2013, 01:58:21 pm by retrolefty » Logged

Pages: 1 [2]   Go Up
Jump to: