2021-04-28 6:06 AM
Hello dear community!
I've migrated from F7 to H7, everything fine so far.
To save CPU time I don't want to use HAL for sending two SPI bytes.
My F7 transmit SPI code was very simple and perfectly working :
SPI6->DR = byte_0;
SPI6->DR = byte_1;But on the H7, the same code doesn't work :
SPI6->TXDR = byte_0;
SPI6->TXDR = byte_1;In both F7 and H7 projects, this is always working (but time-consuming) :
HAL_SPI_Transmit(&hspi6, const_cast<uint8_t*>(buffer), 2, 1000);Do you know why bypassing HAL is not possible on the H7 ?
Thanks!
Jean
2024-07-25 6:27 AM
Excellent - please mark that as the solution;
https://community.st.com/t5/community-guidelines/help-others-to-solve-their-issues/ta-p/575256
2026-04-23 5:47 AM
2026-04-24 9:39 AM
Something like this...
void SPI_TX_BYTE(uint8_t d)
{
unsigned cnt = 20000;
while (!LL_SPI_IsActiveFlag_TXP(SPIx)) {
if (--cnt == 0) {
Error_handler();
return;
}
}
LL_SPI_TransmitData8(SPIx, d);
}
uint8_t SPI_RX_BYTE()
{
unsigned cnt = 20000;
while (!LL_SPI_IsActiveFlag_RXP(SPIx)) {
if (--cnt == 0) {
Error_handler();
return 0;
}
}
return LL_SPI_ReceiveData8(SPIx);
}