After my success in getting my Waveshare CoreH7XXI single-board computer’s SDRAM running it was time to get the sound running. I had previously accomplished this streaming sound from a single-board using an STM32 F4 micro-controller. It was time to port that to the H7.
While it didn’t take long to get the code ported, it wasn’t working at all. The PWM channel was working fine, but I was unable to get DMA to feed in the waveform. After some tracing I found I was getting a Transfer Error Interrupt from the DMA controller as soon as launched the DMA request. After some digging, I found out why. There are 5 RAM regions on the H7. By default, data is placed in a 128 KiB region starting 0x2000000. DMA is unable to access this region and I had to use an area marked RAM_D2 starting at 0x3000000.
That made sense and I modified the linker script so I had a way to specify this memory region. However, I found two linker script: one for RAM and one for flash. So my initial attempt failed because I modified the RAM script. I assume this is meant for running the code out of RAM. I never need to do this so I added the same lines to the flash script. That did work, and so did the DMA.
This was a longer walk than expected. Typically STM controllers are pretty straightforward, but the H7 is more complex and hence has a couple of gotchas like this. Now that I know it shouldn’t be a problem working around it.
In my continuing journey to make a MOD player I picked up a Waveshare CoreH7XXI single-board computer a couple of months ago. It is based on a very powerful (for an embedded single-board) STM32 H7 micro-controller, but the main reason I picked it up was its of 8 MiB of SDRAM.
Getting the board to boot wasn’t too difficult, but getting the RAM setup took a little longer. The board is made by a Chinese company and the documentation is fairly scant. However, I found a demo software library that had the memory settings. With a quick video about how to setup the FMC (Flexible Memory Controller) was able to get the initialization out of the way. Despite my settings being correct the RAM was still inaccessible. After some more looking through the example I found there was a board-specific memory initialization function that needed to be run. It is not enough to simply setup the FMC—one must also communicate to the SDRAM how it should be setup for operation.
After this was complete, the SDRAM was accessible and running well. I used a Linear Feedback Shift Register (LFSR) to fill the memory with a pattern and then read it back for verification. I had no problems verifying all 8 MiB.
This is going to work fine. While I think I can make a MOD player with less memory, I want to start with a setup where memory isn’t an issue. This board should work fine for that. Besides, there are other things I can do with the board and having this expense is a good thing.