Compiling Bootloader

@Ivan
I noticed in the system_stm32fxx.c thats in the project, it is configuring the STM32F405 with these settings by default: Of note is the AHB, APB1 and APB2 Prescalers.

This is how I have things sorted in cubemx. I match my pre-scalers to what the system_stm32fxx.c has set for them, then in the same file I manually change the following:
HSE Frequency(Hz) → 8000000
PLL_M → 5
PLL_N → 210
PLL_P → 2
PLL_Q → 7

I didn’t bother to use the generated code from cubemx, but instead changed those values in the system_stm32f4xx.c included in the project.

The timers say for example I put a 5ms delay and do a loop outputting something in the serial console and it seems correct, at around 5ms. However when I set the LED1 to led1.blink(5000, 500); this is I think suppose to keep the LED on for 5000ms then off for 500ms and repeats? In practice it seems to be half those numbers (2.5 secs to 0.25 secs).

Also are your I2S clocks, are they set at 192mhz? When I was playing around with the STM32F401 with the settings you described, that is what it comes out to. However it does not appear PLLI2S_N and PLLI2S_R is configured in the libstm32f4xx.a

I am still not able to scan the SD card, though when i do the SD.Begin(4), it does not fail, just returns nothing back when trying to read it though. I figure something to do with the clock settings still.

hmmm…

Regarding the LED timer: it uses TIM1 configured like this.

Change 42000 to a value that suits a 1ms timer in your system (I guess it’s the double).

This is true. PPLI2S_* values are configured in this function

@Ivan
Ah I get it, PLLI2S_N and PLLI2S_R is going to vary depending on the sample rate of the audio.

As for the LED timer, changing the number in ServiceTimer did not make any difference.
I will note, my LED is on PC4 which is GPIOC and not PB4 which is GPIOB. I assume that is going to make a difference? I made the changes in the variant.c to compensate for the different pin. All my other pins, for the sdcard, etc etc are all the same as your layout. Just the sole LED is different. I would assume the clock for GPIOC would need to be enabled/linked somewhere?

Thanks again.

The modification should work. I don’t know which core you are using (PropBoard or WaveTooEasy), so you have to modify the file of the correct core.

Regarding GPIO clocks, if the LED blinks, then the GPIO is clocked.

@Ivan

WaveTooEasy core.

Are there any other timing settings in the core files I should be aware of?

So I found that setting the TIM prescaler to 4 (it was 1 before), matching the APB1 prescaler, now the led is blinking at the correct intervals.

Figured out the SD card, i’m using a card reader that shares the card detect on the same pin as SDIO_D3 (PC11), so the sdPresent() would always return false. Will need to figure that out later.

@Ivan

Here’s another one for you. When I start to play a wav file, it will play for about 2 seconds then stop. I do not have any pins for latch playback, so I trick the system temporarily for testing in code to use latch mode and to play a file. The LED is blinking quickly like a file is playing though. Static in the sound output as well from the aux port.

EDIT Never mind, it was the microSD card. I switched out to a high quality sandisk and it solved all the problems.

@Ivan

Here is something, on the LM49450 that the WaveTooEasy is using. The LSVDD and VDD pins, I see you are providing 5V to them, which is for powering any speakers. The Datasheet is showing it can take up from 2.7V to 5.5V.

When I give it 5V (if I power my system with 5V then it runs to a regulator to drop to 3.3v, but the 5v still branches off to the LSVDD and VDD on the LM49450), I notice the aux jack gets all crackly and or will stop output of sound, but when not using the aux, the speakers work clearly/cleaning.

I also notice if I power the system directly with 3.3V, the LSVDD and VDD on the LM49450, everything works cleanly, the aux jack and the speakers (albit with less power) even though no 5V is going to the LSVDD and VDD pins. Was this something you ran into? How did you get around this?

I see some some people just use 3.3V to the LSVDD and VDD,
https://e2e.ti.com/support/audio-group/audio/f/audio-forum/896623/lm49450-would-this-linear-power-regulator-work-with-the-lm49450

However others use 5V
https://e2e.ti.com/support/audio-group/audio/f/audio-forum/926605/lm49450-lm49450-coupling-capacitor-lsvdd

I prefer the 5V for more power to the speaker output and slightly better sound from the speakers, but I still want to retain the aux jack for other application uses.

Thanks.

Actually I think I found the issue with my setup, with the HPGND and Mid-Rail Bias Bypass connected together before going through a cap when the HPGND should be going straight to ground. and the Mid-Rail Bypass should be going to the cap before ground.

@5mc, sorry for the late reply.

I’m glad you found the issue.