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.

编译器/ MSP430FR5949:UCA0TXIFG No trigger DMA

Part Number: MSP430FR5949

Tool/software: TI C / C ++编译器

Unable to enter DMA_ISR  interrupt !

void Init_UART0(u32 bd){

P2SEL1 |= BIT0 | BIT1;
P2SEL0 &= ~(BIT0 | BIT1); // 
// Configure USCI_A0 for UART mode
UCA0CTLW0 = UCSWRST; // Put eUSCI in reset
UCA0CTLW0 |= UCSSEL__ACLK; // SMCLK = ACLK
switch(bd)
{
case 1200://1200
UCA0BR0 = 0x01; //接收改用1200波特率
UCA0BR1 = 0x00;
UCA0MCTLW = UCOS16+ UCBRF_11;
break;

}
UCA0CTLW0 &= ~UCSWRST; // Initialize eUSCI
UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt

}

void UART_DMA_init(u8 len)
{

//UCA0IE &= ~UCTXIE;
DMACTL0 = DMA0TSEL__UCA0TXIFG;
DMA0CTL |= DMADT_1| DMADSTBYTE|DMASRCBYTE| DMADSTINCR_0 | DMASRCINCR_3;
DMA0SZ = len;
__data16_write_addr((unsigned short) &DMA0SA,(unsigned long) &Usart.Tx_Buf[0]);//
__data16_write_addr((unsigned short) &DMA0DA,(unsigned long) &UCA0TXBUF);
DMA0CTL |=DMAIE|DMAEN;//

}

#pragma vector=DMA_VECTOR
__interrupt void DMA_ISR(void)
{


switch(__even_in_range(DMAIV, 6))
{
case DMAIV_NONE:break; // Vector 0: No interrupt
case DMAIV_DMA0IFG:
{
DMA0CTL &=~(DMAEN+DMAIE);
}break;
case DMAIV_DMA1IFG:
{

}break;
case DMAIV_DMA2IFG: break;
default: break;
}


}

  • Hi Shang,

    Are you enabling the global interrupt enable bit? Just want to double check since I don't see it in the code you provided.

    Also, here is a link to example code for the FR5949 device. You will find a DMA example. It doesn't use interrupts, but it might be a good reference to see how the peripheral is set up:

    Please let me know if you continue to have issues/questions.

    Thanks,

    Mitch

  • Hi, Mitch

    I enabling the global interrupt enable bit.I only show part of the code.The UART module sending data without DMA function is normal.

  • With DMALEVEL=0, you need a rising edge to trigger the DMA. So:

    1) Use DMALEVEL=1 or

    2) Explicitly write the first byte to TXBUF to get the sequence going.

    (I admit I never much liked (1) since TXIFG isn't properly a "level" but it always seems to do the right thing, and it's by far the simpler of the two.)

  • HI,

    You always know what I want to do.As a matter of fact, I have just discovered this problem and solved it

    DMA1CTL |= DMADT_4| DMADSTBYTE|DMASRCBYTE| DMALEVEL|DMASRCINCR_3|DMADSTINCR_0;

    thank you very mucn.

**Attention** This is a public forum