Posts Tagged: ‘stm32f4’

STM32F4 Discovery / MP3 / Libmad / SDCard / USB-ouput / ChibiOS 2.6.1

11/08/2013 Posted by admin

Just an update for ChibiOS 2.6.1 of the code I have to run Libmad on the STM32F4 Discovery board.



Using STM32F4 as a logic analyser (SUMP/8channels/21Mhz) – (not 24Mhz)

12/20/2012 Posted by admin

or « Will my STM32F4-discovery board replace Arduino/Bus Pirate ? « …

Well I needed a logic analyzer to track some bugs in a project I am working on, but that could do more than the Bus Pirate OLS mode…

So I found this on the web : SUMP compatible logic analyzer code for Arduino.

But I also wanted a higher sampling rate.

- The code for the SUMP protocol was there from the Arduino project.
- I had the STM32F4 handy (the same I used for the MP3 – libmad port)
- The libopencm3 had a simple working example of a USB-CDC on the Discovery board

Go… Mixing everything in that code : here.
(you need libopencm3 in /opt/libopencm3)

Code update 28/04/2103 : Acquisition rate was in fact 21Mhz, there was a bug in function « cdcacm_data_rx_cb », the acquisition loop is now in an asm-inline code which should prevent different code optimization by different compiler versions. Those problems were submitted by Iosif in the comments, many thanks to him. Here is the new code.

After some tests + optimizations , here is the result : 2421Mhz sampling, 8 channels (port PE8-15).

(Lire la suite…)

MP3 Audio Decoder on STM32F4 Discovery (updated 30/10/2012) – ChibiOS 2.4.2

09/23/2012 Posted by admin

I like the work that was done by Marco W. (watz) on that forum.

Using the same hardware (SD Card connected to PA5/6/7 and PC4), ChibiOS 2.4.x and LibMAD (instead of Helix),
I finally have managed to get some output…

Most of the code comes from Marco W. ‘s work, I only tried to replace the stm32 audio discovery code by
functions provided by chibiOS (for I2C / I2S via SPI code and DMA).

Here is the code (you need to have ChibiOS sources too).

Update 23/09/2012 : Thanks to a comment by Deanrock, I have repackaged the source code with the I2C
modification & I have tested recompilation using a current Sourcery Code Bench (gcc version 4.6.3 – Sourcery CodeBench Lite 2012.03-56) and Chibios 2.4.2 (this version does not require any patching, just deflate fatfs from the ‘ext’ folder).

Here is the New code

Update 30/10/2012 : with my first tests, I had to enable the chibiOS debugs to get a stable behaviour. It looks like it is running just fine without, provided that -O2 is used (instead of -Os) and that CORTEX_USE_FPU is set to FALSE.

User button is used to skip to the next file.
This one was only tested with Chibios 2.4.2.

Here is the New code

MP3 Audio Decoder on STM32F4 Discovery (update)

03/15/2012 Posted by admin

I have made small updates to the code :

- Using -Os instead of -O3 gives much better performance (load is <20%)
- Used 'ssat' instruction for clipping output instead of the basic 'minimad.c' code example.

New code/Binary is here .

MP3 in : lg 879457
Decoding return 0
Timing Max. 518 19.82 %
Timing Min. 437 16.72 %
Timing Moy. 466 17.83 %

MP3 Audio Decoder on STM32F4 Discovery

03/07/2012 Posted by admin

The ST Firmware for STM32F4 Discovery includes a simple Audio demo that
demonstrates a Wave player (directory Project/Audio_playback_and_record).

From that project, I derived an Audio_playback_MP3 that plays an embedded MP3
stream (the same audio as in the ST example), but the audio is now around 55 seconds
instead of the original 5 seconds.

The MP3 decoder lib used is the libmad v. 0.15.1 .
(Lire la suite…)