Saturday, November 10, 2012

NiVek GO! QC1 – Part 6, New MCU

Since my last update about 1 1/2 month ago work client work has been extremely busy, I’ve spent a good chunk of time getting a high-end Windows 8 application ready to submit to the marketplace.  Oh and I spent a week out in Redmond at Build 2012.  Needless to say my “hobby” of building a quad copter suffered from lack of attention.

Since my last update, I did however undertake a major shift in technology.  I went from using three STM8S 8 bit micro controllers to one STM32F0 32 bit micro controller.  In a nut shell my software was working great about 99.999% of the time, however for this type of application, it really needs to be 100%.  Even a failure 1 out of every 100,000 times could be very dangerous with the sharp propellers and uncontrolled flight.  100,000 seems like a pretty high number but considering my flight control loop operates at 200 times a second, it does happen.  I think the problem is that my inter-processor communications was just to chatty, I had considerable amount of code firing and handling messages between the micro-controllers and the .NETMF host.  The communications state machines handling these messages ended up being fairly complex and very timing critical.  To achieve a 200Hz update rate, we needed to have very fast SPI communications.  To achieve very fast SPI communications the interrupt handlers needed to be very efficient.  At one point I was troubleshooting using my data analyzer and measuring the microseconds required to process the data, there just wasn’t much breathing room between bytes.

So enter new hardware and an STM32FO.  My initial prototype board also has an STM32F4 on it.  The idea is to implement the GO! Bus protocol V1.5 and have a fully functional GO! module that is self contained and performs all the functions required to maintain stable flight on the quad copter.  Then periodically send state information such as position, time, pitch, roll, heading back to the GO! main board to allow for creating command and control functionality in C# and NetMF.  This was the primary goal, but in the original three STM8S architecture, the GO! main board primarily acted as a message forwarder.

Here’s my new stand alone Hardware, the STM32F4 running NETMF is in the upper left and the STM32F0 is in the bottom right.


So far I have about 80% of the 8 Bit C code for the STM8S’s ported to the STM32F0.  I’m finding that unlike using the three STM8S, most of my code is actually being used to control flight, not handle communications.  It was easier than I had expected and as much as I really don’t like using Eclipse, it’s far better than the ST Visual Developer that I had been using on the STM8.  I found this great article on getting going with 32 bit development for STM using eclipse.


1 comment:

  1. Hello Kevin,

    Nice work!

    How was the stabilization software before you made that shift? Where you able to implement a nice PID control on manage code?

    I don't know if I miss something, but in last video you were having noisy problems trying to stabilize a single axis...

    Thank you for sharing this great project!