Hi,
I intend to develop a circular PCB using an ATMega328 TQFP32. However I'm wondering about a few design issues: how to install the bootloader? Can it be done after soldering? Can I program it using Arduino IDE? Is there is a way to install the bootloader and program sketches using the FDTI or the ICSP (I have to admit that I don't have a clear view of the function of these two...)?
Thanks a lot for your explanations and advices! :)
Quote from: darkcurrent on February 19, 2017, 01:44:31 PM
Hi,
I intend to develop a circular PCB using an ATMega328 TQFP32.
You mean like this: https://lowpowerlab.com/forum/projects/tiny-th-mote/ ?
Quote
However I'm wondering about a few design issues: how to install the bootloader? Can it be done after soldering? Can I program it using Arduino IDE? Is there is a way to install the bootloader and program sketches using the FDTI or the ICSP (I have to admit that I don't have a clear view of the function of these two...)?
Thanks a lot for your explanations and advices! :)
You could add 6 pads to pick up the ICSP pins and use that for program load (a bootloader would be unnecessary if you use this method and you would wipe out the bootstrap loader programming this way anyway). The pads don't have to match the ICSP 6 pin header if you use a pogo pin interface board to map the signals to your footprint.
Alternatives are:
1. Buy a 32 pin TQFP test socket, add the ICSP pins to that and program the bootloader prior to soldering the chip. You can do this in a fast batch process for your entire set of chips. Then, on your circuit board, have the familiar FTDI serial signals routed to pads that you can connect to via pogo pins. This is what I do on the project I cited above.
2. Talk Joe Lucid into providing his wireless bootloader, program that bootloader using the 32 pin TQFP test socket in #1, but then program the mote wirelessly from your 'thingy' gateway (search for 'thingy' will probably result in some context). This is what Joe does with his little round motes.
Tom
Thank you for your answer Tom.
I think I will go for alternative #1. In that case, what type of programmer do I need to connect to the test socket? (by the way, I found a test socket equipped with an 20MHz oscillator on the PCB - is that needed as most of them are without it?)
Then where can I find the bootloader sketch ?
Sorry if my questions are dumb... :-[
Quote from: darkcurrent on February 20, 2017, 03:59:14 PM
Thank you for your answer Tom.
I think I will go for alternative #1. In that case, what type of programmer do I need to connect to the test socket? (by the way, I found a test socket equipped with an 20MHz oscillator on the PCB - is that needed as most of them are without it?)
You don't need a crystal for loading in the test socket. The internal oscillator is good enough. You just need to wire in the 6 pins from your programmer. I use the Pocket AVR programmer from Sparkfun (https://www.sparkfun.com/products/9825). There are others, but this one works well enough for me. You probably should read and understand the 'hookup guide' that Sparkfun wrote for the programmer (even if you use a different one, their writeups are usually pretty informative).
Quote
Then where can I find the bootloader sketch ?
It's not a sketch. It's a HEX file that comes with your Moteino Board support package. You need the "Dual Optiboot" Bootloader. I'm not currently on a system with this installed, but if you search the lowpower lab site, you'll find references to 'burning' the bootloader.
Quote
Sorry if my questions are dumb... :-[
Newbie questions aren't dumb - they're just 'inexperienced' :D
Tom
Quote from: darkcurrent on February 20, 2017, 03:59:14 PM
Thank you for your answer Tom.
I think I will go for alternative #1. In that case, what type of programmer do I need to connect to the test socket?
Then where can I find the bootloader sketch ?
Sorry if my questions are dumb... :-[
I used pickit2 for hardware, to change bootloader along with avrdudess for software side of things, but you can use anything else also.
Bootloader is in DualOptiboot-master on github, inside there are two files you would need for new, changed bootloader... those are:
optiboot.c (here are commands),
pin_defs.h (settings of I/O pins). You will also need WinAvr (free), then you can compile and get .hex out, which will be your bootloader.
I will make simple tutorial for step by step.
If you need to set fuses, here is an article that explains things pretty well: http://www.embedds.com/all-you-need-to-know-about-avr-fuses/ (http://www.embedds.com/all-you-need-to-know-about-avr-fuses/)
Thank you all for your answers.
I have one last question: is there a need for a bootloader if you don't need to update the sketch later on (of course assuming that the sketch does not contain any error) ? So the steps would be: 1/ Upload the firmware into the ATMega using the test socket; 2/ solder the ATMega chip on the PCB.
Is all of this correct ?
I would honestly suggest going through the effort to put some test points that include the required ISP connections. You need VCC, GND, RST, SCK, MOSI, MISO.There are very thin pogo pins that you can mount on two matching boards if they will be through hole or if they are just SMD pads another matching PCB design that has through holes where the pads are. It will be a huge pain to use the socket on small QFNs.
The bootloader is firmware itself, just a little more special and lives at the "top" of the flash memory in an area that can be protected from overwriting via fuses.
But it's not required at all. Just set the fuses also before you burn your code.
EDIT: look at the way this person designed this watch, which includes the TQFP version of the atmega328p, there's a separate programming PCB/cable to help program the chips once units are assembled:
(https://cdn.hackaday.io/images/548521474057611006.jpg)
(https://cdn.hackaday.io/images/9574751473006213082.JPG)
Quote from: darkcurrent on February 22, 2017, 04:14:05 AM
Thank you all for your answers.
I have one last question: is there a need for a bootloader if you don't need to update the sketch later on (of course assuming that the sketch does not contain any error) ? So the steps would be: 1/ Upload the firmware into the ATMega using the test socket; 2/ solder the ATMega chip on the PCB.
Is all of this correct ?
Assuming that you are a perfect programmer, yes, that would work. ::)
Tom