cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32F4 Discivery issue to play on boards DAC

jmf1
Senior
Posted on July 12, 2016 at 15:17

Hello,

I'm new to Stm32 programming, but I try hard. I'm at the bottom of the earning curve and I block since 2 days on the an issue issue. Help would be very much welcomed. I attach my project:

https://dl.dropboxusercontent.com/u/29484066/Templates.zip

This is an openStm32 project. I did not included the driver and HAL files from Stm32cubeF4

It is intended to run on a Stm32F4 Discovery . It is a attempt to mix the application proposed with

http://www.st.com/content/st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-translate-hw/x-nucleo-cca01m1.html

and the one from Stm32cubeF4  example Audio_playback_and_record (for that board)., in Stm32cubeF4: read the table (PCM) in Fragment1.h and play it on the board DAC, using the libraries from Driver/BSP: stm32f4_discovery_audio

To make it simple, as a first trial, all the code is in main.c and stm32f4xx_it.c (and associated .h when needed)

I succeed to intialize the audio output and start the play function. The buffer callbacks are periodically actuated, but I have only strange noise in the earspeakers connected to the DAC. Would you have an idea why I don't get ''structured sound'' ?

And I have no idea about how to debug that...

I will be on leave for coming days with limited assess to my internet, but will try to browse the forum from time to time.

Best regards and thanks a lot to anybody that could help.

JMF
1 REPLY 1
jmf1
Senior
Posted on July 17, 2016 at 09:49

I succeeded to solve my issue.

In fact the buffer lengths in the calls to the main functions were not the needed ones. It is not obvious, but:

In BSP_AUDIO_OUT_Play((uint16_t *)Audio_output_buffer, AUDIO_OUTPUT_BUFF_SIZE*4) the buffer size must ne given in bytes and not uint16

and in  BSP_AUDIO_OUT_ChangeBuffer((uint16_t*)&Audio_output_buffer[0], AUDIO_OUTPUT_BUFF_SIZE*2) it seems that the value has to be half the one from the play function. This can be seen in the functions coding and in the examples, but I can't explain the rationale...

JMF