Tuesday, January 28, 2014

Evaluating the STM32F4Discovery

I started the project by pondering on which micro controller might suit my needs. One of the friendly and helpful Helsinki Hacklab actives (greetings!) mentioned that the ARM based micro controllers are quite powerful and have plenty of I/O and output options. STM32F4Discovery board was mentioned during the conversation, so I decided to take a look at the board and evaluate what it's capable of doing.

After browsing the Mouser's catalogue I was pleasantly surprised how cheap the evaluation board was. For only about 12 euros it was a no brainer for a 168 MHz chip with 1MB of flash and 192KB of SRAM. The chip also has a floating point unit, SIMD instructions and a DMA. Nice! That's like 2-3 pints of beer here in Finland (depending on which bar you end up into). Sold!

I chose the CrossWorks for ARM as my development environment and browsed the internet for simple examples on how to get the basics on this microcontroller working. The basic I/O was fairly straightforward, but the PWM timers took several evenings of RTFM'ing the chip manufacturer's massive documents. Eventually I had one of the pins make a LED blink in the frequency of my choice.

The next thing I wanted to get working was the MIDI I/O. After several evenings of RTFM'ing I got the UART ports working properly. The damn system had been sending inverted signal (flipped polarity) which caused me more headaches than was humane considering the situation! Anyway, now the evaluation board was finally sending proper MIDI notes into my trusty MOTU Midi Express 128, which was connected to my computer running Logic Pro. The DAW recognised the incoming notes beautifully. The Discovery board could also receive MIDI data the Logic Pro was sending.

I experimented by programming a few simple procedural note patterns in C++ and listened to the Logic Pro playing the notes with Sylenth1. I felt the excitement I had last experienced as a kid.

The next stop was the 12bit ADC. After some more RTFM the ADC turned out to be one of the easiest peripherals to use on this micro controller. After awhile I got it to respond to the potentiometer I had attached to the input pin. Out of the 12bits there was a noise floor which ate up around 2-3 bits of precision. Oh well, software filtering would hopefully fix that. A quick browsing through the data sheets also revealed that this micro controller could scan different pins (or "channels") using the same ADC and convert the input signals one after the other and put them into a buffer using DMA. Well, this had to be my next stop then.

No comments:

Post a Comment