STM32H743xI/G, STM32H753xI device errata and ST HAL implementation?
Hi All,
I've been having issues with unreliable SPI transmission on an NUCLEO-H753ZI using ST H7 HAL HAL_SPI_TransmitReceive() talking to an ICM-42688-P IMU over SPI1 at 1 to 12 MHz clocks, with H753ZI RCC set up at 400MHz CPU clock and a 25 MHz SPI1,2,3 peripheral clock. SPI is set up for software controlled CS line to handle some specified ICM SPI timing hold time needs.
I came across a few forum posts discussing issues with SPI EOT flag timing causing frame truncations, such as "STM32H743 does not set EOT-Bit when SCK is to high" [link here] that led me to the device errata sheet [here].
In the errata sheet (ES0392 - Rev 13) I find "2.22.6 Truncation of SPI output signals after EOT event" I find:
With fast software execution (high PCLK frequency) and slow SPI (low SCK frequency), the SPI disable occurring
too fast may result in truncating the SPI output...
Workaround
Apply one of the following measures or their combination:
• Add a delay between the EOT event and SPI disable action.
• Decrease the ratio between PCLK and SCK frequencies.t signals...
It is unclear to me what are considered fast/high (PCLK) and slow/low frequencies (this really should be a quantified item in an official errata sheet) but I am thing 25 MHz PCLK is not really a high frequency, and going lower is not really an option.
From this I'm thinking a delay (one SPI clock period? again - how should I determine a delay length?) is required between the EOT event and SPI disable action to properly address the known errata.
Studying the STM32H7 HAL's blocking HAL_SPI_TransmitReceive() code [link] I can find no sign of an added delay before __HAL_SPI_DISABLE() (which occurs in called function SPI_CloseTransfer() [ink].
This now has me wondering, does the ST H7 HAL not take the device errata into account for SPI transfers? This is my conclusion so far, meaning I need to roll my own HAL_SPI_TransmitReceive for what in the end seems to be a fairly standard HAL library use case.
Am I getting this all correct? There is much conflicting info on this issue on internet searches, including on this forum.
I am hoping to find an authoritative answer before I implement what feels like somewhat of a hack work around against a poorly written and quantified device errata item.
Best Regards,
George
