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.

How to use two UART ports at CC2530

Other Parts Discussed in Thread: CC2530, CC2540

Dear Friends,

I want to use two UART ports at CC2530, I regad the following code, if I use  HalUARTOpen (HAL_UART_PORT_0, &uartConfig); the function is right. but if I use HalUARTOpen (HAL_UART_PORT_1, &uartConfig); to configure UART,
I can't receive or send data at UART1.

So, how to configure two UART, please help. urgent. thanks.

void initUart(halUARTCBack_t pf)
{
   halUARTCfg_t  uartConfig;
 
  uartConfig.configured           = TRUE;              
  uartConfig.baudRate             = HAL_UART_BR_38400;
    
  uartConfig.flowControl          = FALSE;
  uartConfig.flowControlThreshold = 156;
  uartConfig.rx.maxBufSize        = 1024;
  uartConfig.tx.maxBufSize        = 1024;    
  
  uartConfig.idleTimeout          = 255;         
  uartConfig.intEnable            = TRUE;                
  uartConfig.callBackFunc         = pf;


  // HalUARTOpen (HAL_UART_PORT_0, &uartConfig);
  HalUARTOpen (HAL_UART_PORT_1, &uartConfig);
}

Best Regard. Yihua

  • Hi,

    Before investigating why UART1 "isn't working properly",

    can you please elaborate a little bit more how exactly you connect serial cable

    to cc2530?

    Is it possible that some other device using UART1 pins and driving'em?

    You can also try to look for an answer in the following design note

  • Hi Igor,

    I use UART as:

    UART0 -- P0_2(RX), P0_3(TX) ,    UART1 -- P1_6(TX), P1_7(RX),  and these pins are not used by other function.

    In this project, we will use two UART ports to connect two UART device, I find, in UART0, all the function is right, but at UART1, software can't open it, I added some code befor open UART1 as follow:

      PERCFG = PERCFG | 0x02;                 //Set Uart1 at Alt2
      P1SEL = P1SEL | 0xC0;                        //Set P1_6 and P1_7 as Extention Device IO;
      P1DIR = P1DIR | 0x40;                         //Set P1_6 as Output;
      P1DIR = P1DIR & 0x7F;                       //Set P1_7 as Input;
      HalUARTOpen (HAL_UART_PORT_1, &uartConfig);

    that also can't open UART1, I regard at hal_uart.c,

    uint8 HalUARTOpen(uint8 port, halUARTCfg_t *config)
    {
      (void)port;
      (void)config;
     
    #if (HAL_UART_DMA == 1)
      if (port == HAL_UART_PORT_0)  HalUARTOpenDMA(config);
    #endif
    #if (HAL_UART_DMA == 2)
      if (port == HAL_UART_PORT_1)  HalUARTOpenDMA(config);
    #endif
    #if (HAL_UART_ISR == 1)
      if (port == HAL_UART_PORT_0)  HalUARTOpenISR(config);
    #endif
    #if (HAL_UART_ISR == 2)
      if (port == HAL_UART_PORT_1)  HalUARTOpenISR(config);
    #endif
    #if (HAL_UART_USB)
      HalUARTOpenUSB(config);
    #endif
     
      return HAL_UART_SUCCESS;
    }

    seem above code not support UART1. please give more help, thanks.

    Best Regard. Yihua

  • hi,

    you need to define HAL_UART_ISR=2 in project options, C/C++ compiler pre-processors settings. then you can use UART1.

  • Hi,

    In my project, I also use two uarts. The source code uses to initialized UART0 (P0_2/P0_3) is as the following:

    void initUart(halUARTCBack_t pf)
    {
      halUARTCfg_t uartConfig;
      uartConfig.configured           = TRUE;
      uartConfig.baudRate             = HAL_UART_BR_19200;
      uartConfig.flowControl          = FALSE;
      uartConfig.flowControlThreshold = 48;
      uartConfig.rx.maxBufSize        = 128;
      uartConfig.tx.maxBufSize        = 128;
      uartConfig.idleTimeout          = 6;   
      uartConfig.intEnable            = TRUE;              
      uartConfig.callBackFunc         = pf;
      HalUARTOpen (HAL_UART_PORT_0, &uartConfig);
    }

    And, the followings are the source code that use to initialized UART1 (P1_6/P1_7)

    void initUart1(halUARTCBack_t pf)
    {
      halUARTCfg_t uartConfig;
      uartConfig.configured           = TRUE;              
      uartConfig.baudRate             = HAL_UART_BR_115200;
      uartConfig.flowControl          = FALSE;
      uartConfig.flowControlThreshold = 48;
      uartConfig.rx.maxBufSize        =128;
      uartConfig.tx.maxBufSize        = 128;
      uartConfig.idleTimeout          = 6;   
      uartConfig.intEnable            = TRUE;              
      uartConfig.callBackFunc         = pf;
      HalUARTOpen (HAL_UART_PORT_1, &uartConfig);
    }

    I don't do anything special. Just wondering that is it possible that your TX/RX is revered. Do you want to change your HW from P0_2(RX)/P0_3(TX)  to P0_2(TX) and P0_3(RX)?

    Regards!

  • If you want to test UART on CC2530, try this echo example:

    #include "ioCC2530.h"
    //..............................................................................
    void initUART(void) //sets all configurations in UART
    {
    CLKCONCMD = CLKCONSTA & 0xB8; //clock control
    while(CLKCONSTA & 0x40);

    PERCFG&=~0x01; //Alernative 1 selected for UART0 peripheral.
    P0SEL |= 0x0C; //P0.2 and P0.3 peripheral mode enabled.
    U0CSR |= 0xC0; //UART mode selected for USART0.
    U0UCR |= 0x00; //H/w flow control disabled
    U0GCR |= 0x08;
    U0BAUD = 0x3b; //Baud rate set to 9600 bps 
    }
    //..............................................................................
    char receive (void) 
    {
    URX0IF = 0;     //interrupt flag
    while (!URX0IF ); 
    U0DBUF; //USART 0 Receive/Transmit Data Buffer
    URX0IF = 0;
    return U0DBUF;
    }
    //..............................................................................
    void send(unsigned char c) 

    UTX0IF = 0; 
    U0DBUF=c; 
    while (!UTX0IF); 
    UTX0IF = 0; 
    }
    //..............................................................................
    void main()

    initUART(); 

    while(1)
    {
    unsigned char uartdat;
    uartdat=receive();
    send(uartdat);
    }
    }

    Tested on:

    CC2530 Development Kit;

    IAR Workbench for 8051 v 7.60.1;

    PuTTY Terminal

  • void initUart(halUARTCBack_t pf)
    {
      halUARTCfg_t uartConfig;
      uartConfig.configured           = TRUE;
      uartConfig.baudRate             = HAL_UART_BR_19200;
      uartConfig.flowControl          = FALSE;
      uartConfig.flowControlThreshold = 48;
      uartConfig.rx.maxBufSize        = 128;
      uartConfig.tx.maxBufSize        = 128;
      uartConfig.idleTimeout          = 6;   
      uartConfig.intEnable            = TRUE;              
      uartConfig.callBackFunc         = pf;
      HalUARTOpen (HAL_UART_PORT_0, &uartConfig);
    }

    And, the followings are the source code that use to initialized UART1 (P1_6/P1_7)

    void initUart1(halUARTCBack_t pf)
    {
      halUARTCfg_t uartConfig;
      uartConfig.configured           = TRUE;              
      uartConfig.baudRate             = HAL_UART_BR_115200;
      uartConfig.flowControl          = FALSE;
      uartConfig.flowControlThreshold = 48;
      uartConfig.rx.maxBufSize        =128;
      uartConfig.tx.maxBufSize        = 128;
      uartConfig.idleTimeout          = 6;   
      uartConfig.intEnable            = TRUE;              
      uartConfig.callBackFunc         = pf;
      HalUARTOpen (HAL_UART_PORT_1, &uartConfig);
    }

    I don't do anything special. Just wondering that is it possible that your TX/RX is revered. Do you want to change your HW from P0_2(RX)/P0_3(TX)  to P0_2(TX) and P0_3(RX)?

    and change the Compile options ->C/C++ Compiler-> Preprocessor and Copy these lines in it.

    HAL_UART=TRUE
    HAL_UART_ISR=1
    HAL_UART_DMA=2

    Two uarts will start working

    thanks and Regards 

    Manish

     

  • Hello Yikai Chen,

    Sir,

    I am writting an application where I am using SerialApp my purpose is to take some data from the serial port (of Coordinator) and send it through RF to Router where I decode the data in switch case and based on some logic I am writting the data on different serial ports

    switch(pkt->cmd.Data[3])
    {
    case(0x41):
    if ( HalUARTWrite( SERIAL_APP_PORT, pkt->cmd.Data+1, (pkt->cmd.DataLength-1) ) )
    {
    // Save for next incoming message
    SerialApp_RxSeq = seqnb;
    stat = OTA_SUCCESS;
    }
    else
    {
    stat = OTA_SER_BUSY;
    }
    break;
    case(0x42):
    if ( HalUARTWrite( HAL_UART_PORT_1, pkt->cmd.Data+1, (pkt->cmd.DataLength-1) ) )
    {
    // Save for next incoming message
    SerialApp_RxSeq = seqnb;
    stat = OTA_SUCCESS;
    }
    else
    {
    stat = OTA_SER_BUSY;
    }
    break;
    default:
    break;
    }

    but only one UART is receiving the data I dont know this is happening but, when I am not using RF means only coordinator I am able to see Both UART working 

    Will UART second work or not with RF if yes please tell me how to make it work 

    thanks and regards 

    Manish

  • Hi Manish,

    Yes, It can work well with RF together. However, I can't see the problem why you can't make it work.

  • Hello Yikai Sir,

    I am sending you the code analyze and let me know why it is not working.Or  I have to make any Compile option changes    3463.Source.zip please find the attachment and let me know if i need to do any thing else.

    if yes then also let me know if no then please tell me where I am wrong.

    thanks and regards

    Manish 

  • If you don't trigger SERIALAPP_RESP_EVT in your application, does both of your UARTs work?

  • Hi,

    Lets say I only care about the TX of the UART, then how many thing are there which doesn't need to be taken care of ? i.e what should be the code ?

    Also HAL_UART_PORT_0, corresponds to which port on the ZigBee board ? how would I get to know it ? 

    Thanks

  • Hi sumit,

    Even you only care TX, it almost the same to enable UART. The only difference is that you don't have to implement RX callback function.

  • Okay. 

    halUARTCfg_t uartConfig;
    // SerialApp_TaskID = task_id;
    SerialApp_RxSeq = 0xC3;

    //afRegister( (endPointDesc_t *)&SerialApp_epDesc );
    afRegister( (endPointDesc_t *)&SampleApp_epDesc );

    RegisterForKeys( task_id );

    uartConfig.configured = TRUE; // 2x30 don't care - see uart driver.
    uartConfig.baudRate = HAL_UART_BR_115200;
    uartConfig.flowControl = FALSE;
    uartConfig.flowControlThreshold = 64; // 2x30 don't care - see uart driver.
    uartConfig.rx.maxBufSize = 128; // 2x30 don't care - see uart driver.
    uartConfig.tx.maxBufSize = 128; // 2x30 don't care - see uart driver.
    uartConfig.idleTimeout = 6; // 2x30 don't care - see uart driver.
    uartConfig.intEnable = TRUE; // 2x30 don't care - see uart driver.
    uartConfig.callBackFunc = pf;
    HalUARTOpen (HAL_UART_PORT_0, &uartConfig);
    -----------------------------------------------------------------------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------------------------------------------------------------------
    What is the pf in the callback function, Is it null type function or is it the call back funtion with the name pf. 

    In my case can I put pf for call back function option?

    Also after writing the above code. uptill HALUARTOPEN(); 
    Do I only need to put the UART write code line, In order to wrtite some data to the uart pin? 
    HalUARTWrite( SERIAL_APP_PORT, pkt->cmd.Data+1, (pkt->cmd.DataLength-1) ); 
    Or 
    I need to write some more code, logically it seems correct just opening the UART and writing something to it's port.

    Now Here is one code part of the serialApp Example: 
    -------------------------------------------------------------------------------------------------------------------------------------------------------
    -------------------------------------------------------------------------------------------------------------------------------------------------------void SerialApp_ProcessMSGCmd( afIncomingMSGPacket_t *pkt )

    {
    uint8 stat;
    uint8 seqnb;
    uint8 delay;

    switch ( pkt->clusterId )
    {
    // A message with a serial data block to be transmitted on the serial port.
    case SERIALAPP_CLUSTERID1:
    // Store the address for sending and retrying.
    osal_memcpy(&SerialApp_RxAddr, &(pkt->srcAddr), sizeof( afAddrType_t ));

    seqnb = pkt->cmd.Data[0];

    // Keep message if not a repeat packet
    if ( (seqnb > SerialApp_RxSeq) || // Normal
    ((seqnb < 0x80 ) && ( SerialApp_RxSeq > 0x80)) ) // Wrap-around
    {
    // Transmit the data on the serial port.
    if ( HalUARTWrite( SERIAL_APP_PORT, pkt->cmd.Data+1, (pkt->cmd.DataLength-1) ) )
    {
    // Save for next incoming message
    SerialApp_RxSeq = seqnb;
    stat = OTA_SUCCESS;
    }
    else
    {
    stat = OTA_SER_BUSY;
    }
    }
    else
    {
    stat = OTA_DUP_MSG;
    }

    // Select approproiate OTA flow-control delay.
    delay = (stat == OTA_SER_BUSY) ? SERIALAPP_NAK_DELAY : SERIALAPP_ACK_DELAY;

    // Build & send OTA response message.
    SerialApp_RspBuf[0] = stat;
    SerialApp_RspBuf[1] = seqnb;
    SerialApp_RspBuf[2] = LO_UINT16( delay );
    SerialApp_RspBuf[3] = HI_UINT16( delay );
    osal_set_event( SerialApp_TaskID, SERIALAPP_RESP_EVT );
    osal_stop_timerEx(SerialApp_TaskID, SERIALAPP_RESP_EVT);
    break;

    // A response to a received serial data block.
    case SERIALAPP_CLUSTERID2:
    if ((pkt->cmd.Data[1] == SerialApp_TxSeq) &&
    ((pkt->cmd.Data[0] == OTA_SUCCESS) || (pkt->cmd.Data[0] == OTA_DUP_MSG)))
    {
    SerialApp_TxLen = 0;
    osal_stop_timerEx(SerialApp_TaskID, SERIALAPP_SEND_EVT);
    }
    else
    {
    // Re-start timeout according to delay sent from other device.
    delay = BUILD_UINT16( pkt->cmd.Data[2], pkt->cmd.Data[3] );
    osal_start_timerEx( SerialApp_TaskID, SERIALAPP_SEND_EVT, delay );
    }
    break;

    default:
    break;
    }
    }
    -------------------------------------------------------------------------------------------------------------------------------------------------------
    -------------------------------------------------------------------------------------------------------------------------------------------------------

    Do I need to implement such function If I want simply to write a character to the uart port just for testing the uart port.

    I mean I want to make a variable in my which has character data.
    Now set a timer for 1 sec & any time. 
    When ever the timer event happens I use the command 
    HalUARTWrite( SERIAL_APP_PORT, pkt->cmd.Data+1, (pkt->cmd.DataLength-1) ); 
    Instead of pkt->cmd.data+1 i will use some data.

    Now the configuration of the uart is done in the initialization function & HALUARTWRITE is used at the time of the event. Will this be enough to write a character at uart port ?

  • 1.pf means function pointer for callback function that handles reeiving.

    2. After HALUARTOPEN(), you can use HalUARTWrite to send data.

  • Hi,

    Thanks a lot.
    I need to ask you one more really important thing.

    I am trying to Display the RSSI value by extracting it from the received packet using the code:
    unsigned char* Recv_RSSI = (unsigned char*)pkt->rssi;
    HalUARTWrite ( HAL_UART_PORT_0, Recv_RSSI, 1 );

    But on the realterm I am receiving only FF value always. 
    The RSSI value doesn't change it only displays FF.

  • Hi sumit,

    Try the following revisions:

    unsigned char Recv_RSSI = pkt->rssi;
    HalUARTWrite ( HAL_UART_PORT_0, &Recv_RSSI, 1 );

  • Thanks a Lot, I will try it & let you know. 

    Anyway there is one more issue.

    RSSI value is a positive value, but in the pkt format it is given as a int8 type variable.
    Now when I am displaying the values using my realterm, Should I put display option as int8 or uint8 ?
    Because when I put it int8 the values are negative also, which is unexpected. 
    Here is the afIncomingMSGPacket_t : 

    typedef struct
    {
    osal_event_hdr_t hdr; /* OSAL Message header */
    uint16 groupId; /* Message's group ID - 0 if not set */
    uint16 clusterId; /* Message's cluster ID */
    afAddrType_t srcAddr; /* Source Address, if endpoint is STUBAPS_INTER_PAN_EP,
    it's an InterPAN message */
    uint16 macDestAddr; /* MAC header destination short address */
    uint8 endPoint; /* destination endpoint */
    uint8 wasBroadcast; /* TRUE if network destination was a broadcast address */
    uint8 LinkQuality; /* The link quality of the received data frame */
    uint8 correlation; /* The raw correlation value of the received data frame */
    int8 rssi; /* The received RF power in units dBm */
    uint8 SecurityUse; /* deprecated */
    uint32 timestamp; /* receipt timestamp from MAC */
    uint8 nwkSeqNum; /* network header frame sequence number */
    afMSGCommandFormat_t cmd; /* Application Data */
    } afIncomingMSGPacket_t;

    In the AF file of Zstack.

    Now Here is the display by Real term in the two cases:

    The other uint8 display value of RSSI: 

    In both the above cases I am not moving the devices, They are fixed. 
    Now How do we use RSSI? Also Which values should be used the uint8 or the int8. I guess we should look forward to uint8 values but then why the rssi is int8 type variable in the Zstack i.e in the AF.h file ?

  • Since you haven't fix the problem of your UART, this issue might be caused by it. You can check RSSI value by packet sniffer first to see if the value is like that on your terminal.

  • Hi,

    Thanks!
    I actually wish to know why is the rssi variable in the AF.h file is of the type int8, As int8 can be negative also but rssi value can't be negative.

  • Why rssi can't be negative?

    int8 rssi; /* The received RF power in units dBm */

  • Thank you sir !
    I want to ask about one more issue which I am facing currently. 

    I have a coordinator and one end device. 
    Now both are communicating properly. the LED3 on end device is on all the time. both can send-receive messages.
    If I power off the coordinator, the end device goes into a mode in which it just keep blinking LED3 (on-off). I guess that's the sleep mode of the end device, but If I again power on the end device the end device doesn't connect to the coordinator it just remains in that mode (blinking LED3). but at this stage now If again restart end device(power on off) then it gets connected to the coordinator. 

    I mean while coordinator comes back the end device should come out of the sleep mode, which it doesn't. 

    Now for this in which part of Zstack I can look to correct this issue ?
    I am not sure whether I am clearly conveyed my thought, Please let me know if there are any confusion in my problem.

    I am using the sampleApp of the zstack.

    Thanks 

  • Do you define NV_INIT and NV_RESTORE in your ZC and ZED? You need to define them to make ZC and ZED to keep network information in NV.

  • How do we define NV_INIT or NV_RESTORE ? where in the code files? Please show me some sample code where you have defined it.

    I searched it on other forums but I could only understood that when NV_RESOTRE is used so that the devices keep track of the network in some memory & when the same network (i.e PANID) is detected they gets restored?

    but maybe I want that when ZC is power off or out of range the end device should go into the  DEV_NWK_DISC,           // Discovering PAN's to join  state so that if the other ZC with the different PANID comes in contact it could get connected to that ZC.

    Now when I start a ZE with no ZC present. The ZE is searching for a network to join, now when ZC comes it joins it. If I again power off the ZC or take it outside range then is it possible for ZE to again come in the  // Discovering PAN's to join state ?

    Somewhere I read that NV_RESTORE or NV_INIT we define or put in the options for compiling but I am not able to understand how to deal with NV_INIT or NV_RESTORE ? 

    Please reply. Thanks

  • You should define them in preprocessor tab of C/C++ compiler in project options.

  • Thanks a lot. 

    I have one more doubt about the states of end devices at various stages i.e devStates_t parameter.
    In the ZDApp.h file I can see this defined as: 

    typedef enum
    {
    DEV_HOLD, // Initialized - not started automatically
    DEV_INIT, // Initialized - not connected to anything
    DEV_NWK_DISC, // Discovering PAN's to join
    DEV_NWK_JOINING, // Joining a PAN
    DEV_NWK_REJOIN, // ReJoining a PAN, only for end devices
    DEV_END_DEVICE_UNAUTH, // Joined but not yet authenticated by trust center
    DEV_END_DEVICE, // Started as device after authentication
    DEV_ROUTER, // Device joined, authenticated and is a router
    DEV_COORD_STARTING, // Started as Zigbee Coordinator
    DEV_ZB_COORD, // Started as Zigbee Coordinator
    DEV_NWK_ORPHAN // Device has lost information about its parent..
    } devStates_t;

    Consider the system of one ZE and one ZC.
    Now at the starting when the end device is present without the presence of coordinator. It will be in DEV_NWK_DISC state. When it senses any coordinator it becomes end device and comes in DEV_END_DEVICE. 

    1. Now If I switch off the coordinator (ZC), what would be the state of End Device (ZE) ? 

    2. After 1, If I bring up another coordinator (ZC2) in contact of (ZE)which has a different PANID, will the ZE join with ZC2 ?

    3. After 1, is it possible to program ZE  such that it goes into the  DEV_NWK_DISC state ? 


    Thanks Please reply !

     

  • 1. ZED will become orphan.

    2. No, it won't join ZC2

    3. When ZED disconnects from its parent, it will start beacon automatically.

  • Thanks !

    I am trying to convert the received RSSI value to dbm value. 
    Lets say 0x56 hex value then will it be -86dbm or 86dbm ?

    Also upto 5 meter distance if there is no obstacle, it receives FF RSSI value ?

  • Hi sumit

    This rssi value is offset by -73. You can refer to rxStartIsr() in mac_rx.c. So, if rssi=86, the the actual rssi is 86-73=13dbm.

  • I am not clearly able to understand this part now.

    The formula in the mac_rx.c is : 
    rssiDbm = PROPRIETARY_FCS_RSSI(fcsBuf) + MAC_RADIO_RSSI_OFFSET;


    Here offset is -76 in my case. Now is the PROPRIETARY_FCS_RSSI(fcsBuf) actual value ? 

    & rssiDbm is the value which I read by extracting from a received packet : (pkt->rssi).

    So if the rssiDbm is -72 (by converting hex into int8 value) then the actual RSSI value is

    -72 + 76 =  4 [ PROPRIETARY_FCS_RSSI(fcsBuf) ] ?

    Also when there is no obstacle at 1-5 meter distance I receive FF value at rssi , why ?

  • PROPRIETARY_FCS_RSSI(fcsBuf) is actual value. In your example, if rssiDbm is -72, the actual value is -72-76=-148dbm. rssiDBM is in 2's complement so 0xFF means -1. The actual value is -77dbm in your case.

  • Thanks! 

    Actually offset is -76. 

    So the relation is  

    rssiDbm = P_F_RSSI + offset 

    -1 = P_F_RSSI + (-76) 
    P_F_RSSI = 76-1 = 75Dbm ?? 

    I also read somewhere that the FF is error code & we can skip that value is it ???
    http://stupidembeddedblog.blogspot.kr/2014/05/estimating-distance-from-rssi-values.html?showComment=1405053685024#c4757774251258381890

  • Hi sumit,

    I suppose you are correct about 0xFF value in rssiDbm and suggest you to skip it.

  • Okay !

    Lets say I forget FF. 

    Then also according to my calculations: If I receive  -72 value then: 

    In the formula: 

    -72 = actual_value + (-76) 

    actual value = 76-72 = 4 Dbm ? Not -148Dbm as you suggested in your previous post ?

  • I am getting rssi values in the range 

    -62
    59
    -102
    27
    59
    -102
    76
    27
    27
    2
    -102
    1
    74
    -62
    -62
    76
    -102
    -62
    -62
    76
    76
    76
    76
    74
    36
    1
    36
    74
    76
    76
    -62
    -62
    -62
    -62
    76
    -62
    76
    -62

    What is wrong ? why do I get positive value of the 8 bit integer. I am displaying in signed format.

    I am extracting the rssi value from this received packet:

    typedef struct
    {
    osal_event_hdr_t hdr; /* OSAL Message header */
    uint16 groupId; /* Message's group ID - 0 if not set */
    uint16 clusterId; /* Message's cluster ID */
    afAddrType_t srcAddr; /* Source Address, if endpoint is STUBAPS_INTER_PAN_EP,
    it's an InterPAN message */
    uint16 macDestAddr; /* MAC header destination short address */
    uint8 endPoint; /* destination endpoint */
    uint8 wasBroadcast; /* TRUE if network destination was a broadcast address */
    uint8 LinkQuality; /* The link quality of the received data frame */
    uint8 correlation; /* The raw correlation value of the received data frame */
    int8 rssi; /* The received RF power in units dBm */
    uint8 SecurityUse; /* deprecated */
    uint32 timestamp; /* receipt timestamp from MAC */
    uint8 nwkSeqNum; /* network header frame sequence number */
    afMSGCommandFormat_t cmd; /* Application Data */
    } afIncomingMSGPacket_t;

    Now in the AF files it says /* The received RF power in units dBm */ is int8 rssi, this can't be that much positive.
    Also in this document http://www.ti.com/lit/an/swra114d/swra114d.pdf

    It says that we can convert the RSSI Register value, Is the rssi int8 variable and RSSI register value in the image are same ?.. shall I convert my int8 rssi value according to what is shown in the image ?

    Please reply, I am really confused about this.

  • Hello Yikai Chen,


    Thank you for your valuable help and contribution.

    I am based on BLE Bridge example (cc2540 128K, 1.4.1 stack) and I would like to test my UART. I check the file npi.c and has the setting of your first UART and also declare that:

    HAL_UART_DMA=1
    HAL_UART_ISR=0

    So as I understand I wait Rx to P0.2 and Tx to P0.3. Also, I use HTerm for the verification of UART in my PC. 

    Could you please let me know which uart test (read/write) I should use in order to verify that my UART works?

    At least to transfer one character. Please could you help me?

    Thank you,

  • You can refer to Arun's replies in e2e.ti.com/.../309031
  • This solution is based on the use of usb dongle and iOS phone. I don't have dongle and iOS. I have only Android phone.
    Also, mine BLE Bridhe cannot advertise its name , as I test it with my phone?
    Any proposal please?
  • I read lots of people complaining android cannot connect with BLE device correctly. If you suffer this problem, I suggest you to buy a CC2540 USB dongle to test this.