AVC Proof-of-Concept (sorta) Post

The AVC Proof of Concept deadline is today. (Or maybe it was yesterday.) This is my lame attempt at desperately hoping to still qualify for the contest.

You see, the circuit boards that I ordered from Dirty Boards on the 3rd of May still haven't arrived. Without circuit boards in hand, I really don't have much to show for my AVC entry.

On the off chance that the AVC staff will take mercy on me and allow me to remain in the contestant pool, my robot consists of:

Yeah, without pics, I realize the credibility in this post is near zero. But that's all I have right now- words and ideas. I'm well aware that the chances of me being ready in time are pretty slim, but I'm hoping the decision on whether or not to drop out can be my decision and not the decision of the AVC staff.

So I'll send them a link to this post and see what they say...

AVC Boards Have Been Ordered!

Well, it's been a while since I posted anything. I've been very heads-down with various priorities and this is the first opportunity I've had to come up and take a breath. I've just shed a few obligations so I'm hoping I'll be able to post more frequently.

I haven't abandoned my AVC project! In fact, I spent several weeks tweaking the schematic and then several more tweaking the PCB design. The inescapable fact of all this is that I just plain suck at PCB design. Continue reading AVC Boards Have Been Ordered!

AVC Parts Ordered!

I submitted my order to Mouser today. While that's on its way here I'll lay out my circuit board. When the order gets here, I'll verify footprints and then send off my gerber files to have a custom PCB made.

The June contest date is approaching way too fast! I don't even have my hardware done yet, so I can't do a whole lot of software development. Argh!

The Woes of Debugging DMA on the STM32 Platform

I spent a good chunk of today getting frustrated with my AVC code. I have custom firmware on my GPS so that it sends a fixed-length binary sentence to my microcontroller. Rather than polling the USART, or handing an interrupt every time a character comes in, I figured this is a perfect application for the DMA controller... tell the DMA controller how many characters there are, and have it wake up my code when I receive a full GPS sentence.

Well, during debugging, I found that my DMA IRQ was being handled once, but I couldn't get it to trigger a second time. After wrestling with this for hours, I finally thought, what if the second DMA interrupt really is happening, but because I've got the CPU stopped at a breakpoint, I'm missing it?

So, I took out my breakpoint and instead threw a character out the USART every time the DMA IRA was called. And lo and behold, I got a DMA IRQ five times a second, which is just how often the GPS is sending me data.

Embedded programming can be so frustrating.

AVC Replacement Parts Finally Arrived!

Despite selecting 'air mail' at checkout, Hobby King apparently found the absolute slowest shipping method to get replacement parts for my R/C car to me.

Well, I finally got them and I replaced the front right "C" bracket and took the car for a test drive today. I've never owned a hobbyist-grade R/C car before so some things seemed a bit weird to me. First, the car would go much faster in reverse than it would going forward. I solved this by swapping 2 of the 3 leads to the brushless motor (thus reversing the motor's direction), and inverting the throttle signal on my transmitter. I'm not sure if that's the right solution or not, but it worked.

The other thing is that the car seems to have no problem going from reverse to forward, but it insists on pausing when going from forward to reverse. I have no idea if that's normal or not. At least the car works.

In any case, I now have a platform for my AVC robot. I'm still cleaning up code to interface with my GPS module, and I'm writing a separate subsystem to drive some LED indicators to tell me the internal state of the software. I don't know how useful that will be in the final product, but at the moment, it seems like it's going to be useful for debugging.

I'm almost finished with parts selection. I'm going to have a GPS receiver and at least one 9DOF IMU chip on my vehicle. I'm still debating whether or not to include odometry sensors, IR distance sensors, and/or ultrasonic ranging sensors.

I've started designing the schematic for my controller board in Eagle.

USART woes on the STM32F4DISCOVERY board

Now that I have the ability to use a FAT filesystem on an SD card (post to come shortly), my next task was to write some code to allow me to send debug spew to a serial port. My plan is to use an Adafruit Bluefruit EZ-Link bluetooth link to send debug data to my laptop computer while debugging my AVC code. So yesterday I sat down to bang out the code. I mean, how hard can it be, right? Configure a USART with the proper baud rate, parity, data and stop bits, and pump data into the TX register. Piece of cake, right?

In about a half hour I had some code built and running. But I was getting garbage on my laptop over the FT232 cable I was testing with. I figured maybe I'd miscalculated the baud rate, or the clock speed, or something, so I tried doubling the bitrate on the microcontroller. Same problem, so I tried halving the original bitrate. No good.

I whipped out my Saleae Logic logic analyzer and took a gander at what was happening on the wire. The data simply made no sense. The width of each bit was not only not what I calculated it should be, but successive bit times weren't even an integer multiple of each other! The bit time was all over the map.. some short, some long, and very, very few were what they were supposed to be. Continue reading USART woes on the STM32F4DISCOVERY board

FAT and SDIO on the STM32F4: Early Experiments

I've been trying to marry the FatFS filesystem driver with a modified version of ST's SDIO sample code in order to read/write a FAT filesystem on an SD card for logging on my AVC robot.

It's been a frustrating few days. I've had intermittent results and I'm not sure why. I think there's some uncertainty with the DMA completion interrupts in my current lash-up. Moving from ST's library to Lukasz Iwaszkiewicz's software helped. I don't know the differences between the two codebases. Clocking the SD card at 25MHz (I think that's the clock speed in use) at the end of 12" jumper wires surely isn't helping anything. I also think that stopping the debugger and relaunching my code without powering off the SD card may leave its internal state machine confused. All of this is just conjecture, though, based largely on my wholescale ignorance of how the SD interface and the code I'm using actually work.

Currently, I'm able to read a file from the SD card but I'm having problems writing a file. (I started my attempt at writing this morning and only had 45 minutes to work on it before I had to leave for work.)

First experiments with the STM32F4DISCOVERY and an SD card.
First experiments with the STM32F4DISCOVERY and an SD card.

I'm designing a circuit board for my robot's brain that will solve the long wire problem when it's built, but I'm still a ways out from sending that off to be fabbed.

The Saleae logic analyzer that's barely visible in the picture has been worth its purchase price many times over. Many thanks to Supermodel Wife who bought it as a Christmas present for me despite knowing absolutely nothing about what it was!

AVC Parts from Hobbyking and Adafruit Arrived

AVC Parts have Arrived!

I got a box from Adafruit and a box from Hobbyking over the past couple of days, which should be all the parts I need to start developing my autonomous vehicle.

First the Hobbyking stuff. Despite several horror stories that I've read, the box that I received was a sturdy box in undamaged condition. I opened the box to find the contents were equally well packed and contents were all in good shape. Continue reading AVC Parts from Hobbyking and Adafruit Arrived

AVC Parts Have Been Ordered, the Workshop Has a (Small) Workbench and Internet Access

While I continue to work on the workshop (progress is being made and an update will be posted soon), I went ahead and ordered parts for my 2014 Sparkfun AVC entry.

My robot is going to be built on a 1/16 Turnigy R/C car from Hobbyking.This platform has received a decent set of reviews from the R/C community and is hopefully going to be large enough to do what I need it to do. Continue reading AVC Parts Have Been Ordered, the Workshop Has a (Small) Workbench and Internet Access

Sparkfun AVC Thoughts

Sparkfun has recently announced that the 2014 Autonomous Vehicle Contest (AVC) will be held on June 21, 2014.

The AVC, as its name implies, is a contest where contestants build vehicles that must navigate a course autonomously. That is, no input or guidance from a driver or pilot. I've been following the AVC for a couple of years now and have thought about entering before. This year I think I just might do it. The STM32F4DISCOVERY board appears to be a perfect platform to build upon for the contest. That board, a few sensors and a whole lot of code sounds like just the ticket.

There are two categories of competition: ground and air. I'm not yet ready to build a self-piloting drone. But a self-driving model car is probably a good stretch goal for me to build on my embedded skills. I've already starting writing a code library to write debug output to a serial port. I'm planning on picking up a BlueFruit bluetooth link from Adafruit to stream the debug spew back to my laptop. The F4 also features an embedded USB host port, so I'll write debugging info to a file on a USB thumb drive as well. With a high clock speed (180MHz), lots of Flash ROM (1MB) and RAM (192K), and plenty of I/O, it should be a generous platform on which to build.

I guess I should revisit my series on setting up a FOSS cross compiler toolchain and figure out how to configure it for the STM32F4 series.