Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13897
Lua rocks!
|
 |
« Reply #15 on: January 28, 2013, 07:07:31 pm » |
You seem to have this bootloader, based on the MD5 sum: stk500v2
stk500boot_v2_mega2560.hex 23d339e0ba55f179dd02e0e29d736991 *stk500boot_v2_mega2560.hex Loader start: 3E000, length: 8192 MD5 sum = 1E 35 14 08 1F 65 7F 8C 96 50 69 9F 19 1E 3D F0 Board name in IDE: Arduino Mega 2560 or Mega ADK
Could you install this newer one? http://www.gammon.com.au/forum/?id=11635// File = stk500boot_v2_mega2560_fixes_watchdog_problem.hex // Loader start: 3E000, length: 8192 // MD5 sum = 8A F4 7A 29 43 A0 D8 7C DB ED 09 A3 8F 40 24 1E // https://github.com/arduino/Arduino-stk500v2-bootloader/blob/master/goodHexFiles/stk500boot_v2_mega2560.hex
But, when I open the serial monitor, the chip resets and the program starts 9.5 seconds later. Is this delay normal ?
How do you know this anyway? Can you post the code for the sketch you are running?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #16 on: January 28, 2013, 09:30:10 pm » |
You're right, I didn't install the one you asked me before sending the text file. For now, I installed this one : https://github.com/arduino/Arduino-stk500v2-bootloader/blob/master/goodHexFiles/stk500boot_v2_mega2560.hexThe result is attached with this post. For the 9,5 seconds, I first remarked it using « SerialCallResponse ». There was a 9,5 seconds between the opening of the serial monitor and the start of the program (and the reception of the first character). Now, I'm just using « Blink » since I can just watch the L LED (pin 13). If I plug the USB cable (or any other power source), the LED starts blinking right away, but when I start the serial monitor there's this 9,5 seconds delay.
|
|
|
|
« Last Edit: January 28, 2013, 09:43:34 pm by gabidanpremier »
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13897
Lua rocks!
|
 |
« Reply #17 on: January 28, 2013, 10:53:35 pm » |
What if you upload something like the ASCII code chart sketch. Test it. Then hit reset on the board and see if the sketch does its stuff again instantly.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13897
Lua rocks!
|
 |
« Reply #18 on: January 28, 2013, 10:56:18 pm » |
I built a standalone Mega2560 board with the Atmega16U2 to be able to use my system as closest as possible to a real Arduino.
Can you describe or draw exactly what you have connected to the reset pin, in particular in the way it connects to the USB chip (and indeed any wiring to it at all)?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #19 on: January 29, 2013, 07:26:57 am » |
I'm sending a part of my circuit schematic. It's almost exactly the same as of the Arduino Mega2560.
I tried something. I used SerialCallResponseASCII. I programmed it and opened the serial monitor. Within the delay (9,5 seconds), I've reset the chip by pulling the reset pin on my 3x2 headers to ground. The programmed started right away and the serial monitor began to show me data, as expected.
So I think there's a link between the request for a reset from the 16U2 and the 9,5 seconds delay.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13897
Lua rocks!
|
 |
« Reply #20 on: January 29, 2013, 03:38:30 pm » |
Put your scope on the reset line. Then open the serial monitor. Watch how long reset is held low.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #21 on: January 29, 2013, 06:11:02 pm » |
Here is the pic I took. The reset of the Mega2560 is on channel 1. When I open the serial monitor, it goes down from 5V to less than 1V and goes back to 5V within 3 ms.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13897
Lua rocks!
|
 |
« Reply #22 on: January 29, 2013, 06:19:33 pm » |
That's pretty strange. That pic looks OK.
You could try flipping the BOOTRST fuse so that the bootloader is not invoked. That rules in or out the bootloader somehow being the problem.
(Make the HIGH fuse 0xD9).
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #23 on: January 29, 2013, 07:43:16 pm » |
When I try that, there is no delay.
So, the problem must be with the bootloader, right ?
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13897
Lua rocks!
|
 |
« Reply #24 on: January 29, 2013, 11:17:35 pm » |
Well, it depends how you define "problem". That same bootloader on my official Mega 2560 board does not have a delay. So it is more likely to be a combination of the bootloader waiting for something, and the circuit making it thing that waiting 9 seconds is worthwhile. There is absolutely no activity on either Rx/Tx pins ... Yes, but are they high or low? If they are low try putting pull-up resistors on them, or just try that anyway.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #25 on: January 30, 2013, 10:21:05 am » |
There are both high.
The question is why my circuit, although working as expected, is making the bootloader not working as it should ?
|
|
|
|
|
Logged
|
|
|
|
|
Norfolk UK
Offline
Edison Member
Karma: 23
Posts: 1320
|
 |
« Reply #26 on: January 30, 2013, 10:30:29 am » |
Could the RX pin be floating/picking up noise and the bootloader is trying to read this as the programming info it expects but after some seconds it either gives up of the cause of the noise abates and it starts the main program.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #27 on: January 30, 2013, 11:13:11 am » |
I have inspected both signals with my oscilloscope and I didn't see anything there. If it's a problem of noise on the Rx with my setup, I think some people would have experienced the same problem with the Arduino Mega2560.
Maybe the bootloader is really waiting for something. But what and why ?
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #28 on: January 30, 2013, 11:30:00 am » |
I have inspected both signals with my oscilloscope and I didn't see anything there. If it's a problem of noise on the Rx with my setup, I think some people would have experienced the same problem with the Arduino Mega2560.
Maybe the bootloader is really waiting for something. But what and why ?
No signal seen at all, no steady low, no steady high? Maybe you forgot to turn on the scope?  Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #29 on: January 30, 2013, 02:08:46 pm » |
Oh, you're right. Here is the corrected sentence:
I have inspected both signals with my oscilloscope and I didn't see anything problem there.
The signals were steady 5V.
|
|
|
|
|
Logged
|
|
|
|
|
|