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.

UART0 Alt.2 while using SimpleBLEPeripheral_UART on CC2541

Other Parts Discussed in Thread: CC2541

Hello,

I am facing a problem while trying to operate UART0 Alt2 (Port#1) on CC2541 using a modified version of this serial interface project: http://processors.wiki.ti.com/index.php/SimpleBLEPeripheral_SerialInterface

I am using the following pre-processor defs:

INT_HEAP_LEN=3072
HALNODEBUG
OSAL_CBTIMER_NUM_TASKS=1
HAL_AES_DMA=TRUE
HAL_DMA=TRUE
POWER_SAVING
xPLUS_BROADCASTER
HAL_LCD=FALSE
HAL_LED=FALSE
SERIAL_INTERFACE
HAL_UART
HAL_UART_DMA=3
HAL_UART_ISR=0
HCI_UART_BR=4
HAL_KEY=FALSE


Where "HAL_UART_DMA=3" is a new option I added to select UART0 Alt2, and set Port1 priority to UART0 ahead of UART1 and Timer1.

The problem is that, when I start debugging the code, it gets stuck on the line:

SimpleProfile_SetParameter( SIMPLEPROFILE_CHAR5, SIMPLEPROFILE_CHAR5_LEN, charValue5 );

inside the function: "SimpleBLEPeripheral_Init( taskID );"

While the dis-assembly log gets stuck at: "HalUARTOpen::?relay:"


So I was wondering if there is any interference with the UART DMA process and the SimpleBLE functions.

Any ideas what could be the problem?


Thank you in advance,

  • There should be no conflict between the SimpleProfile and the UART process. I suspect this might be due to some configuration issue. Are you debugging with optimizations turned off? Sometimes this helps.

  • Thank you. I will give it a try and I will let you know.

  • Hi Willis1 ,

    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)
    }

    }
  • Hi

  • Yes ... Thank you Bassel ,

    But how the power saving effects UART ?
  • Using POWER_SAVINGS means that you need to also use the CTS / RTS pins in the UART driver to control power management. Please see the following thread for a logic capture of what this should look like:

    e2e.ti.com/support/wireless_connectivity/f/538/p/326027/1447336#1447336
  • Hi Tim C

    I am using sensortag for UART , Normally I got output ( No problem with Receiving and Transmitting) but when it comes to Hardware flow control enabled I am not seeing any data on Serial Terminal ( Putty ).

    I connected sensortag RTS pin(P1_3) -> Serial cable CTS
    sensortag CTS pin (P1_4) -> Serial cable RTS

    Below are my port configurations

    PERCFG = 0x01;
    P1SEL = 0x3C;
    P1 = 0x3C;
    P1DIR = 0x3C;
    P2SEL = 0x20;

    Baud rate = 9600
  • Is flow control enabled in the cc254x project? It will be enabled by default if POWER_SAVINGS is defined. The terminal application's "hardware flow control" is not the same as the flow control used by the cc254x UART driver. You need to toggle the CTS and RTS pins as described in the thead from my previous post.

    The terminal application you are using will not be doing this. So essentially the UART driver does not support the hardware flow control of this terminal application.  Some terminal applications can get this to work by always holding the RTS line low. This defeats the purpose of using flow control and also prevents the CC254x from going to sleep.

    ***The only way to use flow control and allow power management is to follow the handshaking method from the logic capture included in thread from my previous post.

    Also, there is an example of a cc254x project using UART with PM (power management) / flow control (these are essentially the same) in the UART_PM configuration of the serial-to-BLE bridge:

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