A few months ago, Element14 sent me an XTRINSIC-SENSORS-EVKXTRINSIC-SENSORS-EVK kit to play with. This is an MBED compatible evaluation board which includes an ARM processor, some new freescale sensors (MMA8491Q Accelerometer, MAG3110 Magnetometer and a MPL3115A2 pressure sensor), a capacitive touch panel, and an RGB LED. It is available from farnell for the bargain price of £19 including vat.
I plugged it into my main PC running Debian, but the MBED drive wouldn't show up so I couldn't use it. I then tried it in my old macbook pro and had the same issue. Then I decided to give up, and put it in a drawer somewhere. I dug it out this evening to finally figure out what I was doing wrong, and have another go at getting it working.
After a bit of searching around, I couldn't find much information on the Sensors EVK itself, so I broke it down into its constituent parts, an XTRINSIC-SENSORS board that holds the sensors, and the Freescale FRDM-KL25Z microcontroller board, and googled the microcontroller board itself.
Victory!
After a bit of googling, I found this page, which has a section about how MBED have a new firmware out for the FRDM-KL25Z!
Its a pretty easy process to upgrade the bootloader, though you will have to hold your nose and borrow your grandma's windows computer to perform it!
- Press and hold the button in between the two USB ports with both the USB ports unplugged
- Plug a Mini USB cable into the USB port labelled SDA (its the one next to the little 10 pin connector
- You should get a USB drive show up called BOOTLOADER. For some reason this wont enumerate properly using Linux or Mac, which is why you have to use windows for this step
- Let go of the USB port
- Download the new bootloader file from http://mbed.org/media/uploads/sam_grove/20140530_k20dx128_kl25z_if_opensda.s19
- Put the file onto the USB drive
- Once it has finished copying, unplug it and plug it into your real computer
- Hurrah, you now have a drive called MBED!
Your first program
Click the mbed.htm link on the MBED drive. this will forward you on to the MBED online compiler (its pretty swish). If you dont already have an account, you can register now. If you do, just log in and the EVK will be linked to your account.
I modified the default 'Hello World' blink sketch to add a bit of test serial output to make accessing the sensors later on a bit easier:
#include "mbed.h" DigitalOut myled(LED1); Serial pc(USBTX, USBRX); // Loop forever, flashing the red LED on for 2 seconds, off for 2 seconds // send the string "Test" once per loop int main() { while(1) { pc.printf("Test\r\n"); myled = 1; wait(2); myled = 0; wait(2); } }
On pretty much every MBED board with an onboard USB to serial adaptor, the pins USBTX and USBRX are configured to point to the serial port attached to it, which makes setting up serial very easy. Paste the above code into mbed's code editor, save it somewhere, and press compile. Assuming everything is configured right, you'll get a .bin file downloaded. Drag this .bin file onto your MBED, then unplug and replug it if it doesnt reset itself.
Your board should reset, and the LED onboard will start flashing Blue and Pink. I'm pretty sure the blue LED is on on purpose to show the sensor board is plugged in (as it only turns on when the sensor board is plugged in), but i'll check into that further later!
Now just open up your favourite serial terminal at 9600 baud and get your delicious text!
#> minicom -D /dev/ttyACM0 -b 9600 Port /dev/ttyACM0, 21:42:16 Press CTRL-A Z for help on special keys Test Test