OTA flashing an ATmega328P with an imp

edited February 28 in Device Code
Hi everyone,

I'm trying to use an imp003 to flash an atmega328p over-the-air. The atmega has been flashed with some version of the optiboot bootloader (I used the hex file from my arduino IDE installation). I'm largely trying to follow this sparkfun tutorial, but I've made a few modifications to accommodate for the different imp and to aid in debugging (agent.nut and device.nut attached to this post). The device program has a few routines that seem to try to communicate with the bootloader using some STK command set which I know almost nothing about. The imp never gets to the actual flashing stage though, because STK command execution assert()s are failing. If I load the code I've attached to this message, I get the following server log output:


2017-02-28 17:12:53 UTC-6 [Status] Device connected
2017-02-28 17:12:53 UTC-6 [Device] -- device initialization --
2017-02-28 17:12:53 UTC-6 [Device] Starting to burn
2017-02-28 17:12:53 UTC-6 [Device] resetting AVR
2017-02-28 17:12:53 UTC-6 [Device] sending: 0x41 0x81 0x20 (3 bytes)
2017-02-28 17:12:53 UTC-6 [Device] received: null
2017-02-28 17:12:53 UTC-6 [Device] ERROR: assertion failed
2017-02-28 17:12:53 UTC-6 [Device] ERROR: at execute:124
2017-02-28 17:12:53 UTC-6 [Device] ERROR: from check_duino:142
2017-02-28 17:12:53 UTC-6 [Device] ERROR: from main:235
2017-02-28 17:12:53 UTC-6 [Agent] imp says it's ready
2017-02-28 17:12:53 UTC-6 [Agent] ERROR: you're attempting to send nothing
2017-02-28 17:12:54 UTC-6 [Agent] Programming started
2017-02-28 17:12:54 UTC-6 [Agent] Parsing hex file
2017-02-28 17:12:54 UTC-6 [Agent] Max address: 0x000000a2
2017-02-28 17:12:54 UTC-6 [Agent] Free RAM: 984 kb
2017-02-28 17:12:58 UTC-6 [Status] Device disconnected
2017-02-28 17:12:58 UTC-6 [Agent] imp says it's ready
2017-02-28 17:12:58 UTC-6 [Status] Device connected
2017-02-28 17:12:58 UTC-6 [Device] -- device initialization --
2017-02-28 17:12:58 UTC-6 [Device] Starting to burn
2017-02-28 17:12:58 UTC-6 [Device] resetting AVR
2017-02-28 17:12:59 UTC-6 [Device] sending: 0x41 0x81 0x20 (3 bytes)
2017-02-28 17:12:59 UTC-6 [Device] received: null
2017-02-28 17:12:59 UTC-6 [Device] ERROR: assertion failed
2017-02-28 17:12:59 UTC-6 [Device] ERROR: at execute:124
2017-02-28 17:12:59 UTC-6 [Device] ERROR: from check_duino:142
2017-02-28 17:12:59 UTC-6 [Device] ERROR: from main:235


...and yeah, the assert()s are obviously causing the imp to boot loop and repeat itself. But the main thing I'm getting from this is that the imp is sending a 3-byte command string to the AVR and getting nothing in return.

How should I proceed? I'm going to see what information I can find on that optiboot serial command set.. maybe then I could stick a scope on the TX/RX lines and see what's actually happening versus what should be happening.

I am looking forward to hearing your ideas. Thanks!
txt
txt
agent.nut.txt
12K
txt
txt
device.nut.txt
6K

Comments

Sign In or Register to comment.