Check out the new projects site for A-i-S

Monday, June 23, 2008

Oh the trickery.....

Ok this morning was more about setting up SAMBA and sharing printers than AVRs...

Anyway the challenge today is to conrtol a servo whilst using FreeRTOS on a AVR ATMega32. The trick here is that I usually the Procyon library to control Servos (easy to include, easy to address several servos etc etc). Unfortunately I can't include the timer.h from Procyon and the FreeRTOS headers. The issue seems to be a conflict over the timer interupt.

The Mega32 has two 8-bit timers and a single 16 bit timer. At the outset, I'm assuming tht FreeRTOS uses the 16-bit timer in the demo code I have modified.

I can see several possible ways forward...

1) Manually set up servo control without using interrupts

Probably a silly idea because then your cpu will spend most of its time counting numbers up rather than something useful

2) Alter FreeRTOS to use a different timer than referenced in timer.h

Looks to more trouble than it is worth considering the complexity of FreeRTOS. Best to avoid if possible.

3) Avoid clashing with FreeRTOS and its choice of timer. Choose a timer and interupt it does not use and use this timer instead

I think this is the first path I will attempt. Hopefully I will find an available 8-bit timer and create the code to drive the few servos that my bot requires.

4) Setup a servo control board and send UART signals to it.

If 3) above fails will take the next easiest road and build a small separate board to control the servos and control it via UART. This may have a negative impact on control and feedback though.

Sunday, June 22, 2008

Slow news day

Well since I got to the point of having FreeRTOS working I haven't felt the need to push ahead quickly on my carpet rover.

The next step is to write some from scratch code to control the servos. I can't use Procyon Library routines without have to modify the header of timer.h - interrupt #7 gets stomped by both timer.h and FreeRTOS's header files. Instead of creating potentially unstable situations, I'm just going to write my own servo code and leave FreeRTOS alone.

OT: I've been cleaning up "the lab" - got to the point were I can vacuum it even! Otherwise been engaged with seting up new WRT54GL Wifi router with WPA security and then configuring 2x eee pcs, brother's PC's wifi, and sister's Palm TX with wifi.

Being able to make custom Cat5e "in-house" proved a boon for setting up the Wifi router in a nice location.

I've been playing with the eee pc a lot - nice machine with a decent distro - once you set up a few more repos the think is easy to play with - picasa / ff3 etc etc. A certain owner of one of them is forming an addiction to Frozen Bubble!

Wednesday, June 18, 2008

AVR FreeRTOS troubles

I have been playing with FreeRTOS ( in an attempt to equip my carpet rover with the necessary intelligence to do two things at once.

I am developing my FreeRTOS solution on a AVR Mega32.

Last night I attempted to create two "tasks" to run in unison. Unfortunately despite my best efforts, after one iteration of each routine, one of the other routine would then be executed ad infinitum.

I am unsure why this happens. Tonight I will start debugging by executing two simple routines. I wonder if it has something to do with FreeRTOS "Queues". I have searched but been able to determine their exact purpose.

I'll be further looking at the AVR demo program to assist in debugging.

UPDATE #1: Ok it seems if both tasks are just outputing UART then they both work well together. Now lets see if I can incorporate the I2C (TWI) code for the IR distace measuring sensors.

UPDATE #2: Ok got it working without Queues. It actually seems that all I needed to do was a make clean and then a make all as well as comment out the #include for "timer.h" which wasn't used anyway.

Adventures in Silicon

So what is this blog about I hear you say? Will it haves photos of cute cats? Will it reproduce the latest shipment of fail that has hit my inbox? Will you be able to read about my travels in the Greek Isles?

..."No" to all of the above. I hope this blog will serve as a notebook of my hobby relating to robotics and microcontrollers. The primary focus will merely to be documenting for myself what I am doing, if anyone else cares to read it, so be it.

Oh and my apologies for anyone who came to "adventures in silicon" thinking it involved large breasted women and not the silicon wafers microcontrollers are made of!