Skip to main content
Visitor II
March 16, 2021
Question

Send SPI with end of transmit complete interrupt without using HAL

  • March 16, 2021
  • 1 reply
  • 569 views

Hello,

I am on a new project that is sending SPI data every 200kHz (real time very important). I work on a STM32F722.

I want to use HAL_SPI_TxCpltCallback() to know when the transmit is finished, but I don't want to use the HAL drivers.

Indeed, when I use :

HAL_SPI_Transmit_IT(&hspi1, buff, 2);

(or any other SPI_Transmit) instead of :

SPI1->DR = buff[0]
SPI1->DR = buff[1]

It appears that it makes my overall CPU consumption is way more higher, because I think HAL stop the SD card driver, continuously reading data in my while(1).

Do you have a idea on how to send data via SPI without using HAL_transmit, but still using the interrupt HAL_SPI_TxCpltCallback ?

Thanks a lot, have a nice day!

Jean

    This topic has been closed for replies.

    1 reply

    jeanAuthor
    Visitor II
    March 16, 2021

    PS: I've tried this method :

    SPI1->DR = buff[0]
    SPI1->DR = buff[1]
    SPI1->CR2 |= SPI_IT_TXE;

    But it's hardfaulting ...