Category: Arduino
New ToyBrain Board Design
Version one of the ToyBrain boards had a bunch of problems:
- TX and RX were swapped on the serial line header
- The ICSP header was backwards
- There was no debug LED
- The SMD resistor pads for the reset pull-up resistor were too small
- The connection for the reset switch was a 0.1″ header rather than a proper footprint
- There was a lot of wasted space
Despite all of that, I managed to eventually get them working, with a slowed-down version of the Arduino bootloader, adapters for the ICSP and serial headers, and much messing about.
The new board is smaller, measuring about 1.5″ by 1.28″, and adds a proper reset switch, a SMD LED for debugging, corrected resistor footprints, and a (in my opinion) slicker layout. I still didn’t add voltage regulation or mounting holes, but I may be able to get a little space for the holes by moving a few traces in the corners of the board.
Pride Goeth…
My ToyBrain boards are programmable over ICSP, but when I connect them to an FTDI USB-to-serial cable, I can’t load a program into them from the Arduino development environment. The error I get back is that the programmer is not responding, which could be caused by several things, listed here by increasing order of how tedious they are to check:
- I might have some misconfiguration on the USB ports or Arduino IDE. I can eliminate this possibility by using the same FTDI cable to program a known-working Arduino BBB. If that works, I know that my problem is off the end of the FTDI cable, in my own hardware.
- I tried this, and got a working blinking light program on my BBB. This means my cable and computer are fine.
- I might have messed up the bootloader configuration for my board. I think this is somewhat likely, as I’m using the Arduino bootloader on a board that is running at 8MHz. If the Arduino bootloader or IDE requires the Arduino 16MHz crystal for proper timing, it is now running at half the normal clock speed, resulting in the serial timings being double what they should be. I can test this by telling the IDE to attempt to talk to the board at half of whatever the normal speed is, using the platform support in recent Arduino IDE releases. If it’s a timing issue, that should fix it.
- This was the problem. I reflashed with the 8Mhz bootloader from here, and now I can load programs and have them run.
- I might have screwed something up in the reset or power circuitry of the Arduino (I already know I got TX and RX backwards). I can check out the connections with a voltmeter pretty easily. I can also burn an LED blink program to the board with ICSP and see if it runs.
- The power and reset circuitry is fine. I burned a LED blinking test program to the board using the command avrdude -c usbtiny -p m8 -U flash:w:test.hex and got a square wave on port B, so the chip is running code and the fuses make at least enough sense that the onboard oscillator starts.
- I may have used bad fuse settings, and put it in some mode that doesn’t result in the bootloader starting. I can test this by burning my own LED blink program to the bootloader section and seeing if it blinks an LED. This won’t make it load code, but it will at least confirm that the bootloader is getting started.
- This is covered by the previous section. The chip isn’t bricked, and it runs code.
Victory is Mine
As I suspected in my previous post, I did put the ICSP header on my boards backwards (or more accurately, flipped along its long axis). As a result, I burned up the chip on one of the boards when I plugged the ICSP header in. I also took a closer look at the chip that I had populated two of the boards with, an ATMega48, and found that it doesn’t have a separate bootloader section. The quicker wits among you are realizing that I should have checked that before I soldered it down.
Since one board had a chip that had been operating as a resistive heater, and the other two had chips I didn’t want to use, I was left with one good board.This evening, I managed to burn the Arduino bootloader to that board.
First, I threw together an adapter to flip the ICSP header back to the right layout. Using that and my trusty USBTinyICSP, I programmed the fuses for the chip like so:
avrdude -c usbtiny -p m8 -P usb -B 32 -U lfuse:w:0xc4:m hfuse:w:0xca:m efuse:w:0xFF:m
and burned in the arduino bootloader like so:
avrdude -c usbtiny -p m8 -P usb -B 32 -U ./arduino-0022/hardware/arduino/bootloaders/atmega8/ATmegaBOOT.hex
For the curious, the fuse settings are the same as the ones for the Arduino, as documented here, but with the clock selection set to 8MHz internal clock rather than 16Mhz external clock. I used this fuse calculator to find the proper values.
Since that seemed to have worked, I removed the chips from the other three boards, replaced them with ATMega8s, and put bootloaders on them as well. Now I’m going to add IC sockets for the motor driver chips and see if I can get an LED blink program onto them.
ToyBrain Boards Arrived
The ToyBrain boards arrived. I have populated four of them with programming headers and microcontrollers. Two have ATMega8 chips, the other two have ATMega48 chips that I salvaged from some thermostats that I found.
I haven’t bothered fully populating the boards because I want to check that the ICSP headers are working by burning the Arduino bootloader to the chips, and that the serial headers are working by loading a program from the Arduino IDE.
Assuming that I haven’t miss-designed the circuit boards or baked the chips while soldering them, this will provide a smoke-test for the computer side of the boards. I still need to get a bunch of SN754410NE quad half-H-Bridge motor driver chips to handle the output side.
So far, I’ve come up with quite a few applications for the little boards:
- Re-animating gutted toys with new programming
- Controlling a single stepper motor with step/direction signals and limit switches
- Driving up to 4 channels of medium-current LED lights (RGB plus white?)
- Making loud noises by using the quad half H-bridges as push-pull speaker drivers
- Solenoid drivers and control hardware for chimes
I’m very eager to get a few of the boards out to beta testers and see what other people come up with.
Recent Comments