So, today I continued testing the forthcoming release of CrossWorks for AVR. Actually, I'm also testing CrossWorks for MSP430 at the same time. But for now, let's get back to the AVR.
Digital MEMS sensors are usually connected with I2C. Now, to bring up the Arduino version of the CrossWorks Platform API quickly, I wrote the code to do GPIO to all the header pins and then pressed the software SPI and I2C drivers into action to get the first-cut implementation going on an Arduino Uno and the Olimexino-328. However, that doesn't use the AVR's hardware resources to their best, so I started writing interrupt-driven I2C bus code. As a consequence of this, and because of the way that the AVR I2C engine works, I needed to rework the high-level code that sent I2C requests to the bus.
Now, one of the problems with an mid-level framework API redesign like this is that some clients need to change and all implementations needs to change. As it turns out, the I2C redesign has a positive benefit for all of the code, and it spurred me to carry the redesign over to the SPI mid-level API too.
So, with this new I2C driver, I can successfully interface all the I2C sensors that we support, including MPU-6050 and HMC5883L that are fused by the CrossWorks library's Attitude and Heading Reference System (AHRS). The AHRS code takes the measurements from accelerometer, gyroscopes, and magnetometers and updates an estimate of the orientation of the body frame as a quaternion. This is pretty cool stuff because I can fuse any of our supported sensors into an AHRS, but it just so happens that the MPU-6050 and HMC5883L are built into the CoreMPU board you can find here:
http://soldercore.com/products/sensecore/corempu/
Well, along the way I figured out a few things that I needed to do in CrossWorks, and I also figured out that I had left my debugging code in with a huge array, which caused me to run our of RAM when compiling the orientation demonstration. At the end of the day, the AHRS was delivering quaternions, but it wasn't updating. A quick look at the code revealed that I hadn't implemented a high-resolution tick to measure elapsed time between sensor readings, so the code that updates the orientation would go through a whole bunch of computation and, effectively, multiply feedback terms by zero which meant there was no feedback!
So, tomorrow I get to implement a 32-bit free-running timer that will be enough to time accurately for the AHRS. And then we'll see how the fixed-point and floating-point AHRS code performs on AVR!
A blog about working at Rowley Associates, developing CrossWorks, CoreBASIC, and SolderCore.
Wednesday, 16 January 2013
Tuesday, 15 January 2013
CrossWorks and SolderCore, the Platform API
For a long time now, I've been working on an API that will help customers, and particularly hobbyists, get up and running quickly with CrossWorks and SolderCore. The decision process on what to put into the API, and particularly what to leave out, was interesting.
At Rowley Associates we have a whole wall stacked with magazine files which contain each and every ARM board that we have acquired. Right now, the tally is over 600 ARM boards. Most of these are supported in CrossWorks by board support and CPU support packages which so customers can program those boards without needing to construct header files, write and then debug flash loaders, type in boring memory maps, and so on. Now, writing demonstration code for all these to have them do something more than flash a LED or respond to a button is a big challenge.
To reduce things to a manageable level, I looked around for something that I could develop for that would enable me to take a LEGO-style brick approach to constructing interesting, useful software. After a while, it was evident that the Arduino footprint was very popular, had an ever-expanding range of third-party shields. And, with that popularity, other CPU architectures were leveraging the Arduino form factor. So, I decided to construct software that would target an Arduino footprint, but on non-AVR architectures.
So, let's take a quick tour of the available Arduino-format boards that I have acquired and am developing for:
These is one other board that is having the Platform API ported to it, but we'll park that on one side for the moment.
As of today, I have a whole set of software that I can compile for SolderCore, the Freedom Board, the Olimexino-5510, and the Arduino Uno. No source changes. The sensor libraries work on each of these different architectures because the Platform API takes care of dealing with the tedious nature of getting hardware set up for GPIO, I2C, SPI, PWM, and ADC functions. On top of those libraries, I've written mid-level libraries for driving LCDs and getting graphics onto them, supporting mass storage with FAT file stores, and using TCP/IP over Ethernet. And sitting on top of that is a bunch of demonstrations that will exercise sensors and do interesting things using them.
So, the question is, I guess, when to release all this? Well, it takes a lot of testing, but then CoreBASIC and SolderCore is built upon the CrossWorks Platform API. I think that I will release them when CrossWorks 3 debuts, as I use some of the CrossWorks 3 library features to have the software work nicely.
What I can say is that it's pretty cool writing an application that uses the Platform API and then seeing that application run on completely different hardware "just like that." Sort of the way reusable software is meant to be.
What are the downsides? Well, of course, writing generic software means that many device-specific features simply get washed away and are just not supported by the Platform API. That's intentional: if you need those features, write a device-dependent module for it!
The other downside is that you're a bit further away from the hardware and performance may suffer because of the calling overhead. Well, that's tough, what you pay to get a clean API is a small performance penalty. It's worth it.
At Rowley Associates we have a whole wall stacked with magazine files which contain each and every ARM board that we have acquired. Right now, the tally is over 600 ARM boards. Most of these are supported in CrossWorks by board support and CPU support packages which so customers can program those boards without needing to construct header files, write and then debug flash loaders, type in boring memory maps, and so on. Now, writing demonstration code for all these to have them do something more than flash a LED or respond to a button is a big challenge.
To reduce things to a manageable level, I looked around for something that I could develop for that would enable me to take a LEGO-style brick approach to constructing interesting, useful software. After a while, it was evident that the Arduino footprint was very popular, had an ever-expanding range of third-party shields. And, with that popularity, other CPU architectures were leveraging the Arduino form factor. So, I decided to construct software that would target an Arduino footprint, but on non-AVR architectures.
So, let's take a quick tour of the available Arduino-format boards that I have acquired and am developing for:
- SolderCore, of course. Stellaris.
- Freedom Board. Kinetis.
- BugBlat Cortino. STM32F1.
- Olimexino-5510. MSP430F5510.
- Olimex STM32-E407. STM32F4.
- Maple. STM32F1.
- Netduino. SAM7X.
- Netduino Plus 2. STM32F4.
- freeSOC. PSoC5.
- Olimexino-328P. Yes, a clone, but pretty nice anyway.
- mbed, using a TestBed board. LPC1000.
- Arduino Due.
These is one other board that is having the Platform API ported to it, but we'll park that on one side for the moment.
As of today, I have a whole set of software that I can compile for SolderCore, the Freedom Board, the Olimexino-5510, and the Arduino Uno. No source changes. The sensor libraries work on each of these different architectures because the Platform API takes care of dealing with the tedious nature of getting hardware set up for GPIO, I2C, SPI, PWM, and ADC functions. On top of those libraries, I've written mid-level libraries for driving LCDs and getting graphics onto them, supporting mass storage with FAT file stores, and using TCP/IP over Ethernet. And sitting on top of that is a bunch of demonstrations that will exercise sensors and do interesting things using them.
So, the question is, I guess, when to release all this? Well, it takes a lot of testing, but then CoreBASIC and SolderCore is built upon the CrossWorks Platform API. I think that I will release them when CrossWorks 3 debuts, as I use some of the CrossWorks 3 library features to have the software work nicely.
What I can say is that it's pretty cool writing an application that uses the Platform API and then seeing that application run on completely different hardware "just like that." Sort of the way reusable software is meant to be.
What are the downsides? Well, of course, writing generic software means that many device-specific features simply get washed away and are just not supported by the Platform API. That's intentional: if you need those features, write a device-dependent module for it!
The other downside is that you're a bit further away from the hardware and performance may suffer because of the calling overhead. Well, that's tough, what you pay to get a clean API is a small performance penalty. It's worth it.
Sunday, 25 July 2010
SolderCore
Interest in SolderCore has proven pretty good. We have our first major interest in the platform, which is nice, after showing it at the Arduino DevCamp.
Tuesday, 13 July 2010
Arduino DevCamp
Attended the Arduino DevCamp at the weekend, on the hottest day of the year so far. Unfortunately, there was a lot of electronic equipment belting out extra heat and, being a weekend, no air conditioning!
Anyway, there was a sneak peek of our new collaboration with Hot Solder. Check this out...
Subscribe to:
Posts (Atom)