[Eberhard] needed to flash several hundred ATMegas for a project he was working on. This was a problem, but the task did have a few things going for it that made automation easy. The boards the ‘Megas were soldered to weren’t depanelized yet, and he had a neat and weird bed of nails programming connector. There was also a CNC machine close by. This sounds like the ideal situation for automation, and it turns out the setup was pretty easy.
The boards in question were for FPV/radio control telemetry adapter and thankfully the assembly house didn’t depanelize the 40 PCBs on each board before shipping them out. A very cool ATMega flashing tool handled the electrical connections between the computer and the microcontroller, but a real, live human being was still required to move this flashing tool from one chip to the next, upload the firmware, and repeat the process all over again.
The solution came by putting a few metal pins in the bed of a CNC mill, 3D print an adapter for the flashing tool, and writing a little code to move the flashing tool from one chip to the next. An extremely simple app takes care of moving the programmer to an unflashed chip, uploading the firmware, and continuing on to the next chip.
There’s still some work to be done that would basically tie together the Gcode and AVRdude commands into a single interface, but even now a complete panel of 40 PCBs can be programmed in a little over 10 minutes. You can check out a video of that below.
Continue reading “Flashing Chips With A CNC”
[Doug Jackson] makes word clocks, and he must be doing quite a bit of business. We say that because he put together a programming and test bed for the clock circuit boards.
This is a great example to follow if you’re doing any kind of volume assembly. The jig lets the populated PCB snap into place, making all the necessary electrical connections. This was made possible by a package of goods he picked up on eBay which included rubber spacers to separate the board from the acrylic mounting plate, pogo pins to make the electrical connections, and a spring-loaded board clamp seen to the left in this image.
The switch in the lower right connects power to the board and pulls a Raspberry Pi GPIO pin high. The Python script running on the RPi polls that pin, executing a bash script which programs the ATmega169 microcontroller using the GPIO version of AVRdude. We looked through his Python script and didn’t see code for testing the boards. But the image above shows a “Passed” message on the screen that isn’t in his script. We would wager he has another version that takes the hardware through a self test routine.
We first saw one of [Doug’s] word clocks back in 2009 and then again a few months later. The look of the clock is fantastic and it’s nice to see the project is still going strong.
The advent of the Arduino brought the world of microcontrollers to hobbyists, students, and artist the world over. Right now we’re in the midst of a new expansion in hobbyist electronics with the Raspberry Pi, but we can’t expect everyone to stay in the comfortable, complex, and power-hungry world of Linux forever, can we? Eventually all those tinkerers will want to program a microcontroller, and if they already have a Raspberry Pi, why not use that?
[Kevin] wanted to turn his Raspi into an AVR development workstation, without using any external programmers. He decided to use the Raspi’s SPI port to talk to an AVR microcontroller and was able to make the electrical connections with just a few bits of wire an a handful of resistors.
For the software, [Kevin] added support for SPI to avrdude, available on his git. Theoretically, this should work with any AVR microcontroller with the most popular ATMegas and ATtinys we’ve come to love. It doesn’t support the very weird chips that use TPI programming, but it’s still extremely useful.
[Hans Peter] wanted to move away from using full Arduino boards in his projects. One of the components he rarely used after the development stage is the USB hardware. Once the firmware is flashed to the chip he didn’t need it any longer. So he tried his hand with some really small SMD parts by building this USB to serial Arduino programmer.
The chip he went with isn’t the FTDI part we’re used to. Instead of using an FT232RL, he opted for its smaller cousin the FT230x. This chip doesn’t fully implement the communications protocol of the 232, but it does work with AVRdude and that’s all that really matters. Above you can see [Hans’] creation next to the official Arduino USB-to-serial programmer. He used the same connection scheme, but went with an edge connector for the USB instead of using a mini-B jack.
It’s pretty impressive to see his prototyping work with the 16-pin QFN package. He soldered it dead-bug style to a couple of SIL pin headers in order to test it on a breadboard. The first board he assembled was too loose in the USB port, but he added some tape to the back to make it thicker, and coated the edge connector traces with a bit of solder and that did the trick.
[Steve] created an AVR programmer using an old USB keyboard. We feature a bunch of AVR programmers, but this one is made from parts that many people will have lying around. There are two components: the controller PCB from a USB keyboard, and an optocoupler for emulating key presses.
In order to send data to the AVR, [Steve] used the LED outputs on the keyboard. These LEDs can easily be toggled according to the HID device specification. They provide a 5 volt output with current limiting resistors, which means they can be connected directly to the target AVR.
Reading data is a bit more complex. The optocoupler tricks the keyboard into believing that a single key has been pressed, firing off a data transfer. The MISO pin on the AVR is connected to the row and column of the shift key, which is read by the driver.
On the software side [Steve] created an avrdude interface driver. This allows the programmer to be used with avrdude, just like any other programmer. [Steve] does point out that it isn’t the fastest programmer since the keyboard tries to debounce the MISO input, greatly limiting the speed. However, since it’s made from stuff you might have in your junk bin, it’s a neat hack.
Every AVR microcontroller, from the ATtiny in your thermostat to the ATMega in your Arduino, stores its configuration in a series of fuse bits. These fuse bits control settings such as the multiplier of the internal oscillator (and thus the speed of the chip), or if the reset pin can be used as a GPIO pin. [YS] just put up an awesome tutorial for understanding these fuse/lock bits, and it’s just the reference guide you’ll need when you find your AVR is running 8 times slower than you would like.
As an example, [YS] uses the ATMega48 default settings. From the factory, the ‘Mega48 ships with it’s fuse bits set to use an 8MHz internal RC oscillator with the CKDIV8 bit set. This results in the chip operating at 1MHz, a bit slow for [YS]’ liking.
By looking at the datasheet for the ATMega48, [YS] found the CKDIV8 fuse was the 7th bit in the low fuse byte. From the factory, the default value for this byte is 0b01100010. To remove the ‘divide clock by 8’ bit, [YS] needed to change the low byte to 0b11100010, or 0xE2. This is done via AVRdude by appending lfuse:w:0xE2:m to the commands entered when programming.
Fuse bits don’t need to be scary. As long as you can convert between binary and hex, can remember there are 7 bits in a byte (remember to start counting from 0), and have access to an easy to use fuse calculator, it’s possible to change all the settings on any AVR you have on hand.
[Minifloat] is using his TI Launchpad development board as an In-System Programmer for AVR chips (translated). There are a ton of homebrew AVR programmers out there, and using an Arduino for ISP is quite popular. But recently we searched for a way to use the Launchpad as a programmer and didn’t find one. We’d venture to say this is the first.
There is one hardware modification that must be made. An external clock crystal (32.768 kHz) must be populated on the board. But since it was designed with the feature in mind that’s a pretty quick process. [Minifloat] followed Atmel’s ISP app note, and extended some of the code written for a different programmer to get things up and running. At first the device wouldn’t communicate with AVRdude, but that turns out to be a problem with the initialization conversation. AVRdude polls the connected programmer to see if it supports block mode, and the firmware on the MSP430G2211 wasn’t expecting this query. The problem was fixed and it now works.
It sounds like there are a couple of bugs left in the system. The first time AVRdude accesses the programmer after it has been plugged into the USB port it will fail. Subsequent attempts will succeed until the MSP430 chip is reset, or the USB connection is replugged. But if you’re just getting into the AVR line, this will let you figure out if you want to invest in a proper programmer.