# msp430 DMA UART for Modbus

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.

• 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. – brhans Jul 16 '15 at 13:52
• @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. – Asmyldof Jul 16 '15 at 14:08

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).