Search This Blog

Wednesday, 18 June 2008

Back on the case...

After a nice long hiatus I'm back on the case with the Robot development :) Actually I started back a few weeks ago, but only now have found the time to update the blog :S

The Virtual Cogs guys have done a superb job creating a Linux kernel image for the VCMX212. So far I've been reluctant to delve into Linux remote source level debugging. Although it is looking increasingly likely that I should switch over to it soon. As such I've been happily delving into creating apps using the uMon API. But it has it's shortfalls;

A few weeks back someone asked on the Virtual Cogs Google group about accessing the miniSD card on the VC21BR1 board not from Linux. Something I had been looking at last year. If you boot into Linux on the VCMX212, the kernel mounts and supports the SD card. But no other support is available outside Linux, sounds like a challenge :) This was something that I wanted to get implemented myself. So I took up the mantle..

At first it looked like a daunting proposition to implement the driver. As usual I google'd as far as I could to work out what others had done before. Most of the searching pointed at setting up an SPI based SD/MMC card driver. Which was confusing at first, considering the i.MX21 processor on the VCMX212 has built in SD Host Controller circuity.

Obtaining the required documentation was quite easy. Here's some links to the pertinant docs;
http://www.sdcard.org/about/memory_card/pls/Simplified_Physical_Layer_Spec.pdf
http://www.cs.ucr.edu/~amitra/sdcard/ProdManualSDCardv1.9.pdf
http://www.freescale.com/files/32bit/doc/ref_manual/MC9328MX21RM.pdf
http://www.freescale.com/files/32bit/doc/app_note/AN2906.pdf
http://www.freescale.com/files/32bit/doc/app_note/AN3049.pdf


Using the i.MX21 SDHC on-chip module ended up being quite straight forward. Quite quickly I was sending SD commands to the card and getting responses back. Late on a Friday night during that first week of development the card sent back it's CID and CSD structures. I.e. it said 'Hello, my name is ...' :) After that was cracked, the rest progressed nicely. Slowly due to busy life etc. but certainly shaping up.

After a few weeks of the odd evening and weekend work I finally managed to get the code into a usable state. Posting my results onto the Virtual Cogs Google group;

So here's where I have got to so far;

Card Initialization;
This has been working great with Sandisk 16MB and Sandisk 1GB microSD cards. Support has been added to detect MMC, SD, SDHC, and SDIO. Only the SD path has been tested. I don't have access to a SDHC or SDIO card, so that needs further testing. Plus I don't think MMC cards fit into the VC21BR1 microSD slot, so don't envisage further work on the MMC path. I'm hoping that at least the SDHC path is correct.

Read/Write;
Single block read/write (no interrupts or DMA) has been tested in isolation. Writing 128 single blocks of test patterns works, and they can be read back correctly. Support has been added to loop across multiple blocks, but that hasn't been tested. SDHC card (and 4 bit bus) support has been added but not tested.

uMon FATFS/DOSFS;
Using the latest version of uMon (v1.15), cf functions have been added that hook into the SD init, read, and write functions. CF can initialize the SD card and provided the function hooks to DOSFS. FATFS can then be used to ls, cat, and get a file from the SD card into TFS. I came across problems using rm, qry, and put FATFS commands. put command seemed to work, but Windows (XP and Vista) complained that the file was corrupt :S So I tried a different route to test the SD init, read, and write functions...

EFSL (Embedded Filesystems Library);
I grabbed the latest stable CVS version of EFSL (v0.2.9), and updated it with Martin Thomas's upgrades (see link below). Then dropped in support for VCMX212. A simple uMon API based test program using this EFSL library, can read a text file from the SD card, and write out a copy of the file contents to a new file on the SD card. Windows can read this new text file back from the SD card :)

EFSL - http://efsl.be/
Martin's changes - http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/efsl_arm/index.html

Sunday, 9 December 2007

Stage One Build Complete..

When I started out on this venture, the different products I had looked at and ordered, collectively formed an image of what the final robot would look like. I'm really pleased to have gotten this far, and have achieved what I had originally set out to build.

For your pleasure, below are photos of the initial Stage One prototype build.

There have been a number of changes from previous photos.
1) Four wheel drive, almost ;) - As an experiment I added a second dual axis gearbox and motors. Piggy-backing the driving of these motors from the single Pololu motor controller. I also tried this with just the gearboxes and no motors. It works suprisingly well in a straight line, but cannot turn to save it's life. With the weight of the Robot and low torque of the motors it just couldn't get enough drive to turn. Lots of stalling (on smooth and rough surfaces) meant the thermal cut-off in the motor controller to kick in.
2) VC21RB1 - I've added into the VC21 COG stack the Robot Controller (VC21RB1). And mounted the stack on another Pololu round robot chassis base. Space was getting really limited on previous versions, but I now have a mid-deck to mount anything (particularly power supplies).

This initial prototype build has taught me loads. And as predicted the tiny Pololu motor controller and Tamiya gearboxes and motors are really straining under the weight. I'm not throwing away the motors and gearboxes just yet though. I'm waiting on Virtual Cogs to release some example code for the VC21RB1 controller, and am ready to hook that up and test it out. Then in the new year it's onto the second prototype stage of changing the chassis to a track based system (probably the Robotics Connection Level 1 Traxster Robot Kit).

As far of what is working. All parts are working seperately. The CMUCam3 is connected and working with the Pololu motor controller (controlled via a laptop). The VC21 stack is working fine, but not tried connecting this up to the CMUCam3 yet. I need to get underway with VC21 COG development (particularly the I2C, UART, and LCD driver software) before going further with hooking up that final sub-system of this robot.