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.

Please help current consumption with uart

Other Parts Discussed in Thread: CC2540

Hello.

I'm trying to develop some device with cc2540.

I wrote down the UART driver that using usart1 (alt.1)

and I copied SPI driver that is included in ble stack (usart/spi alt2 with cma3000d)

But there's current consumption problem.

the init codes are below 

--- UART1 ---

void SetUART1(int mode){
switch(mode){
case ON:
PERCFG = 0x00;

U1CSR = 0x80; // UART mode with idle status
U1GCR = 0x0B; // LSB first
U1BAUD = 0xD8; // BAUD 115,200
U1CSR |= 0x40; // Enable Receive

// P2DIR |= PIN6; // Highest Priority for UART1 on Port0


P0SEL |= (PIN4 | PIN5); // Peripheral for RXD/TXD
P0DIR &= ~PIN5; // INPUT for RXD

P0 |= (PIN3 | PIN4); // Turn on Bluetooth Power

break;
case OFF:
PERCFG = 0x00;

P0DIR |= PIN5;
P0INP |= (PIN4 | PIN5);
P0SEL &= ~(PIN4 | PIN5);

U1CSR = 0x00;

P0 &= ~(PIN3 | PIN4);
break;
default:
break;
}
}

--- SPI ---
void SetAcc(int mode){
switch(mode)
{
case ON:

/*** Setup the CMA3000d interface ***/

//*** Setup the SPI interface ***
// SPI master mode

U0CSR = 0x00;
// Negative clock polarity, Phase: data out on CPOL -> CPOL-inv
// data in on CPOL-inv -> CPOL
// MSB first
U0GCR = 0x20;
// SCK frequency = 480.5kHz (max 500kHz)
U0GCR |= 0x0D;
U0BAUD = 0xEC;


PERCFG = 0x01;

P1INP &= ~(PIN2 | PIN3 | PIN4 | PIN5);
P1SEL |= (PIN3 | PIN4 | PIN5);
P1DIR &= ~(PIN4);

CS = CS_DISABLED;

P1 |= PIN1;

uint8 readValue;
accWriteReg(CTRL, RANGE_2G | MODE_100HZ_MEAS);
WAIT_1_3US(80);
do{
accReadReg(STATUS, &readValue);
WAIT_1_3US(80);
}while(readValue & 0x08);


break;
case OFF:
PERCFG = 0x00;

P1INP |= (PIN2 | PIN3 | PIN4 | PIN5);
P1SEL &= ~(PIN3 | PIN4 | PIN5);
P1DIR |= PIN4;

CS = 0;

P1 &= ~PIN1;
break;
default:
break;
}
}

When I tried to enter the sleep mode, SPI interface turned off well.

But UART1 has problem. 
# Situation 1
If I don't set the high priority of uart1 on port0, uart1 doesn't works. tx is works but rx is not. even the interrupt doesn't comes
#Situation 2
If I set the high priority of port0 uart1 on port0, uart1 works fine. but when i tried to enter, current consumption is going up to 2.6mA.
Is there any problem in turn off routine of uart1 ?

sorry for my bad English. Please help me sirs.