2016-07-12 06:17 AM
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: 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 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. JMF2016-07-17 12:49 AM
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