cancel
Showing results for 
Search instead for 
Did you mean: 

How can we know that the all datas have been sent!?

rozehtiyan
Associate II
Posted on August 26, 2014 at 14:14

#spi #rtfm #stm32f030
6 REPLIES 6
Posted on August 26, 2014 at 14:37

What does the documentation for the ''HAL_SPI_Transmit_IT()'' function say?

rozehtiyan
Associate II
Posted on August 26, 2014 at 15:36

Nothing! you can download the library from this link:

http://www.st.com/web/en/catalog/tools/PF260612

Posted on August 26, 2014 at 17:56

Should add call-back code in your main.c

void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi);
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
rozehtiyan
Associate II
Posted on August 26, 2014 at 18:48

Hey Clive, Thanks

but that's not clear to me still. where/how can I add my code to the callback?

in the stm32f0xx_hal_spi.c file and in the void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi); function has written:

''NOTE : This function Should not be modified, when the callback is needed,

            the HAL_SPI_TxCpltCallback could be implenetd in the user file''

I want to set the NSS pin after transmission and now sound like I have to use the callback. please clear me. the callback function just has an argument that it is a structure.

rozehtiyan
Associate II
Posted on August 26, 2014 at 19:32

From: fairchild.brian

Posted: Tuesday, August 26, 2014 6:48 PM

Subject: How can we know that the all datas have been sent!?

Hey Clive, Thanks

but that's not clear to me still. where/how can I add my code to the callback?

in the stm32f0xx_hal_spi.c file and in the void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi); function has written:

''NOTE : This function Should not be modified, when the callback is needed,

            the HAL_SPI_TxCpltCallback could be implenetd in the user file''

I want to set the NSS pin after transmission and now sound like I have to use the callback. please clear me. the callback function just has an argument that it is a structure.

Posted on August 26, 2014 at 19:51

It's weakly defined, you're supposed to supply your own version that does whatever it needs to do at completion. It passes you a structure, you could expand/overload that structure to carry around your own context sensitive data if required.

Do whatever clean up you need, and return. In YOUR main.c, ******.c, or whatever

/**
* @brief Tx Transfer completed callbacks
* @param hspi: SPI handle
* @retval None
*/
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)
{
// Do your stuff here, and return
}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..