I had and issue using this driver in a STM32F030xxx. Whenever I call HAL_SPI_Transmit(...) inside the _spiflash_spi_txrx callback, the system goes in HardFault.
I started to investigate and I discovered that the problem was in a cast to uint16_t *, made inside the HAL_SPI function, of tx_data passed as argument by the callback, because the address was not aligned to a 16 bit address.
The fix I propose is to align the tx_internal_buffer of the spiflash_t struct.
I already tried uint8_t tx_internal_buf[16] __attribute__ ((aligned(16))); at line 275 and it works.
Maybe due to the wide targets of this driver would be even better to align to a 32 bit address.
I had and issue using this driver in a STM32F030xxx. Whenever I call
HAL_SPI_Transmit(...)
inside the_spiflash_spi_txrx
callback, the system goes in HardFault. I started to investigate and I discovered that the problem was in a cast touint16_t *
, made inside the HAL_SPI function, of tx_data passed as argument by the callback, because the address was not aligned to a 16 bit address. The fix I propose is to align the tx_internal_buffer of the spiflash_t struct. I already trieduint8_t tx_internal_buf[16] __attribute__ ((aligned(16)));
at line 275 and it works. Maybe due to the wide targets of this driver would be even better to align to a 32 bit address.