2010-09-05 06:29:05
Geekcon 2010:
- back to working order. keywords: SPI CS (Serial Peripheral Interface (Philip) Chip Select line).
- there are two chips on the SPI bus - the RF230 and whatever is attached to the Chibi Peripheral bus, here the ADXL345. They both have included library support, the peripheral in spi.h and the chibi RF230 in chb_spi.h (confusing, huh?). So SPI_ENB sets the CS for the ADXL345 to low (which enables it), while the CHB_SPI_ENB does the same for the RF230. Do not, I repeat Do Not, confuse between the two.
- the ADXL345 has a very nice data sheet, +-8g and 200Hz were easily achievable.
- But, and an important But:
- printing to usb (not sure what bus / utility of the MCU, the ATMEGA32U4, this is) makes things slower.
- and even though I used an interrupt for the ADXL reading (TIMER1), and the RF230 already uses some interrupt to poll / send the RF230 queued data (queuing being part of the support library of the chibi), still it didn't work for more then about 20Hz of sending.
- JBTJ (Juggling Balls Teaching Juggling) wise, it wasn't very good. I should have talked to the many jugglers (master jugglers even) that attended. I did measure a little more of the acceleration profile of actually throwing a ball. Yes, it shows 0g when in the air (not exactly zero of course). The accuracy is about 2.5%, maybe higher?. The max is about 4-6g for a throw. You can reach much more (saturate 8g easily) by just shaking the balls.
TOOD actually:
- put the send on RF on the ADXL interrupt. I mean, it just puts something on a buffer (that is, a copy), so should be quick enough, no?
- (can time it - should really time the whole code. profile it. can gprof work on avr code? where would it store/write the results? and gdb? can use gdb breakpoint commandlist as a poor/silly man's profiler)
- disable interrupts before doing SPI for the ADXL (I'll assume it's already done for the RF230 ISR, Interrupt Service Routine, so I can probably copy from there even).
Old:
A lot of problems with the USB.
- Version that doesn't work: ~/src/chibi/chibi_original/demo
- Version that does work: ~/src/chibi/root/Chibi/demo
minicom helper: create files in /etc/minicom/minirc.NAME as root and then use "minicom NAME" to run it as a normal user, where NAME is acm{0,1,2,3..}
Diff: TODO
TODO: document in short the usb programming of the chibi. How does it work (condense the appropriate section from the manual), how to debug.
Things that help occasionally:
- disconnecting / reconnecting all chibis (I use 2 simultaenously to debug from one computer).