WeatherDuino Forum

Full Version: Mega 2560 problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
Yesterday I was updating an RX board (version 1.3) software to the latest version but while the computer was actually uploading to the 2560, there was a very brief mains power failure.  Angry

A few minutes later when power was restored I tried again to upload the software but this time the Arduino IDE just kept timing out. I tried many times but with the same result, so I'm guessing there's now some kind of "damage", either permanent or repairable, to the 2560. Not surprisingly the RX board wouldn't work - the display was unlit and the only sign of life was the green led on the 2560 itself.

Fortunately I have a spare 2560, so replaced the "damaged" device in the RX board and programmed it without any difficulty. With the new 2560, the RX board started up properly and appeared to behave normally on the TFT display but when I started up CumulusMX, it was unable to download archived data and the dashboard did not display data either. (This "test" RX is currently used with a Raspberry Pi but I've just tried it on a Windows computer running CumulusMX and the result is exactly the same.)

I'm now *guessing* that the power failure while programming the original 2560 has affected not only that device, but maybe something on the RX board too??

I would be very grateful to any thoughts or suggestions!

Hello AllanG

Strange situation, I never heard that an interrupted software download could damage the Arduino. Have you tried reprogramming the it after having removed it from the RX board (you may have to put the removed diode again).
If you have and ISP programmer like the USBasp, you can also try install the ISP pins and and reprogram the bootloader (in this case there is no need to reinstall the removed diode).

There are two software tools included in the utilities folder which may help you to do some diagnostics:
FlashMemory_test - test if the memory used for data log is working.
I2C_Scanner - test the I2C bus, check if the external eeprom is detected.
Thank you, Werk_AG, for the suggestion about using tools in the utilities folder to check functioning of the RX board itself, I hadn't thought of that!  Blush  I'll try that a little later and post the results here.

I also hadn't thought of replacing the diode on the mega 2560 and trying to reprogram it off the board which I may do, although an alternative I *had* thought of is to power it from an external supply and then try reprogramming? Unfortunately I don't have a programmer right now, although I've just looked up the USBasp and as they are very cheap I may get one if everything else fails.

Thank you again for your suggestions and I will report back later!

I've just done the FlashMemory and I2C tests, the results are:


Security register (byte 64 to 127) :
0xB, 0x4, 0xB, 0xE, 0x19, 0x0, 0x1F, 0x22, 0x0, 0x0, 0x52, 0x0, 0xFF, 0xFF, 0x9C, 0xFF, 0x30,
0x30, 0x4D, 0x32, 0x37, 0x39, 0x31, 0x36, 0x5, 0x10, 0x31, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x43,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
Status register :10001100
Manufacturer ID :
Device ID (part 1) :
Device ID (part 2)  :
Extended Device Information String Length  :


I2C device found at address 0x40  !
I2C device found at address 0x50  !
I2C device found at address 0x68  !
I2C device found at address 0x76  !

I'll try powering up and reprogramming the non-working Mega later.

(29-03-2018, 07:13)AllanG Wrote: [ -> ]Unfortunately I don't have a programmer right now, although I've just looked up the USBasp and as they are very cheap I may get one if everything else fails.

Hi Allan,
According to various sources you can reprogram the bootloader onto an Arduino by using another Arduino. It would be easier to use an ISP but if all you have is lemon's then sometime you need to make Lemonade Wink


I quite like Julian Illets' videos. He does some interesting stuff. I also think he and Big Clive should build a WeatherDuino Pro Wink
Hi uncle_bob. Yes, I like Julian Illett and Big Clive's videos too and you're right, it would be great to see them build a WeatherDuino!!

Back to the Mega 2560 though and after playing around with it most of yesterday I needed something much stronger than lemonade last night and a bottle or two (or more!) of good beer helped.... (Staropramen of course if you read this Zdenek Shy )

I thought about your idea of using one 2560 to program another, U_B, and I do have a total of 3, but 1 is on the "operational" system that I obviously don't want to disturb, a second did program and is now on the "test" system although it isn't working properly and of course the third is the "faulty" one. So I decided to try the easiest thing first. Off the RX board of course, I powered up the "faulty" 2560 on the bench and tried programming it with my "test RX" sketch. Same thing happened as when it was on the RX board - just kept timing out. Tried a few times with the same result. I then wondered if it would accept another sketch so at random I tried the I2C_scanner. To my amazement it DID program the device!! Tried again a few times and each time it did so successfully. Thinking that perhaps something had been reset on the device, I tried the "test RX" sketch again but again it failed. Angry I then thought that maybe the sketch itself was somehow corrupted so tried to program a fresh, un-modified version of the b011 software and that DID program properly. Hoping I had finally solved the problem, and with the "successful" sketch still open on the computer, I went through it and did the necessary modifications. Pressed the upload key and it failed with the same "timed out" fault.... Angry Angry  After that I spent more than an hour trying to upload *anything* to the device but it just wouldn't work again. This is all VERY strange.

Using a process of elimination I know the software is perfect and the Mega 2560 CAN work so I'm now wondering if the problem is related to my computer. I'll try installing the Arduino IDE on another machine, hopefully later today and see what happens!

(30-03-2018, 07:44)AllanG Wrote: [ -> ]Angry Angry  After that I spent more than an hour trying to upload *anything* to the device but it just wouldn't work again. This is all VERY strange.

No mather the sketch, it don't upload?
Indeed! Very strange. Huh
That's correct, Werk_AG, nothing at all will upload, it just keeps giving the "time out" error. Since my post yesterday, I have done some more "experiments" and the results worry me.... Confused

To see if there may be corruption of the Arduino IDE and/or other files on the computer I was using at the time of the power failure, I installed Arduino IDE and downloaded the b011 software onto a spare computer. The results were exactly the same, so I don't think there's a problem with the computer. Yesterday I was able to get a new, unused Mega 2560 and some time in the next few days I will try using that to reprogram the bootloader in the "faulty" 2560 as uncle_bob suggested. It might work, it might not, but there's nothing to lose by trying!! 

More worrying than the "faulty" 2560 though is the fact that my "test RX" still is not working properly using the spare 2560 which programmed properly on the first attempt. (I have also just tried my new 2560 which also programmed perfectly) The RX board uploads ok to ThingSpeak and also uploads the AQI data. Data is displayed properly on the TFT screen but when I start running CumulusMX, it just hangs at the "downloading archived data" stage and does not go on to "normal running":

pi@WeatherPi:~/share/CumulusMX $ sudo mono CumulusMX.exe
Current culture: English (United Kingdom)
Serial: xxxxxxxxxxxxxxx
Cumulus MX v.3.0.0 build 3043
Today.ini = data/today.ini
Last update=2018-03-27T08:18:00
Connected to station
19:11:27 Downloading Archive Data
Cumulus running at: http://*:8998/
(Replace * with any IP address on this machine, or localhost)
Starting web socket server on port 8002
30/03/2018 19:11:28
Type Ctrl-C to terminate

That is a copy of the screen after more than 14 hours of running. The "last update" date and time is when I stopped CumulusMX before attempting to update to version b011 - and the power failure, although I have stopped and restarted Cumulus many times since... Undecided Undecided

I am now fairly sure the original Mega 2560 has been damaged/corrupted in some way by the power failure, but maybe repairable. Although the WeatherDuino RX board *is* working with (2) replacement 2560's I haven't been unable to upload data to CumulusMX since. I know you've not experienced any problem like this, but is it *possible* there's also some damage/corruption to the RX board that's preventing uploading data or do I need to look somewhere else I haven't thought of??

Hello Allan

My best sugestion is to try to start CumulusMX with the Data Logger disabled, and check if there is normal comunication.
Edit the Cumulus.ini file and change this:


If everything works fine, later you can try start CumulusMX with the Data Logger enabled again.
I'm wondering if the com port is already in use when trying to upload the sketch. That seems like the behavior is the Serial Monitor is still running when you try to upload.
Pages: 1 2 3 4 5