cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 Bug in HAL_SPI_TransmitReceive ?

Volker Bremauer
Associate III
Posted on September 29, 2017 at 15:22

Is there a bug in the HAL driver lib FW 1.1.0 ?

Because SPI4 is not supported.

In the routine HAL_SPI_TransmitReceive there is a question

'if (IS_SPI_HIGHEND_INSTANCE(hspi->Instance)) ...'

the else branch is empty/not existing.....

SPI4 is not a member of the HIGHEND instance !

#define IS_SPI_HIGHEND_INSTANCE(INSTANCE) (((INSTANCE) == SPI1) || \

                                           ((INSTANCE) == SPI2) || \

                                           ((INSTANCE) == SPI3))

Somebody has already used SPI4 ?

Is there a bug in the HAL lib, or have the prototyps of the H743 a bug in this section ?

1 ACCEPTED SOLUTION

Accepted Solutions
Imen.D
ST Employee
Posted on November 08, 2017 at 15:13

Hello

Bremauer.Volker

,

I confirm this is a bug.It seems that nothing is sent/received in case of SPI supporting only data transfer up to 16bits (SPI4 to SPI6 support up to 16-bit data mode).This issue is due to the wrong condition if (IS_SPI_HIGHEND_INSTANCE(hspi->Instance)) in the case of 8 and 16-bit modes.

Normally the condition IS_SPI_HIGHEND_INSTANCE should be applicable only for 32-bit mode (SPI1 to SPI3 support up to 32-bit data mode).

So, I suggested to you modify:

1- /* Transmit and Receive data in 32 Bit mode */

if (IS_SPI_HIGHEND_INSTANCE(hspi->Instance) && (hspi->Init.DataSize > SPI_DATASIZE_16BIT))

2- For receiving data in 8 and 16 Bit modes, remove the condition if (IS_SPI_HIGHEND_INSTANCE(hspi->Instance)).

This issue will be fixed in the next release of STM32CubeH7.

Thank you for highlighting this issue, and sorry for any inconvenience it may bring for you.

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

5 REPLIES 5
Imen.D
ST Employee
Posted on September 29, 2017 at 17:58

Hello

Bremauer.Volker

,

Thank you for you reported issue.I will check this issueandraise it internally if confirmed.

I will keep you informed with updates.

Kind Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Imen.D
ST Employee
Posted on November 08, 2017 at 15:13

Hello

Bremauer.Volker

,

I confirm this is a bug.It seems that nothing is sent/received in case of SPI supporting only data transfer up to 16bits (SPI4 to SPI6 support up to 16-bit data mode).This issue is due to the wrong condition if (IS_SPI_HIGHEND_INSTANCE(hspi->Instance)) in the case of 8 and 16-bit modes.

Normally the condition IS_SPI_HIGHEND_INSTANCE should be applicable only for 32-bit mode (SPI1 to SPI3 support up to 32-bit data mode).

So, I suggested to you modify:

1- /* Transmit and Receive data in 32 Bit mode */

if (IS_SPI_HIGHEND_INSTANCE(hspi->Instance) && (hspi->Init.DataSize > SPI_DATASIZE_16BIT))

2- For receiving data in 8 and 16 Bit modes, remove the condition if (IS_SPI_HIGHEND_INSTANCE(hspi->Instance)).

This issue will be fixed in the next release of STM32CubeH7.

Thank you for highlighting this issue, and sorry for any inconvenience it may bring for you.

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on November 21, 2017 at 12:46

I also find this bug today. It spent me a day to do with SPI4.

I think it should be modified like this:

if (hspi->Init.DataSize > SPI_DATASIZE_16BIT)

{

    if (IS_SPI_HIGHEND_INSTANCE(hspi->Instance))

    {

    }

}

Another question: When will the new issue be published?

Thank you !

Posted on January 09, 2018 at 21:52

Same has to be done in HAL_SPI_Receive

- Joerg -

Posted on January 11, 2018 at 15:21

Hi

Wagner.Joerg

,

Yes,we have already passed this issue concerned functions (HAL_SPI_Transmit(), HAL_SPI_Receive(), HAL_SPI_TransmitReceive()) along to our development team.

We are sorry for the inconvenience and thank you for your comprehension.

Kind Regards,

Imen.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen