STORAGE_Read_FS triggers HardFault_Handler() when trying to read from SPI
Hello everyone,
I've a project where I'm trying to emulate a mass storage device (MSC) using the STM32F103C8T6. The data itself should be stored on the Serial NOR-Flash (Winbound W25Q64...), operations are done with this library. Using the library in the main()-function, everything works (the library just translates the read/write calls into underlying spi hal). But accessing the flash chip via spi inside the STORAGE_Read_FS or STORAGE_Write_FS functions from the provided mass storage class (MSC), every function call to msc functions causes the HardFault handler to be triggered. Most of the time it's triggered somewhere in the HAL_SPI_TransmitReceive function, sometimes also in the HAL_GPIO_WritePin function. I increased both stack and heap size to 0x1000 bytes, but nothing changed. My guess is that there's memory corruption happening somewhere, but I couldn't find it even after days of research.
I would be very grateful if someone could help me to solve this problem.


