Skip to main content
TWu.11
Associate
March 22, 2019
Question

found a bug with cube_mx generate code in HAL_SPI_Transmit_DMA function.

  • March 22, 2019
  • 3 replies
  • 743 views

In this function call the package mode check wrong buffer alignment,

should check tx buffer not rx buffer.

FYI.

Typhoon

This topic has been closed for replies.

3 replies

Nesrine.JLASSI
Visitor II
March 22, 2019

Hi @TWu.1​ 

Could you please send me you .ioc file to check the problem.

Best regards.

Nesrine.

TWu.11
TWu.11Author
Associate
March 22, 2019

Dear Sir,

Attached is my IOC, and please check the

HAL SPI Library about HAL_SPI_Transmit_DMA function following is modified and work code

generate code is put in "hdmarx" FYR

/* Packing mode management is enabled by the DMA settings */

if (((hspi->Init.DataSize > SPI_DATASIZE_16BIT) && (hspi->*hdmatx-*>Init.MemDataAlignment

!= DMA_MDATAALIGN_WORD)) || \

((hspi->Init.DataSize > SPI_DATASIZE_8BIT) &&

((hspi->*hdmatx*->Init.MemDataAlignment

!= DMA_MDATAALIGN_HALFWORD) && \

(hspi->*hdmatx*->Init.MemDataAlignment

!= DMA_MDATAALIGN_WORD))))

{

/* Restriction the DMA data received is not allowed in this mode */

errorcode = HAL_ERROR;

__HAL_UNLOCK(hspi);

return errorcode;

}

ST Community 於 2019年3月22日 週五 下�?�4:33寫�?�:

Amel NASRI
ST Technical Moderator
March 22, 2019

Hello @TWu.1​ ,

Is the problem faced using STM32H7?

If yes, please refer to this question where the same issue was reported.

Please note that SPI driver will be reworked for STM32CubeH7 package and a new version will be available fixing multiple issues reported in the Community.

-Amel

To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.