Unable to flash the code into NUCLEO-L552ZE-Q Board

List of softwares in my PC:
1)RUSTUP - rustup 1.25.2
2)Visual Studio code - 1.76.2
Extensions used in VScode:
C/C++v1.14.4 rust-analyzerv0.3.1435

I've tried to blink the LED using RUST on VScode IDE. I've used the following github repo (git clone GitHub - David-OConnor/stm32-hal-quickstart: A default template for STM32-HAL)
for creating a proper directory and customized according to my microcontroller by using following files.

  • Cargo.toml: `stm32-hal2 = { version = "^1.5.0", features = ["l4x3", "l4rt"]}
    (Not sure about this version and features).
  • memory.x: FLASH and RAM lines
    FLASH : ORIGIN = 0x08000000, LENGTH = 512K
    RAM : ORIGIN = 0x20000000, LENGTH = 256K
  • .cargo/config.toml: runner and target lines.
    target = "thumbv8m.main-none-eabihf" # Cortex-M33F and Cortex-M35F (eg L5, U5)

After making following changes, I was able to build successfully, but when I tried to flash , I see the'' Flashing program success'' message on my screen but LED is not blinking.

Any suggestions would be appreciated.

I guess one problem may be that you selected features for an l4, as in the template. This is a Cortex-M4, and uses the target thumbv7em-none-eabihf. In your case, select the features related to the l5, which is a Cortex-M33 (target thumbv8m.main-none-eabi). So add the target:
rustup target add thumbv8m.main-none-eabi
and use in the Cargo.toml features ["l552", "l5rt"].

Additionally, make sure you are using the correct GPIO connected to the LED in your board (which may be different to the one in the template).

I hope this helps.

Edit: I see that the STM32L552ZE does include a FPU, so the target you are using thumbv8m.main-none-eabihf should also work. Not required for this simple LED application, though.
Edit 2: see the features., available in the latest version 1.6.2 of stm32-hal.

1 Like

Hiiii pzometa,
I've changed the features and updated with l5 and also connected the LED pins correctly but still I've the same issue.
let gpiob = &peripherals.GPIOB;
gpiob.odr.modify(|_, w| w.odr7().set_bit());

Any suggestions would be appreciated.

Really dumb question: have you configure your GPIO B7 as an output? It would be helpful if you post the contents of your main.rs.
Alternatively, can you try flashing this example on your board and see if your LED blinks?

Hello @pzometa, please find the link of the code, currently we are using to blink LED.

It is showing following log and LED is not blinking.

Thank you very much for your detailed support and previous chain of suggestions.

Any help for above query would be much appreciated.

You need to use the GPIO connected to the LED in your board.
That is, in your main.rs, line 42, replace:
let mut led = Pin::new(Port::C, 13, PinMode::Output);
with this
let mut led = Pin::new(Port::B, 7, PinMode::Output);

Cheers,

Hiii @pzometa, I'm able to see the LED blinking.
Thank you so much for your constant support and suggestions.

I’m glad I could help. Have fun with embedded Rust! :slightly_smiling_face:

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.