1

If I connect an Arduino board via USB and open the terminal (OS X/Unix) and type in echo something > /dev/tty.usbmodem1411, it would send something to the board through that port. That's pretty cool, but what if I want to flash an entire .hex file? I don't think just echoing the contents would work. Are there any kind of parameters that I would need to use, etc?

Oh, I also do not want to use AVRDude. Without going too much into detail, I won't be able to install AVRDude on the computer I'd need this for.

Sorry if this question doesn't make complete sense. I'm new to Arduino and Unix in general.

crait
  • 156
  • 1
  • 4
  • 15
  • Do you have a Python interpreter (or are you able to install it) on your machine? – Aleksander Z. Jun 27 '16 at 22:13
  • Yes, @AleksanderZ., I do, but I would rather do this in C# and/or Swift, but if you have any suggestions, lemme know! – crait Jun 30 '16 at 19:20
  • Take a look at [this](https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168.c) and [this](https://github.com/aleksander-zn/PyTmegaBOOT168). The latter one is my repo, give a star ;). I can post an answer explaining how to interpret output of PyTmega if you like. – Aleksander Z. Aug 09 '16 at 23:20
  • Thanks, @AleksanderZ.! I will look into both of those. If I need more help, I'll respond here. Perhaps we could discuss this further elsewhere, too. – crait Aug 10 '16 at 20:34
  • There's one more document you may be intrested in: [AVR061/doc2525](http://www.atmel.com/images/doc2525.pdf) -- specification of the stk500v1 protocol that is used to establish communication between atmega 328p (more precisely: bootloader) and avrdude. On it's own it's not very useful, but it can help you understand what's going on in the output of PyTmegaBOOT168. – Aleksander Z. Aug 10 '16 at 20:58

1 Answers1

2

In order to do this to work with the built-in Arduino bootloader you will need to reverse engineer the protocol used.

Since AVRDude is open source, I would start by looking at the source and determine if you can reduce it to your minimum requirements.

Jeff
  • 1,364
  • 1
  • 8
  • 17
  • I've been looking into the source code and trying my best to pinpoint exactly how it works, but since I'm flashing firmware, I can't ethically rely on my low skill level to correctly rip code from it. I believe there is a very simple way to do this. – crait Jun 09 '16 at 16:53
  • Unfortunately, bootlloading is not a simple process. Have you seen/read http://www.atmel.com/Images/doc1644.pdf ? – Jeff Aug 02 '16 at 21:22
  • 2
    I don't recommend reading that datasheet (it's irrelevant) neither do I encourage anyone to read the source of avrdude, since it's quite a mess (at least for me) – Aleksander Z. Aug 09 '16 at 23:28
  • I 100% agree, @AleksanderZ.! @Jeff, I did look over that, but it does not really explain things. It shows your info, but it relies heavily on prior knowledge. Unfortunately, I don't know where to find this 'prior knowledge.' – crait Aug 10 '16 at 20:33