Closed rardiol closed 3 years ago
Hi @rardiol,
Thank you for your contribution. Unfortunately we were unable to reproduce the described behavior, in order to allow a better analysis of the problem, would you please share the whole project you have used to reproduce this issue.
With regards,
Hi @rardiol,
Please allow me to close this thread as no activity has been registered. You can reopen it at any time if you have details to provide us to help you solve this issue. Thank you for your comprehension and thank you once more for your contribution
With regards,
Describe the set-up
Describe the bug
Hard Fault
How To Reproduce
Configure SPI for 8 bits mode using the .ioc file.
Declare two globals
Call
HAL_SPI_TransmitReceive_IT(&hspi1, _spi_write, _spi_reading, 3) != HAL_OK
Worked fine with -O0, but when switching to -Os I get a HardFault inside SPI_2linesRxISR_8BIT
Additional context
Further testing with
fsanitize=undefined
a crash happens inside the HAL code on what I think is an alignment check for((uint16_t *)hspi->pTxBuffPtr)
. That pointer comes from_spi_write
, which is a uint8_t array, so not 2 byte aligned. pTxBuffPtr is also a (uint8_t*)This seems to fix the problem:
Is it documented anywhere that the arguments to the SPI HAL should be 2 byte aligned?