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.

UART Communication Fail in CC2541 with Power Save Mode

Other Parts Discussed in Thread: CC2541

My project configuration is following:

1. HW Module: CC2541
2. BLE SW Stack Version: BLE-CC254x-1.3.2

Project Configuration:
-Power Save Mode, CC2541 wakes up by IO pin (P0_1) when it is pulled low
-UART 9600, No Flow Control, Transfer by DMA
-Defined Symbols listed as follows:

INT_HEAP_LEN=2900
HALNODEBUG
OSAL_CBTIMER_NUM_TASKS=1
HAL_AES_DMA=FALSE
HAL_DMA=TRUE
POWER_SAVING
xPLUS_BROADCASTER
HAL_LCD=FALSE
HAL_LED=TRUE
HAL_UART=TRUE
HAL_UART_DMA=2
xCC2540_MINIDK
DC_DC_P0_7

[Problem Description]
In Power Save mode, the UART communication is not workable. From our oscilloscope, we checked the UART Tx was no any signal. However, if disable Power Save funciton (xPOWER_SAVING), the UART communication (Tx/Rx) is workable.
We has tried to use power management functions, but the testing result was still failed.

(void)osal_pwrmgr_task_state(_uart_int_taskid, PWRMGR_HOLD);
(void)osal_pwrmgr_task_state(_uart_int_taskid, PWRMGR_CONSERVE);

If possible, please give us your experience or any idea about this issue.
Thank you very much.

 

  • Yuan-Fa,

    The UART module is disabled and powered down in PM2/3 used by the POWER_SAVING mode. You have to make sure you wake up the device before you start to communicate with the UART. Are you doing that?

    Peder

  • Hi Peder,

    The use case of our device (Host MCU + CC2541) is as follows:

    The CC2541 is waked up by IO pin (P0_1) first. After that, it starts to send out advertisement. The BLE Manager discovers and connects the CC2541 (as BLE Agent), a bluetooth connection is created. Next, a link up event is triggered from the BLE Stack kernel. Based on the link up event, the CC2541 starts to talk with the Host MCU via UART. But, the result was that we could not find any Tx or Rx signal.

    We made sure the CC2541 was waked up before it starts to communication the Host MCU via the UART interface. However, we could not make sure if the UART module is enabled or not at this time. Do you know how to check the UART module its status. Thank you in advance.

       

     

  • Hi Yuan-Fa,

    Thanks for the description. Please check the UxCSR register to see if the UART is enabled/active. Do you use HAL_UART? The next thing to check would be that the pins are correctly assigned to the UART module.

    Peder

  • Hi Peder,

    Thanks for your suggestion.

    We checked the U1CSR register in Power Saving Mode and found the following results.

    U1CSR=0xC0, in which Mode = 1, RE =1, Slave =0, FE =0, ERR =0, Rx_Byte=0, Tx_Byte=0, Active=0.

     

    In addition, we also checked the U1CSR register in xPower Saving Mode and found the following results.

    U1CSR=0xC2, in which Mode = 1, RE =1, Slave =0, FE =0, ERR =0, Rx_Byte=0, Tx_Byte=1, Active=0.

    And, we used the HAL_UART and the pins were assigned to the UART module correctly.

    Did you have any idea about the testing result?

     

  • Hi Peder ,

    Here i am facing problem with UART0-Alt2 (Using sensortag board Port-1 ; 4-Rx ,5-Tx , 3-RT , 2-CT) , connected sensortag board with PC using Serial-USB cable , Using UART-ISR method to implement method . My intension to interface ios device with PC ( Like Read data from hyperterminal to light blue app using Read characteristic , and Write data to hyperterminal using write characteristic) I succeed writing data to hyperterminal but when I tried to read data from hyperterminal continuoulsy i am reading 1st typed character only (means it's not taking 2nd character) if i tried to check the condition of Rx_Byte( like: while( !(U0CSR & U0CSR_RX_BYTE) ); it's taking 1st character when i try to type 2nd character the peripheral device is disconnecting from light blue app .( BLE connection losing) . below you can see my code for Receiver:


    void UART0_RECEIVE_ISR(uint8* uartRxBuffer , uint16 uartRxBufLength)
    {

    // Initialize the UART RX buffer index.
    uartRxIndex = 0;

    // Clear any pending UART RX Interrupt Flag (TCON.URXxIF = 0, UxCSR.RX_BYTE = 0).
    URX0IF = 0;

    // Enable UART RX (UxCSR.RE = 1).
    U0CSR |= U0CSR_RE;
    U0CSR &= ~U0CSR_TX_BYTE;

    // Enable global Interrupt (IEN0.EA = 1) and UART RX Interrupt (IEN0.URXxIE = 1).
    URX0IE = 1;
    EA = 1;
    }

    #pragma vector = URX0_VECTOR
    __interrupt void UART0_RX_ISR(void)
    {
    // Clear UART0 RX Interrupt Flag (TCON.URX0IF = 0).
    URX0IF = 0;

    // Read UART0 RX buffer.

    uartRxBuffer[uartRxIndex++] = U0DBUF; // continuosly reading 1st typed character

    // while( !(U0CSR & U0CSR_RX_BYTE) ); // if i use this condition it's causing for Loss of BLE connection

    if( uartRxIndex == UART_DATA_LENGTH) // here Rx buffer size and UART_DATA_LENGTH both are 3
    {
    uartRxIndex = 0;
    U0CSR &= ~U0CSR_RX_BYTE;
    UART_SetParameter(UART_READ ,UART_DATA_LENGTH, &uartRxBuffer); //sizeof(uint8)
    }

    }
  • Hello. Note that there is a working UART (with PM) example in the BLE Bridge project:

    processors.wiki.ti.com/.../SerialBLEbridge

    One thing to do (assuming you are using the default 1.4.0 TI drivers) is to ensure you are manipulating the CTS / RTS pins as required by the driver. These are used to wake up / put the device to sleep. If you are using your own pin to wake up the device, you will need to modify the driver.
  • Hi TIm C

    We tested with SerialBLEBridge that didn't work for us . I didn't see any output with that . I used Polling Method , in this case when I call Receive function anywhere in the program , the BLE is unable to make a connection .( Means the device is not connecting with the Lightblue app ) ....we using BLE-CC254x-1.4.0 drivers
  • Are you using the CTS / RTS lines? I've attached a capture of what communication should like (open with software from https://www.saleae.com/downloads) Can you verify that your handshaking is the same?


    /cfs-file/__key/communityserver-discussions-components-files/538/UART-PM-sample.zip

  • adding this port selection setup:

    	P0SEL = 0xFF; // Configure Port 0 as peripheral function
    	P1SEL = 0xFF; // Configure Port 1 as peripheral function
    	P2SEL = 0xFF; // Configure Port 2 as peripheral function

    before NPI_InitTransport(), made the SerialBLEBridge project produce Tx transmission, in response to 

    	static uint8 buf[64];
    	memset((void*)buf, 0,64);
    	while(1) { 
    		uint16 dataSent = NPI_WriteTransport( buf, 10 );
    	}