XMEGA DMA UART strange

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear Everybody!

 

Atxmega256 + DMA + UART transmission.

 

I recognize strange operation.

Everything is works fine except, DMA lost the 4th byte of a transmission.

Its independent from UART speed, and lost just the 4th byte every time.

DMA work in single shot mode, brust len is 1, no reload.

 

Thanks for any advise.

This topic has a solution.
Last Edited: Fri. Oct 27, 2017 - 07:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One more additional information.

 

I use 16MHz quartz clock for CPU and all pehriph including DMA.

This can result some kind of memory access collision, and maybe cause this lost?

Then why just the 4th byte?

 

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Without knowing precisely how you have the device configured, it will be difficult to diagnose the source of the problem.

Can you post a (minimal) complete (and compilable) program that demonstrates the problem?

Often reducing the code to a bare minimum reveals the problem...

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear David!

 

My hope was, somebody meet before this problem, but looks like not.

Now atxmega DMA transmit work with workaround.

 

If I has time, then I develop and provide you a demonstrate code, and maybe found cause of problem. 

But do not forget, I can’t post you 16M quartz driven atxmega hardware.

 

Thank you for your kindness.

 

Kzsolt

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

So Guys, have cause and solution.

 

According example, DMA be must set to trigger by DRE of USART. After DMA setup, DMA must enabled and then single block transfer must initiated by TRFREQ of DMA.

But DRE of USART itself trigger DMA transfer. After (re)trigger by TRFREQ is result overwrite of transmitted character in USART data register.

 

In my case the 4th byte was overwritten by TRFREQ.

 

wink The solution, must NOT trigger USART’s DMA transfer using TRFREQ, because USART DRE flag do it. Just need to enable DMA channel with single transfer mode, and the “data hungry” USART trigger the transfer itself.