USART Transmit using PDCA

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

I had a problem that has been bugging me the last few days. I would start a USART transmit using dma with the AVR32_PDCA_IER_TRC_MASK set so I get an interrupt when it's complete.

When I got that I disabled that interrupt and set a flag to let a thread run that could start a new transfer quite quickly. What I found is that if it did this one byte of transmit data was lost.

Maybe it should have been obvious to me, but eventually I tried the following and it worked:

1) When the PDCA transfer complete is received disable it and then enable the USART's AVR32_USART_IER_TXEMPTY_MASK.
2) When the TXEMPTY interrupt is received that means the USART is completely idle. Disable the TXEMPTY interrupt and a new transfer can now be done.

Bob

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

Hello,
I did also some USART transmission with PDCA. I used a queue for all the blocks which I want to send. With the first block I enable interrupts by = .ier = AVR32_PDCA_IER_TRC_MASK | AVR32_PDCA_IER_RCZ_MASK;
The PDCA interrupt checks for both flags and turns off the corresponding interrupt if nothing more to send. I never have lost any byte. But I don't use threads.