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.

CC1110-CC1111: Setting USART1 for UART Alt1

Part Number: CC1110-CC1111
Other Parts Discussed in Thread: CC2530

This is the composition.

P0_2 RX0

P0_3 TX0

P0_4 TX1

P0_5 RX1

Im using the CC2530 As is the case 

TX data is well shown in P0_3, but no data is available on the interrupt receiving it. 

why?


void InitUart(byte port, short speed)
{

if (port==0)

{

PERCFG &= ~0x01; //Alernative 1 selected for UART0 peripheral.
P0SEL |= BIT2 | BIT3; //P0.2 and P0.3 peripheral mode enabled.

U0CSR |= 0x80; //UART mode selected for USART0.

if (speed == HAL_UART_BR_57600 ||
speed == HAL_UART_BR_115200)
{
U0BAUD = 216;
}
else
{
U0BAUD = 59;
}

switch (speed)
{
case HAL_UART_BR_9600:
U0GCR = 8;
break;
case HAL_UART_BR_19200:
U0GCR = 9;
break;
case HAL_UART_BR_38400:
case HAL_UART_BR_57600:
U0GCR = 10;
break;
default:
U0GCR = 11;
break;
}

//U0GCR |= 11; // 115,200 57,600 =>10 9600=> 0x08;
//U0BAUD = 216; // 57,600 =>216 9600=> 0x3B; //Baud rate set to 9600 bps.

//P0SEL |= 0x0C; //P0.2 and P0.3 peripheral mode enabled.
U0CSR |= CSR_RE;
IEN0 |= 0x04; // URX0IE = 1;

//U0DBUF = 0; // Prime the ISR pump.

isrCfg0.rxHead =0; isrCfg0.rxTail=0;
}
else if (port==1)
{
PERCFG &= ~0x02; //Alernative 1 selected for UART1 peripheral.

P0SEL |= BIT4 | BIT5;; //P0.4 and P0.5 peripheral mode enabled.

U1CSR |= 0x80; //UART mode selected for USART0.


if (speed == HAL_UART_BR_57600 ||
speed == HAL_UART_BR_115200)
{
U1BAUD = 216;
}
else
{
U1BAUD = 59;
}

switch (speed)
{
case HAL_UART_BR_9600:
U1GCR = 8;
break;
case HAL_UART_BR_19200:
U1GCR = 9;
break;
case HAL_UART_BR_38400:
case HAL_UART_BR_57600:
U1GCR = 10;
break;
default:
U1GCR = 11;
break;
}
//U1CSR |= 0x80; //UART方式
//U1CSR |= CSR_RE;
//U1GCR |= 11; //115200 => 11; 9600 => 8; //baud_e
//U1BAUD = 216; // 57,600=>216; // 9600 => 0x3b; //波特率??57600
//UTX1IF = 1;
U1CSR |= CSR_RE;
IEN0 |= 0x08; // URX1IE = 1;

//U1DBUF = 0; // Prime the ISR pump.

//isrCfg1.rxHead =0; isrCfg1.rxTail=0;


}

halMcuWaitUs(100);

EA = 1;
}

HAL_ISR_FUNCTION( halUart0RxIsr, URX0_VECTOR )
{
uint8 tmp = U0DBUF;

//dbg_printf("%02X ", tmp);
isrCfg0.rxBuf[isrCfg0.rxTail++] = tmp;
isrCfg0.rxTail %= (HAL_UART_ISR_RX_MAX) ;

}