0
\$\begingroup\$

I'm trying to program my touchGFX project and download a music file to this board without much luck. The touchGFX project works fine but I'm testing the sound part now. I managed to extract the drivers for the audio codec (WM8994) and add them to the project. I had to comment out several lines but I finally got no compile or run errors. I'm getting nothing but noise when the audio start to play. The file that I needed to add was too big for the flash so I cut it to a couple of seconds and saved it as rodoTest1.bin. According to the readme file from BSP project (That's where I got the drivers) I need to: Use STLink utility to load my audio file to the STM32 internal flash at the address 0x08080000.

I thought I did but I'm not sure it is correct... anyway I still get nothing but noise and the touchGFX (touch screen) project stops working. I've tried different combination of sequences: Program project with cubeIDE first then use cubeProgrammer for the music file... nope and I get an error the first time I try to download the file. Program music file first then project... nope. Obviously I'm doing things wrong.

I added 3 pictures below for more info. First shows the console output for the memory after compiling in cubeIDE. The second is the log from the cubeProgrammer. The third is the "build analyzer" tab inside cubeIDE.

Could someone point the errors of my way please?

STM32CubeIDE programming board

STM32CubeProgrammer downloading file

BuildAnalizer after compiling project in cubeIDE

\$\endgroup\$
6
  • 1
    \$\begingroup\$ The message "failed to erase memory" in red looks important. Could that be your issue? \$\endgroup\$ Commented Sep 2, 2023 at 2:47
  • \$\begingroup\$ "I had to comment out several lines but I finally got no compile or run errors" <- perhaps those lines you commented out were important ... \$\endgroup\$
    – brhans
    Commented Sep 2, 2023 at 13:31
  • \$\begingroup\$ @Jaredo Mills: Yeah that does not look right but I don't know why the second time it works. \$\endgroup\$
    – Rodo
    Commented Sep 2, 2023 at 17:20
  • \$\begingroup\$ @brhans: Most of the code I erased was related to the rest of the BSP project I'm not using. Like display functions I'm not using because the BSP project doesn't use TouchGFX. The audio files were left intact and that's where all of the driver code is. \$\endgroup\$
    – Rodo
    Commented Sep 2, 2023 at 17:23
  • \$\begingroup\$ Why do you think the program must be loaded to higher address than start of flash? What is there before your program, a bootloader? Your debugger did load it to start of flash. If you do a full erase for flash, then you also lose the bootloader if you need it for your program to start at later address. It is unknown what is your situation and why do you want to use these addresses. Also your application needs to be built so that it knows it is in higher address than start of memory. \$\endgroup\$
    – Justme
    Commented Sep 2, 2023 at 19:25

1 Answer 1

0
\$\begingroup\$

It looks like PEBCAK.

"getting nothing but noise when the audio start to play" is a clue.

The fact that you hear noise means several things:

  • the data being played is not 0xFF's (blank flash)
  • your programming likely did succeed

You also say you added a "file", which means "container".

Your codec does not expect a "file"/"container". It would have not played if it expected a container as input because it would have validated the container first, and detected an incompatible format.

If it expected a container, and found its format compatible, it would not have decoded it into noise.

The fact that something plays, and it's noise, means that the codec does not validate the input as audio. In turn this means it expected to find raw audio data, perhaps in some PCM encoding, which cannot be validated, and it played that bitstream. A binary bitstream does sound like noise when converted directly to analog audio.

There are several PCM encodings, reading the documentation of your codec will tell you what the format and encoding is required as input.

You can convert your source audio to raw PCM with a tool like Audigy.

\$\endgroup\$
3
  • \$\begingroup\$ It plays back noise whether I download the music file or not. I thought 0xff would sound like noise too? \$\endgroup\$
    – Rodo
    Commented Sep 2, 2023 at 20:56
  • \$\begingroup\$ 0xff's would mean every sample is the same value. When converted to analog, this would result in a constant voltage (silence). \$\endgroup\$ Commented Sep 2, 2023 at 21:00
  • \$\begingroup\$ In a moment of intelligence (/s) it occur to me to test my file with the BSP project that plays a file. It works. My file plays fine. I still get the error when programming it the first time though. I also got the noise I hear in my project ... when I touch the screen. I'll need to connect the scope and see what's going on on the I2C bus ... touch panel is connected there. I wish I could see what's going on on the I2S bus but those pins are not easily accessible. \$\endgroup\$
    – Rodo
    Commented Sep 2, 2023 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.