Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Jony1211
Level 2
Level 2
10 replies posted 25 sign-ins 5 replies posted

I want to use the DMA serial port interrupt way to read the indefinite length data, the current phenomenon is to send abcd, DMA interrupt will enter 4 times, then g_rxdata='abcd ', and then send hello, DMA interrupt will enter 5 times, g_rxdata='abcdhello', What I want is the data received every time in the array, I don't know where the problem is, this problem has been bothering me for several days, please help solve it, thank you very much!

0 Likes
1 Solution
Kunqiao_L
Moderator
Moderator
Moderator
First comment on blog First like given 25 likes received

Hi Jony1211,

I am assuming you used this code example as your reference right?

UART_DMA_Transfer_1_KIT_TC275_LK 

Firstly, the intent of using DMA is to keep transferring your data into a buffer without any CPU interrupt involved, and later user could get chunk of data from destination to do further processing. 

So the example's behavior of getting "hello" after "abcd" is correct. 

If you want to get your string each time, just simply use following example to get Rx buffer, there is no need using DMA.

ASCLIN_UART_1_KIT_TC275_LK 

 

If you really want to try DMA in your case, just clear all your rx_buffer everytime of DMA transfer complete's ISR function, and reinit the dma, then next time of string like "hello" will be put there without "abcd" ahead. 

IFX_likunqiao_0-1698114385426.png

Again, how do you deal with your buffer "g_rxdata" depends on your application code. You could even create a task to periodically take data out.

Thanks

 

View solution in original post

0 Likes
3 Replies
Kunqiao_L
Moderator
Moderator
Moderator
First comment on blog First like given 25 likes received

Hi Jony1211,

Could you explain little bit more about what you want, you could use Chinese (although it is EN platform). I assuming you want is first time it sends "abcd", DMA transfers and g_rxdata is "abcd". Next time it sends "hello", DMA transfer and g_rxdata is "hello"?

0 Likes

是的,我目前的问题是发送完“hello”,g_rxdata="adcdhello"

0 Likes
Kunqiao_L
Moderator
Moderator
Moderator
First comment on blog First like given 25 likes received

Hi Jony1211,

I am assuming you used this code example as your reference right?

UART_DMA_Transfer_1_KIT_TC275_LK 

Firstly, the intent of using DMA is to keep transferring your data into a buffer without any CPU interrupt involved, and later user could get chunk of data from destination to do further processing. 

So the example's behavior of getting "hello" after "abcd" is correct. 

If you want to get your string each time, just simply use following example to get Rx buffer, there is no need using DMA.

ASCLIN_UART_1_KIT_TC275_LK 

 

If you really want to try DMA in your case, just clear all your rx_buffer everytime of DMA transfer complete's ISR function, and reinit the dma, then next time of string like "hello" will be put there without "abcd" ahead. 

IFX_likunqiao_0-1698114385426.png

Again, how do you deal with your buffer "g_rxdata" depends on your application code. You could even create a task to periodically take data out.

Thanks

 

0 Likes