stm32-rs / stm32h7xx-hal

Peripheral access API for STM32H7 series microcontrollers
BSD Zero Clause License
215 stars 101 forks source link

480MHz and vos0 unstable on stm32h747XI (Arduino GIGA R1 WiFi) #485

Closed bsodmike closed 7 months ago

bsodmike commented 7 months ago

Hi all,

I've been trying to get 480MHz & vos0 working on the above board (see https://github.com/bsodmike/h7/blob/master/h7-cm7/src/main.rs#L52-L115) however, this is unstable and when I power-cycle my board it just bricks itself.

However, a lower clock speed works just fine,

    let mut pwrcfg = pwr.ldo().vos1().freeze();

    let rcc = dp.RCC.constrain();
    let ccdr = rcc.sys_ck(100.MHz()).freeze(pwrcfg, &dp.SYSCFG);

Would appreciate if anyone has any pointers in getting this to run at 480MHZ, thanks!

olback commented 7 months ago

I'm not familiar with that particular board but looking at the schematic, it appears to have an external 16MHz crystal. Screenshot_2024-02-06-07-09-59-93_984e1414ae90666a90f12ff17ec14a7f.jpg

Something like this should work I think:

let mut ccdr = dp
    .RCC
    .constrain()
    .use_hse(16.MHz())
    .sys_ck(480.MHz())
    .hclk(240.MHz())
    // ... 
    .freeze(pwrcfg, &dp.SYSCFG);
bsodmike commented 7 months ago

Hi @olback nice to meet you! I really liked your h7 project which helped me a lot to get started. Ooh this makes total sense, will try it!!

Thank you, M

bsodmike commented 7 months ago

@olback as per your suggestion, I tried replacing https://github.com/bsodmike/h7/blob/master/h7-cm7/src/main.rs#L102 with .use_hse(16.MHz()) - no other changes. I had to re-flashed the Mbed OS to get a working "power stage" loaded so that the board would work at all.

.use_hse(16.MHz()) - doesn't seem to work for me.

Flashing the amended h7-cm7 firmware would cause the blue led to flash (https://github.com/bsodmike/h7/blob/master/h7-cm7/src/main.rs#L511-L515). However, if I power-cycle the board it "freezes" up again.

I also find my Jlink-mini has trouble connecting to the board at times; it seems to be rather sporadic.

bsodmike commented 7 months ago

@olback this is the only stable config I've found so far, i.e. flash the board and power-cycle it, and my expectation is the blue LED will pulse.

https://github.com/bsodmike/h7/blob/master/h7-cm7/src/main.rs#L80-L113

I'm using dfutil to flash the stm32 chip https://github.com/bsodmike/h7/blob/master/upload.sh

FYI if I try to use let mut pwrcfg = pwr.vos0(&dp.SYSCFG).freeze(); I cannot get past this line with the debugger. It will die at this point https://github.com/stm32-rs/stm32h7xx-hal/blob/master/src/pwr.rs#L492

bsodmike commented 7 months ago

I managed to get this to work with embassy-stm32 with similar config. If anyone figures this out, feel free to comment but I'm closing this.