cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4-Discovery EVAL_AUDIO_PLAY() I2S works from flash, but not from SRAM

jtoomim
Associate
Posted on March 13, 2014 at 16:41

I'm testing the Audio_playback_and_record example program in MEDIA_intFLASH mode, using Keil µVision 5.1. I've noticed that the program works fine (plays music) as it is written, but if I change the declaration of AUDIO_SAMPLE from 

const uint16_t AUDIO_SAMPLE[]

to 

uint16_t AUDIO_SAMPLE[]

 (not const), then all that plays is static. Similarly, if I try to use EVAL_AUDIO_PLAY(...) in another project on any non-const audio buffers that I create, it results in static being played. I suspect this might be due to const causing the compiler to leave the data in flash, and something in the DMA code not working properly with SRAM, but I don't know what it could be.

The project build options do not have the 64K CCM enabled, so I doubt this is the issue.

Can anyone replicate this issue? Is it Keil-only? Any ideas on what might be causing it or how to fix it?

2 REPLIES 2
Posted on March 13, 2014 at 16:48

Use the debugger, examine the content in memory, and then review how the DMA, or whatever, is pointing at that data.

Add some simple code to checksum the data block, and observe if it remains the same whether you put the structure in FLASH or RAM

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 13, 2014 at 17:13

If you did no other change than remove the ''const'', then the compilation must have failed or you have a suspicious linker script.

The AUDIO_SAMPLE[] array initializer is 0xf4ff4, i.e. cca 1Mbyte long.

JW