Thursday, March 6, 2014

Freescale FRDM-KL46Z Board


I've been playing with a $15 Freescale Freedom board based on the Kinetis MKL46Z256 [pdf]. It has a built in magnetometer and accelerometer and possibly the cutest little 4-digit, 7-segment LCD I've ever laid eyes on. This is quite a capable board.

It's a 48MHz Cortex M0+ with 256K flash memory, 32K RAM. That's enough power to do some serious computation. Perhaps a Kalman Filter-equipped Segway type robot? Or AVC rover?

On top of that, typical of other Freescale chips, a fast ADC running >400kSPS at 16bit or >800kSPS at lower resolution. With DMA available.


With Arduino form-factor headers plus another row of headers in addition to those, the board provides easy access to a lot of MCU pins, 64 to be exact.

You also get a light sensor, capacitive touch slider, a couple of tactile switches, and USB host / device capabilities.

The board is supported by mbed for easy programming and prototyping. And to dispel the myths: the mbed SDK is open source and you can offline compile it for several supported ARM toolchains.

Debug, in the form of CMSIS-DAP, is available, too. A 20mm battery holder footprint is provided on the board.

Getting Started


If you plug your USB cable into the OpenSDA USB connector (use your Quick Reference Card to locate it), then your system will mount a Mass Storage Device.

On the drive are several HTML files. SDA_INFO.HTM takes you over to a P&E Microcomputer registration site where you can register your hardware. TOOLS.HTM redirects your browser to a page listing P&E debugger tools. For some reason the FSL_WEB.HTM leads to 404 error on the Freescale website. It should point to this page.

Next, head over to the mbed.org site, register or login, navigate to the Freedom KL46Z platform page and on the right side, click the "Add to Compiler" button.

Compiling Demos

On this same page you'll find a series of examples for the board. You can also search mbed.org for more. I selected an accelerometer demo from Freescale. Import it into the IDE, select your platform with the button at the upper right. Click compile and then move the bin file that is downloaded onto the Freedom's mass storage device.

The demo prints accelerometer values for X, Y and Z axes to the USB serial port. On Linux this device appears as /dev/ttyACM*. Fire up minicom and you get output...

X: 1.00, Y: 0.96, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00
X: 1.00, Y: 0.97, Z: 0.00
X: 1.00, Y: 0.97, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00
X: 0.99, Y: 0.97, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00

On Windows you'd need to download a driver

Next I tried a touch slider demo which controls the PWM signal sent to the board's green LED. The code is really simple. Here's main:

int main(void) {
    PwmOut led(LED_GREEN);
    TSIAnalogSlider tsi(ELEC0, ELEC1, 40);
    
    while (true) {
        led = 1.0 - tsi.readPercentage();
        wait(0.1);
    }
}

Conclusion

I think this board is a decent deal at $15, the main selling point being mbed compatibility. My view is that boards are only worth as much as their toolchains and community support. And you can get other Freedom boards in the same form factor as well including other M0+ boards and an M4, the FRDM-K20D50M which boasts a 50MHz M4 with DSP capability.

While I touched on the highlights of this board, there's a lot more to explore. I'm looking forward to writing come code for it and using it in an upcoming project. SHARC will be hosting a Firefighting competition in the next few months and Pokey could use a major refit. However, come to think of it, I'm up to my ears in projects. Instead, perhaps I'll use it for one of those projects, such as my Take Out The Trash Bot. Whatever I do, I'll be sure to post about it here.


No comments:

Post a Comment