Skip to main content
rozehtiyan
Associate III
August 26, 2014
Question

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

  • August 26, 2014
  • 6 replies
  • 956 views
Posted on August 26, 2014 at 14:14

#spi #rtfm #stm32f030
This topic has been closed for replies.

6 replies

Andrew Neil
Super User
August 26, 2014
Posted on August 26, 2014 at 14:37

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

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
rozehtiyan
Associate III
August 26, 2014
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

Tesla DeLorean
Guru
August 26, 2014
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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
rozehtiyan
Associate III
August 26, 2014
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 III
August 26, 2014
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.

Tesla DeLorean
Guru
August 26, 2014
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 (See Profile) Up vote any posts that you find helpful, it shows what's working..