This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5659 DMA for transmitting via UART

I implemented transmitting data via UART using DMA. it works good.

I'm using single transfer.

I want to add the ability to pause and resume the DMA.

Can I simply use DMAEN=0 for suspend and DMAEN = 1 for resume?

after suspending and resuming the DMA, is it will continue transferring from the same source address and size it was at the suspend time?

  • As shown in figure 11-3, after DMAEN=0, the next transfer will restart from the beginning of the buffer.

    Table 11-2 shows that TXIFG does not trigger a transfer if TXIE is set. So you could enable the interrupt to pause DMA.

  • As shown in figure 11-3, after DMAEN=0, the next transfer will restart from the beginning of the buffer.

    [Itsik] - As I see, the size is not reset. I can use it for calculate the location of the next bytes to send - correct?

    Table 11-2 shows that TXIFG does not trigger a transfer if TXIE is set. So you could enable the interrupt to pause DMA.

    [Itsik] - Yes, but I will have to deal with interrupt handler because it is not promise that I will success to reset the TXIFG after setting the TXIE before the interrupt handler will called. So it looks like little tricky.

    If the 1st solution is acceptable I prefer it.

  • As shown in figure 11-3, the size is reset.

  • When byte is sent, according to the button state, the register is decremented (Decrement DMAxSZ) and not the local variable (T_Size).

    When the DMAEN is reset, the leftmost arrow takes me to the 'Reset' state (Is this state is reset the size register?) then setting back the DMAEN the (DMAxSZ -->T_Size ) register is setting the local value.

    So where the size register is reset if the DMA is disabled?

    Quota from datasheet:

    DMAEN is automatically cleared when DMAxSZ transfers have been made.

    According to the datasheet, the DMAEN is reset when the size arrived to zero and not the opposite direction.

  • You are correct; DMAxSZ is reset only when it has reached zero.
  • For sum up:

    Suspend will be implemented by DMAEN = 0;

    Resume will be implemented by:

    1) calculating the source address using the DMAxSZ value.

    2) DMAEN = 1;

    3) DMAxSZ with no change.

    Can you confirm?

  • I can tell you what I've read in the documentation. To find out how the MCU executes your code, you must let the MCU execute your code.

**Attention** This is a public forum