Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

18
  • thank for the explanation. i'm not sure about 1200 baud rate magic. in arduino ide source code it just sets DTR/RTS to 1 and 0 in 50 ms and that's enough to reset the board. it's almost the same way i'm making Uno to reset (but i use HM-10 PIO as DTR with the same reset schematics). I'm 100% sure it actually reset and i can see 'hello' which runs in setup() in uploaded arduino sketch. what about timeout this can be the reason (i've updated the question with log). But this is the way i upload successfully to Mega2560. So you think arduino does not remember/know how reset was initiated? Commented Sep 8, 2015 at 11:35
  • i've updated the task with uploading over USB log. You can see after Send: A [0x41] . [0x81] [0x20] interaction continues in contrast to uploading over BLE Commented Sep 8, 2015 at 11:50
  • 1
    Hmmm, interesting. The 1200 baud rate definitely works (just checked) but there seem to be two separate mechanisms it can use. In any case it is of no use to you here. The Mega2560 uses a different bootloader, but it also seems to have a 1 second timeout. The Atmega328 does remember how it was reset, but only between options such as brownout detect, watchdog timeout, new power on and external reset - it can't tell the difference between different resets using the external pin. Commented Sep 8, 2015 at 11:54
  • what command should be invoked within 1 second to let bootloader know it should not start the app and uploading is going to happen? Commented Sep 8, 2015 at 17:39
  • 1
    The command to be sent is any command valid within the optiboot bootloader protocol. And if you take a look at the Atmega328 datasheet you'll see that Figure 10-1 shows the reset logic and the source of the 4 reset source bits in the MCU status register. That is to say that the Atmega328 sets that bit because it detected a reset event at the RESET pin. Commented Sep 8, 2015 at 22:15