cancel
Showing results for 
Search instead for 
Did you mean: 

Send SPI with end of transmit complete interrupt without using HAL

jean
Senior

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

1 REPLY 1
jean
Senior

PS: I've tried this method :

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

But it's hardfaulting ...