cancel
Showing results for 
Search instead for 
Did you mean: 

HardFault_Handler() at stm32l0xx_it.c:85 0x80008b4

MX_GPIO_Init();

MX_SPI2_Init();

MX_USART2_UART_Init();

MX_FATFS_Init();

/* USER CODE BEGIN 2 */

W25Qxxx_Init();

fres = f_mount(&fs,"0:",1);

if(fres == FR_OK)

{

v=9;

fres = f_open(&fp, "info.txt", FA_OPEN_ALWAYS|FA_WRITE);

}

else

{

v=2;

}


trying to use spi flash using fatfs .
but occur hardfault handler when calling fopen . i am not sure whether it is from fopen or not.

1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

Hello @NOVAL_______BOBY and welcome to the community,

Need to validate your read / write operation to the SPI Flash memory "W25Qxxx" before implementing FatFs on it.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.

View solution in original post

4 REPLIES 4
SofLit
ST Employee

Hello @NOVAL_______BOBY and welcome to the community,

Need to validate your read / write operation to the SPI Flash memory "W25Qxxx" before implementing FatFs on it.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.

tried read and write operations worked successfuly but when i try this again 

fres = f_mkfs("0:", FM_FAT, 0, worK, sizeof(worK));

fres = f_mount(&fs,"0:",1);

if(fres == FR_OK) {

v=9;

fres = f_open(&fp, "info.txt", FA_OPEN_ALWAYS|FA_WRITE);

}

else {

v=fres;

}
i got
HardFault_Handler() at stm32l0xx_it.c:85 0x80008b4

Thread #1 [main] 1 [core: 0] (Suspended : Signal : SIGTRAP:Trace/breakpoint trap)
HardFault_Handler() at stm32l0xx_it.c:85 0x80008d8
<signal handler called>() at 0xfffffff9
HAL_SPI_TransmitReceive() at stm32l0xx_hal_spi.c:1,308 0x8003128
HAL_SPI_Receive() at stm32l0xx_hal_spi.c:979 0x8002ca4
W25Qxxx_ReadPage() at w25q32.c:800 0x80010a8
W25Qxxx_ReadSector() at w25q32.c:839 0x8001160
W25Qxxx_diskio_read() at w25q32.c:974 0x8001250
disk_read() at diskio.c:122 0x800406c
move_window() at ff.c:925 0x80045fe
check_fs() at ff.c:2,971 0x80053f8
<...more frames...>

what should be reason any idea??

 

Duplicate - merged.


tried read and write operations worked successfully but when i try this again 

 

fres = f_mkfs("0:", FM_FAT, 0, worK, sizeof(worK));
fres = f_mount(&fs,"0:",1);
if(fres == FR_OK) {
  v=9;
  fres = f_open(&fp, "info.txt", FA_OPEN_ALWAYS|FA_WRITE);
}
else {
  v=fres;
}

 

i got

HardFault_Handler() at stm32l0xx_it.c:85 0x80008b4

Thread #1 [main] 1 [core: 0] (Suspended : Signal : SIGTRAP:Trace/breakpoint trap)
HardFault_Handler() at stm32l0xx_it.c:85 0x80008d8
() at 0xfffffff9
HAL_SPI_TransmitReceive() at stm32l0xx_hal_spi.c:1,308 0x8003128
HAL_SPI_Receive() at stm32l0xx_hal_spi.c:979 0x8002ca4
W25Qxxx_ReadPage() at w25q32.c:800 0x80010a8
W25Qxxx_ReadSector() at w25q32.c:839 0x8001160
W25Qxxx_diskio_read() at w25q32.c:974 0x8001250
disk_read() at diskio.c:122 0x800406c
move_window() at ff.c:925 0x80045fe
check_fs() at ff.c:2,971 0x80053f8
<...more frames...>

what should be reason any idea??


Post edited to format code - please see this for posting source code, and this for other "formatted" text.

It's hard to tell:

See "How to debug a HardFault on an Arm Cortex®-M STM32" 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.