2014-03-13 08:41 AM
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[]
touint16_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?2014-03-13 08:48 AM
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 RAM2014-03-13 09:13 AM
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