0
\$\begingroup\$

I am using MSP430 UART with DMA transfer for sending Modbus packets. As a master at the end of packer I need to change my RS 485 transceiver direction line for reception.
I am sending 10 bytes in packet and at the end of last byte sent I want to change direction line. But DMA interrupt occurs when byte count reaches to zero and not when last byte is transferred. Hence I change the line in DMA interrupt my last byte will not pass through transceiver.

\$\endgroup\$
  • \$\begingroup\$ Does the MSP430 have an interrupt which occurs after all of the bits have been shifted out of the UART buffer? If not, maybe you could use a timer which you start at the end of the DMA sequence and it then interrupts after the correct time delay to send that last byte. \$\endgroup\$ – brhans Jul 16 '15 at 13:52
  • \$\begingroup\$ @brhans A quick scan of one of the MSP430F series shows they may not all have an interrupt for USART TX Buffer empty, but the document does imply that all devices have a USART TX Buf Empty Flag that you can look at to make sure after a certain time-out. But I may be wrong, as I have never used an MSP430-series device myself. \$\endgroup\$ – Asmyldof Jul 16 '15 at 14:08
1
\$\begingroup\$

When the DMA has handled the last byte, you need to wait for the UART to be no longer busy (typically, this is indicated by the UCBUSY bit).

If your chip does not have an interrupt for that, you need to poll the bit, or use a timer that waits for 10 bit times.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.