cancel
Showing results for 
Search instead for 
Did you mean: 

Getting HARD fault while receiving data from Serial UART2

Vivek yadav1
Associate III

I am working on a project where I have managed to detect any printer using USB driver provided by STM-HAL.

All this code is developed on STM32F407VG MUC Discovery Board. Which is working fine and I am able to print the labels as i want without any error.

But Now I need to run this code on STM32F405RG MCU for this I made my custom PCB. When I run this code I got HARD Fault.

Although my code is able to detect my attached printer.

So when Ever my HOST detect it prints on my serial port using UART2.

After printing interrupt occures and control goes to hard fault.

Q.1 : When I am running STM32F407VG code on this F405 MCU. It directly running without any error. Why we don't required any change i.e MACRO or include file include ????

Q.2 I am using another printer where I am not able to get printer ID.

All this is happening on F405 MCU(custom board ) but not on F407 MCU.

0693W000008xXCZQA2.png

2 REPLIES 2
djoha.1
Associate

So nice to hear that. Would you mind letting us know which label printer you used to print those labels across all your codings?

Bob S
Principal

Looking at the code in UART_WaitOnFlagUntilTimeout() will not help. That is NOT where the fault occurred. Look at HAL_HDC_IRQHandler() (the function just before fault handler was called). Also, CubeIDE has a built-in fault analyzer. What it that telling you about the fault?