Skip to main content
BPark.5
Associate II
August 12, 2021
Question

UART DMA

  • August 12, 2021
  • 7 replies
  • 1672 views

I am using STM32H743

I used uart's DMA

Check whether data has been received through this function

But there is no data in the buffer. Why the hell is this happening?

And, of course, I changed the linker start(0x24000000) and end address(0x2407FFFF) of the project.

This topic has been closed for replies.

7 replies

Tesla DeLorean
Guru
August 12, 2021

DMA coherency? This stuff operates independently of the MCU.

Use the DCache Invalidate By Address function so it sees the data in the physical memory

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
BPark.5
BPark.5Author
Associate II
August 12, 2021

I'm sorry but I didn't understand

Can you be more specific?

Tesla DeLorean
Guru
August 12, 2021

Do people really exist in such a vacuum of knowledge/understanding?

You need to force the CPU side cache to refetch the content of the memory, the DMA operates on the memory directly, not what the cache is holding, the cache here is not exotic, it doesn't do any bus snooping to catch external activity.

/**

 \brief  D-Cache Invalidate by address

 \details Invalidates D-Cache for the given address

 \param[in]  addr  address (aligned to 32-byte boundary)

 \param[in]  dsize  size of memory block (in number of bytes)

*/

__STATIC_INLINE void SCB_InvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize)

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
August 12, 2021

Be careful however the cache-lines are 32-bytes wide and you can do collateral damage to structures/variables that span the boundaries, or have pending writes.

Best to have an aligned DMA buffer, and padded out so other structures are uninvolved.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
TDK
August 12, 2021

No data? Or 0's?

Disable data cache and try again. Likely it will work, in which case you will need to manage the cache appropriately by cleaning prior to sending and invalidating after receiving.

"If you feel a post has answered your question, please click ""Accept as Solution""."
BPark.5
BPark.5Author
Associate II
August 12, 2021

That is 0's

I'm sorry, but please give me a specific example

Pavel A.
August 12, 2021