comsosysarch

UART transfers blocked when MODEM reg enables RTS & CTS

Discussion created by comsosysarch on Jun 26, 2012
Latest reply on Jun 5, 2013 by Kari Piipponen

Many thanks in advance for looking at this.

 

K60 144-pin QFP 100 MHz device, external crystal clocked at 50 MHz.

 

My UART reception is handled by interrupt and I am not worried about that yet. I am having trouble with the transmit side getting started.

 

My UART transmissions are being handled by DMA (because mostly they involve huge blocks). They are fine when the MODEM register is at its default value and hardware (RTS/CTS pin) flow control is disabled. When I build the application with the MODEM register set to enable RTS & CTS then my DMA channel hangs and my little initial "Hello World!" message never gets sent. Same problem on UART0 and UART4.

 

The actual hardware levels of the flow control are both approx 0 Vdc so these active-low signals should be enabling transmission.

 

I had a nearly identical project on this same chip where we had the same problem but it was a UART connected to a FTDI USB chip and it would only hang like this if the USB was plugged in during boot. Apparently resetting the USB during boot would work around this but mean the USB cable would have to be re-plugged.

 

Anyhow, except for that one case it used to work. Now on this project I am having the UART DMA transmit block "hang" every time regardless of whether the USB cable is plugged in.

 

So... I am thinking there is some order of configurations that I am not performing correctly.

 

Has anyone else had a problem like this? Is there some chip errata I am missing? Or do you see something I am doing out of sequence?

 

The relevant part of my UART setup code pared down to keep it readable...

 

unsigned short sbr = EXTAL_CLOCK_FREQ / (baud << 4);unsigned char brfdX32 = ((EXTAL_CLOCK_FREQ << 1) + (baud >> 1)) / baud - (sbr << 5);pUART->BDH = sbr >> 8;pUART->BDL = sbr & 0x00ff;pUART->C4 = brfdX32 & 0x1f;pUART->MODEM = 0x0f & (UART_MODEM_TXCTSE_MASK | UART_MODEM_RXRTSE_MASK) & ~(UART_MODEM_TXRTSE_MASK | UART_MODEM_TXRTSPOL_MASK); // 0x09pUART->C5 = UART_C5_TDMAS_MASK;pPort->PCR[RxPortBit] = PORT_PCR_MUX(3);pPort->PCR[TxPortBit] = PORT_PCR_MUX(3) | PORT_PCR_DSE_MASK;pPort->PCR[CTSportBit] = PORT_PCR_MUX(3);pPort->PCR[RTSportBit] = PORT_PCR_MUX(3) | PORT_PCR_DSE_MASK;startNVIC(RxIRQnum, RxIRQpriority); // this enables the interrupt for the receiverpUART->C2 = UART_C2_RIE_MASK | UART_C2_TE_MASK | UART_C2_RE_MASK;// that is all for the initialization// then when I transmit a block I set up the DMA channel for the particular transmit block// and finally...pUART->C2 |= UART_C2_TIE_MASK;

 

Outcomes