Hello Guys,
after a little while and after having some tranquilizers I could come up with the first working version. I have not implemented the verification yet (but it is necessary, I'm afraid) but the upload works - well, more or less. With smaller .hex files like Blink it works seamlessly. The binary is getting bigger, the chances for having some issue (either timeout or maybe some bits are altered in the BT communication) is getting bigger, too. I'm not really sure how to tackle this issue other than verify the uploaded sketch and report if something was wrong. Also, maybe my code is not perfect somewhere, I don't know - that's why I wanted to publish it. Another thing I was thinking of is a better circuit that gets less noise from the environment.
How it works:
- You have to have the .hex version of your sketch. (If you compile it in the Arduino IDE, it tells where you can find the binary at your computer. Use the .hex file and not the .bin; the .hex is a text file really that I could download and process easily.)
- When you click on the download button, it gets the URL from the field in the screen. Then it interpret the intel .hex file format (only if it's 8 bit, I don't handle memory addressing > 64kbyte), break it into 128 byte pages (this is the biggest memory size you can write at once), then put it to a List
- Connecting to the BT dongle should not be a problem
- The "upload" button first wait for the restart of the Nano (in fact, it waits for zeroes in the BT communication), then it starts doing its thing. It gets a sync then send some trivial commands to see if the other end is really an Atmel328p with a bootloader. Then it loads the memory addresses and write the stuff from the global variable (List called "file").
- At the end, it closes prog mode.
I used an excellent article to implement the above protocol.
I hope someone will try out and maybe improve it. ![]()
I hope you're going to enjoy it.
Cheers!
letolto.aia (21.4 KB)