Our little company will be having an ATtiny85 Arduino-based board manufactured. We'd like to have the manufacturer programme the chips for us (500 pieces), but what do they need in order to do this? Obviously they can't go through the DIYer's process of flashing the bootloader and then uploading the Arduino code for each chip. Or is that exactly what they do?
Is giving them the HEX file generated by the Arduino IDE enough?
That was an interesting question on this forum. Obviously it doesnt have anything to do with Arduino. Instead it is a question about how to OEM program AVR.
First of all there is no need to program a bootloader and upload. Typically an ATtiny is programmed with the ISP interface. If the PCB does not have a ISP connection and uses SMD components the programming will have to be done before the assembly.
The HEX file is just fine (if they can handle that ;-). That is a question to the PCB Assemby house.
The question is - how much of an Arduino will be on your boards?
Does it include a USB interface; does it need a USB interface and will there be any requirement for field upgrades?
If you do not need field upgrades then you do not need the bootloader and in fact, you do not want it to be present as it slows the start-up and contributes nothing to the normal operation. Even if you do have a USB interface.
The approach for production manufacturing is to provide a pad pattern (or holes) for the ICSP header but instead of fitting the header, you use a "pogo-pin" jig to program it at the time of manufacture, using ICSP with your sketch but not the bootloader.
On the other hand if you require field upgrades and have provided a USB interface, then a combined .HEX file can be produced to program both bootloader and sketch upon manufacture.
Thank you both for taking the time to help me out with this!
It's good to know that the HEX file from the Arduino IDE can be uploaded as it is to the chip. I'll need to figure out if we go the ICSP pads or preprogrammed chip route.
I think the combined bootloader + sketch HEX file is needed because of two concerns:
DIY
We're opening the board up to DIYers to reprogramme, using the methods described by the MIT High-Low Tech Group here: http://highlowtech.org/?p=1695 . This is how we've been developing the design. We're not including a USB connection, it'll be up to the user to connect their Arduino (or other programmer) to the board directly.
Clock speed
I'm not an embedded expert, and the only experience I have changing the clock speed of the chip is by selecting the board type and burning the bootloader in the Arduino IDE (we're going down to 1 mHz), but I'd be happy for other suggestions for doing this—though I think the need for the bootloader (above) solves this issue.
I did a little searching and couldn't find instructions for creating a combined (bootloader + sketch) HEX file. Could you be so kind as to point me to some instructions?
sintheta:
It's good to know that the HEX file from the Arduino IDE can be uploaded as it is to the chip.
Which is to say it can be uploaded as it is, using ICSP without the bootloader. If you never intend to use serial downloading, you never need the bootloader.
sintheta:
I'll need to figure out if we go the ICSP pads or preprogrammed chip route.
It sounds from the following as if you absolutely need the ICSP pins, so you might as well use them for initial programming.
sintheta:
We're opening the board up to DIYers to reprogramme, using the methods described by the MIT High-Low Tech Group here. This is how we've been developing the design. We're not including a USB connection, it'll be up to the user to connect their Arduino (or other programmer) to the board directly.
That still begs the question of whether you propose to provide a serial - TTL - interface point in the design - Tx, Rx and reset - to use with a bootloader and a USB to TTL adapter (which is ridiculously cheap, but so are the AVRISP knock-offs) or not. It does begin however to sound as if you should just forget the bootloader and serial downloading.
sintheta:
I'm not an embedded expert, and the only experience I have changing the clock speed of the chip is by selecting the board type and burning the bootloader in the Arduino IDE (we're going down to 1 mHz), but I'd be happy for other suggestions for doing this—though I think the need for the bootloader (above) solves this issue.
Insofar as if you want to use a bootloader, it will not be practical to alter the clock.
sintheta:
I did a little searching and couldn't find instructions for creating a combined (bootloader + sketch) HEX file. Could you be so kind as to point me to some instructions?
Can load this up & send it to your manufacturer, they attach to the board (or press onto pogo pins), press the button, wait a few seconds for green light to stop flashing.
Once again, thanks for all your input. I thought I'd update with how it's progressing so far.
We had a chat with Digikey, who'll be supplying the chips, and they're perfectly comfortable loading the bootloader and Arduino sketch onto the chips, which is great for me because it means I'm no longer in over my head.
So, no need for ICSP pads. We also can't add ICSP headers because it's a wearable project and sticky-outy parts are a no-go.
Any programming will be done using a solution that I saw a while ago (I think with Fabrickit, but I can't seem to find it online anywhere). What would have normally been the ICSP headers will instead be a line of through holes into which the user can insert a single line of male headers and hold there while programming from the Arduino (à la High-Low Tech instructions). One line, because I suspect that a 2x3 arrangement of holes will make the programming physically tricky, but haven't tested. This way anyone can use what they already have lying around on their bench (Arduino + wire + headers), and we don't have to add extra components. The reprogrammable feature of the product is really just an extra feature and not a core one, so it doesn't justify extra parts.