Jon's Place

Wednesday, February 28, 2007

More AVR

So, over the past week, I've been working in my spare time getting my ATmega168 board to do something more useful than blink an LED. I built a prototype board for the IMU, which holds the 5-axis IMU board, the one-axis gyro, and a couple switching voltage regulators. It also has a couple Bioloid bus connectors, although they are only used to provide power to the board.

I've got the first pass of the Biooid bus sensor code almost done. I can hook the ATmega168 to the bus, send it a packet, and it parses the packet, recognizes what kind of command it is (PING, READ_DATA, WRITE_DATA), and does the appropriate thing, complete with writing response packets back. I'm reading data from all six channels of the IMU, and updating the control table values where they are kept. The only real issue right now is that the UART code I am using is assuming a standard two-wire UART, so the Tx pin isn't hooked to the bus. My brother Dave, who has helped me enormously getting all this going, and provided all the support code to access the various hardware features of the AVR, is going to adapt the work he did on the ATmega128 application so the UART on the ATmega168 will work the same way.

As you can see, I've made a couple changes to the ATmega168 prototype board. I added a second bus plug, and changed the other serial port to use my "normal" DS-275 based serial adapter. This is hooked up to a normal digital I/O pin, and my brother wrote a nice little module that bit-bangs the transmit half of a serial connection user a hardware timer. This gives me the ability to log what's going on inside the chip through a back-channel, which is a huge help when I'm trying to figure out what is going on.

All of this work on the IMU module will apply almost 100% to the foot pressure module as well, so I'm really killing two birds with one stone here, in terms of the software. The code I'm writing (which I will release once it is done and fully working) will allow any kind of sensor to be hooked up to the Bioloid bus, assuming the ATmega168 can talk to it.

The control table for the IMU sensor will look like this:

EEPROM
0 Model Number (L)
1 Model Number (H)
2 Version of Firmware
3 ID
4 Baud Rate
5 Return Delay Time
6-15 Reserved
16 Status Return Level
17-23 Reserved

RAM
24 Reserved
25 LED
26 Forwards acceleration low
27 Forwards acceleration high
28 Sideways acceleration low
29 Sideways acceleration high
30 Vertical acceleration low
31 Vertical acceleration high
32 Pitch rate low
33 Pitch rate high
34 Roll rate low
35 Roll rate high
36 Yaw rate low
37 Yaw rate high

I may add another value, which allows you to specify one of a couple orientations that the sensor is mounted in. This will just affect which A/D port goes into which of the above control table registers.

*The BrainBot project is directed and funded by the Brain Engineering Lab and Neukom Institute

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home