Hello, I want to send data via uart + dma, and the program works fine on RTD 2.0.3. But when I transport it to RTD 4.0.0, the uart can only recieve data successfully, it sent "00" always at the trasmitting side. The test program I uploaded recieves data and transmit them out, it can recieve right fix data like 0~16, but transmit 16 zeros. please help me to check the program, thanks.
已解决! 转到解答。
If it works properly after delete D_CACHE_ENABLE in Defined symbols, then it should be related to data cache.
Try putting the buffer in a non cacheable memory section:
#define UART_START_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
#include "Uart_MemMap.h"
__attribute__(( aligned(32) )) uint8 rxdata[256u];
#define UART_STOP_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
#include "Uart_MemMap.h"
Are UartSend and UartReceive your own APIs? Do S32K3 RTD APIs such as Uart_AsyncSend and Uart_AsyncReceive work properly?
Hi
Please place the buffer in a non cacheable memory section.
In the DMA transfer mode, DMA transfers may have cache coherency problems. To avoid possible coherency issues when D-CACHE is enabled, the user shall ensure that the buffers used as TCD source and destination are allocated in the NON-CACHEABLE area (by means of Uart_Memmap). Otherwise, the Uart driver has some dependencies. User must to put all variables, which were used for transmitter and receiver, in the NON CACHEABLE memory section in the RAM zone by the definition UART_START_SEC_VAR_<INIT_POLICY>_<ALIGNMENT>_NO_CACHEABLE and UART_STOP_SEC_VAR_<INIT_POLICY>_<ALIGNMENT>_NO_CACHEABLE.
Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi, thank you for reply, I tried to disable the whole dcache before uart test, but the problem hadn't been solved.
If it works properly after delete D_CACHE_ENABLE in Defined symbols, then it should be related to data cache.
Try putting the buffer in a non cacheable memory section:
#define UART_START_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
#include "Uart_MemMap.h"
__attribute__(( aligned(32) )) uint8 rxdata[256u];
#define UART_STOP_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
#include "Uart_MemMap.h"
Are UartSend and UartReceive your own APIs? Do S32K3 RTD APIs such as Uart_AsyncSend and Uart_AsyncReceive work properly?