Wednesday 3 August 2011

Update

So it's been a pretty long time since I updated this blog, and while this one doesn't really provide any cool new pictures, I anticipate posting some within the next week or so.

The two main things that have been occupying my time are:
  • Converting the FFT algorithm from floating-point to fixed-point arithmetic. 
My PC and laptop have no trouble performing floating-point calculations with their FPUs, but doing them on an embedded microprocessor without one is just a touch too slow. When I initially wrote the fixed-point version, I basically decided to rewrite the entire program from scratch, all in one hit. Big mistake. I ended up with simple, decently written code that did not work as I had intended. I decided, after a lot of faffing about, to cut my losses and start the conversion again, but taking it slowly and checking the results step by step. I converted the code for generating the sample reordering array and twiddle factors to pre-generated look-up tables to cut calculation time.
One thing I've noticed is that the sample bit width appears to generate noise in the FFT output if it is too large, but this only affects the fixed-point code. I believe it may be causing overflows with the complex arithmetic functions, but I'm not 100% on this. Solutions involve possible scaling and/or leaving the ADC samples unscaled (12-bit instead of 16-bit data).

  • Playing around with the STM32 hardware.
I had never coded for an ARM based 32-bit processor, so it's been a bit off a learning experience. I had no idea of the little extra hardware modules that you seem to get as default on a 32-bit microcontroller. I don't think I'd bothered to read a list, but some things I really wasn't expecting to find include an internal thermometer and real-time clock. Many parts to play around with.
I've written up libraries for the USART for serial communication and debugging, ADC for sampling an audio signal, and DMA for automatically storing the ADC's results in memory. I also wrote some software to get basic communications going with an old Sure Electronics 64x32 bit RG LED array I had sitting in my cupboard. I'll use this for the spectrum output.

More to come.