cancel
Showing results for 
Search instead for 
Did you mean: 

HAL library bug in OSPI driver

trs
Associate II

Source and destination parameters are incorrectly placed in the following code:

stm32h7xx_hal_ospi.c

Line 1496

HAL_OSPI_Transmit_DMA function

if (HAL_MDMA_Start_IT(hospi->hmdma, (uint32_t)pData, (uint32_t)&hospi->Instance->DR, hospi->XferSize, 1) == \
HAL_OK)

7 REPLIES 7
SofLit
ST Employee

Hello,

Sorry I couldn't understand;

HAL_MDMA_Start_IT has the following definition:

 

HAL_StatusTypeDef HAL_MDMA_Start_IT(MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t BlockDataLength, uint32_t BlockCount)

 

So the 2nd input is the source and the 3rd one is the destination.

In stm32h7xx_hal_ospi.c line 1496:

 

 if (HAL_MDMA_Start_IT(hospi->hmdma, (uint32_t)pData, (uint32_t)&hospi->Instance->DR, hospi->XferSize, 1) == \

 

So pData is the source which is located in the RAM and the destination hospi->Instance->DR is the data register of the OSPI.

Could you please clarify? or am I missing something?

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.
trs
Associate II
Now tell me how you would call HAL_MDMA_Start_IT() function when you want to send data from MCU to a OSPI memory chip, and how you would call this function when you want to receive data from OSPI memory chip to MCU. By how, I mean where would you place source and destination addresses in both cases, show me example in pseudo code.

To send data from a memory to OSPI using DMA you need to call :  HAL_OSPI_Transmit_DMA():

Line 1496if (HAL_MDMA_Start_IT(hospi->hmdma, (uint32_t)pData, (uint32_t)&hospi->Instance->DR, hospi->XferSize, 1) == \
HAL_OK)

To receive data from OSPI to a memory using DMA you need to call : HAL_OSPI_Receive_DMA():

line 1600: if (HAL_MDMA_Start_IT(hospi->hmdma, (uint32_t)&hospi->Instance->DR, (uint32_t)pData, hospi->XferSize, 1) == \

Hope I answered your question!

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.

So here the issue is on the receive and not on the transmit contrary to what you posted at the beginning.

SofLit_0-1718308514021.png

 

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.
trs
Associate II

Good you understand it now.

SHs
ST Employee

Hello @trs,

The issue has been identified and resolved internally. The fix is now available on GitHub and will be included in the upcoming release. 

Thank you for your contribution.

Internal ticket number: 179252

Please close this topic by clicking on “Accept as solution" button if it fully answered your question.