Binary File

Hi,

I am using Arduino board UNO (ATMEGA328P) with Arduino IDE . The thing is I have to put them on my own PCB board. In order to keep the costs low, I am not using the USB chips to program the ATMEGA328P. My questions are as follows

  1. What is my options to program the ATMEGA328P on my board? What path should I take? I meant JTAG or anything else.

  2. I also want to program 100 of these PCB (ATMEGA328P) at the same time. If its possible then please let me know how?

  3. Does Arduino generates any binary file that I can use to program the ATMEGA328P on my PCB using Atmel programmer?

walraven92:
I am using Arduino board UNO (ATMEGA328P) with Arduino IDE.

Good. You will need the "Arduino as ISP" sketch to use it as the programmer.

walraven92:
The thing is I have to put them on my own PCB board. In order to keep the costs low, I am not using the USB chips to program the ATMEGA328P.

Now that depends on whether you will be purchasing chips with the bootloader already loaded, or completely fresh, un-programmed chips. If you do not want USB functionality, then it certainly makes no sense to include the USB-to-TTL functionality.

walraven92:

  1. What is my options to program the ATMEGA328P on my board? What path should I take? I meant JTAG or anything else.

Again, this depends on whether you will be purchasing chips with the bootloader already loaded, or completely fresh, un-programmed chips. If you have the bootloader on the chips, then you only need connections for ground, +5V, TX, RX and Reset so that you can connect a USB-to-TTL module which includes the DTR or RTS functionality, with a 100 nF capacitor between DTR on the USB-to-TTL and Reset on your board.

If the chips will not have the bootloader, then you need to provide on your PCB, the ICSP pinout as on the UNO board itself. You should do so in precisely the same form as the UNO for compatibility - it is foolish to do it any other way.

However, you do not need to fit a header to the ICSP position. For programming, you use a connector with pogo pins fitted which is held compressed to the array of PCB plated-through holes when programming.

Note that in either case, the reset pin requires a 10k pull-up resistor to +5 V and only if you are using the USB-to-TTL module and 100 nF capacitor adapter, then a diode across this resistor.

walraven92:
2. I also want to program 100 of these PCB (ATMEGA328P) at the same time. If its possible then please let me know how?

Yes, you just need 100 of the adapters and PC ports, or UNOs (or Nanos) as ISP on PC ports.

I think you actually want this adapter that Nick Gammon describes - and his references will clarify the general programming process. Crossroads offers a ready-made and more sophisticated version of this.

Obviously, you cannot program 100 at once - some people have suggested you can parallel a few boards during programming but it is not advisable. The Automated programmers I have cited make it easy to do it rapidly and of course, it is really no slower to program one at a time that it would to absurdly connect each of the 100 to a huge programming device - I presume you did not really expect that in the first place.

walraven92:
3. Does Arduino generates any binary file that I can use to program the ATMEGA328P on my PCB using Atmel programmer?

Yes, the IDE does, but I thought you did not have an Atmel programmer anyway?

Paul__B:
However, you do not need to fit a header to the ICSP position. For programming, you use a connector with pogo pins fitted which is held compressed to the array of PCB plated-through holes when programming.

Depending on your scale, and how automated your process is, you don't need to use pogopins - I put a 2x3 piece of pin header into the connector from the programmer, poke it into the holes, and then angle it (thus applying a bit of pressure to make sure the pins are making contact) and hold in place while programming. I've almost never had to try more than one programming attempt doing it this way - it's not quite as fast or as easy as using pogo pins, but you can just do it with header strip you probably have already. For 10, it's silly to bother with pogopins, and for 1000 units, you'd be a fool not to, but I'm not sure how to call that.

I usually use USB Asp w/eXtremeBurnerAVR for xeroxing boards over ISP. You can just take your working board, "read all", and then start connecting it to other boards and doing "write all". For mass loading, of course, I can see advantages to a small stand-alone programmer as mentioned above.

The file you'll probably use for mass loading will be not binary, but a .hex file - it's human readable (in that with a bit of counting, you can see what the value stored at any location in the flash is), but not really human comprehensible (ie, you can see that location 0x024D of the flash contains 0x24 - but not what that means to the AVR).

DrAzzy:
I put a 2x3 piece of pin header into the connector from the programmer, poke it into the holes, and then angle it (thus applying a bit of pressure to make sure the pins are making contact) and hold in place while programming.

The angulation may be tricky if there are many components nearby.

I have to chuckle. Of course it works, but this is precisely what we get so upset about when someone is doing that to try out a LCD display with an adapter and it is not working. Of course, I do it "all the time" (well, occasionally) and I "know what I'm doing" so it is just fine. It's less critical with only a single row of pins.

DrAzzy:
For 10, it's silly to bother with pogopins, and for 1000 units, you'd be a fool not to, but I'm not sure how to call that.

I reckon somewhere around 50 might be it.

I haven't actually used my pogo pins yet.

DrAzzy:
The file you'll probably use for mass loading will be not binary, but a .hex file

But either way, conventionally called "a binary" in the programming world. :grinning:

You just need to break out the "ICSP" pins into a 2X3 connector. If your device is relatively small, you can make a generic programmer with pogo sticks to press your device against it with some holders. If your device is larger, with mounting holes, make a variation of your PCB so that the variation has target ICSP where the regular devices have their own ICSP. Add a couple of buttons for more automated programming. Then just screw them together (remember they have the same mounting hole placements?).

I programmed a couple dozen boards with my jig.