cancel
Showing results for 
Search instead for 
Did you mean: 

found a bug with cube_mx generate code in HAL_SPI_Transmit_DMA function.

TWu.11
Associate

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

should check tx buffer not rx buffer.

FYI.

Typhoon

3 REPLIES 3

Hi @TWu.1​ 

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

Best regards.

Nesrine.

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 Employee

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 Accept as Solution on the reply which solved your issue or answered your question.