Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard fault crash after 1-2 minutes of running #76

Open
itxs opened this issue Dec 10, 2023 · 3 comments
Open

Hard fault crash after 1-2 minutes of running #76

itxs opened this issue Dec 10, 2023 · 3 comments

Comments

@itxs
Copy link

itxs commented Dec 10, 2023

I've written a simple button application based on the app-template. However, after some time of firmware being run on the STM32F027B-DISCO board, it stopped. I started to dig in and found HardFault occurred. The breakpoint in the HardFault handler in lib.rs never hit even if I press Run after the automatic stop caused by the debugger.
The repo: https://github.com/itxs/embedded_rust_learning
The screenshot of an issue:
image

@itxs
Copy link
Author

itxs commented Jan 12, 2024

Hm, any activity here?

@Urhengulas
Copy link
Member

Hi @itxs. That's odd. Unfortunately I do not have your board at hand, so you need to try a few things.

First can you please test if this problems also occurs with a very simple loop. The code is adapted from adapted from https://docs.rs/stm32f0xx-hal/latest/stm32f0xx_hal/delay/index.html, but I didn't test if it compiles, there might be some typo.

use helloworld1 as _; // global logger + panicking-behavior + memory layout

use stm32f0xx_hal as hal;

use crate::hal::pac;
use crate::hal::prelude::*;
use crate::hal::delay::Delay;
use cortex_m::peripheral::Peripherals;

#[cortex_m_rt::entry]
fn main() -> ! {
    let mut p = pac::Peripherals::take().unwrap();
    let mut cp = cortex_m::Peripherals::take().unwrap();

    let mut rcc = p.RCC.configure().freeze(&mut p.FLASH);
    let mut delay = Delay::new(cp.SYST, &rcc);
    loop {
        delay.delay_ms(1_000_u16);
        defmt::println!("Hello, world!");
    }

    helloworld1::exit()
}

Afterwards can you please test if the problem occurs with all your commits, or which commit introduced the bug.

When you have this please come back here with the results.

I assume this is an error on in the HAL, because I don't see which part of the template should be responsible for this, but let's see.

@itxs
Copy link
Author

itxs commented Apr 24, 2024

Sure, will check, sorry for delay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants