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.

ERROR[e27]: WHILE CONFIGURING UART IN SIMPLESENSOR FROM ZSTACK..

Other Parts Discussed in Thread: Z-STACK, CC2530, CC2430

Error[e27]:Entry "HalUARTInit::?relay in module simple sensor"


why am i getting this error while building the project

  • Which Z-Stack and IAR version do you use?

  • Zstack CC2530-2.3.0-1.4.0 ad IAR 8051 v8.10
  • If I remember correct, this Z-Stack version have to use IAR 7.51A to build examples. You can download IAR 7.51A from www.iar.com/.../ti-wireless
  • hi sir,
    thank you. I have resolved the problem when removing definition of uart.c in simplesensor.c.. now my problem is whether my routine for communicating with UART in simplesensor is correct or not.

    please give some suggestion for printing a CHARACTER in UART of simplesensor.c..

    uint8 myApp_ReadTemperature( void )
    {
    unsigned char str[10];
    unsigned char a[3]= {'1','0','0'};

    #ifndef HAL_UART
    #define HAL_UART TRUE
    #endif

    HalUARTInit();

    halUARTCfg_t uartConfig;
    uartConfig.configured = TRUE;
    uartConfig.baudRate = HAL_UART_BR_9600;
    uartConfig.flowControl = FALSE;
    uartConfig.flowControlThreshold = 5;
    uartConfig.rx.maxBufSize = 120;
    uartConfig.tx.maxBufSize = 120;
    uartConfig.idleTimeout = 5;
    uartConfig.intEnable = TRUE;
    #if defined (ZTOOL_P1) || defined (ZTOOL_P2)
    uartConfig.callBackFunc = MT_UartProcessZToolData;
    #elif defined (ZAPP_P1) || defined (ZAPP_P2)
    uartConfig.callBackFunc = MT_UartProcessZAppData;
    #else
    uartConfig.callBackFunc = NULL;
    #endif
    #if defined (MT_UART_DEFAULT_PORT)
    HalUARTOpen (MT_UART_DEFAULT_PORT, &uartConfig);
    #else
    /* Silence IAR compiler warning */
    (void)uartConfig;
    #endif
    sprintf(str, "%d", a);
    HalUARTWrite(HAL_UART_PORT_0,str,3);
    HalLedSet( HAL_LED_1, HAL_LED_MODE_TOGGLE );
    }
  • You have to assign your UART RX callback to uartConfig.callBackFunc. It is something like uartConfig.callBackFunc=MyUARTCallback. For TX part, your code looks fine.
  • Hi sir,
    Thank you.. i have configured UART as you said and HALUARTwrite works well whereas Haluartread is not working. Should i configure something for that.?

    uint8 myApp_ReadTemperature( void )
    {
    unsigned char str[10];
    unsigned char str1[10];
    unsigned char cmd_mode[5]= {'K',' ','2','\r','\n'};
    unsigned char cmd_co2[3]= {'Z','\r','\n'};
    #ifndef HAL_UART
    #define HAL_UART TRUE
    #endif
    MT_UartInit ();

    halUARTCfg_t uartConfig;

    /* Initialize APP ID */
    // App_TaskID = 0;

    /* UART Configuration */
    uartConfig.configured = TRUE;
    uartConfig.baudRate = MT_UART_DEFAULT_BAUDRATE;
    uartConfig.flowControl = MT_UART_DEFAULT_OVERFLOW;
    uartConfig.flowControlThreshold = MT_UART_DEFAULT_THRESHOLD;
    uartConfig.rx.maxBufSize = MT_UART_DEFAULT_MAX_RX_BUFF;
    uartConfig.tx.maxBufSize = MT_UART_DEFAULT_MAX_TX_BUFF;
    uartConfig.idleTimeout = MT_UART_DEFAULT_IDLE_TIMEOUT;
    uartConfig.intEnable = TRUE;
    #if defined (ZTOOL_P1) || defined (ZTOOL_P2)
    uartConfig.callBackFunc = MT_UartProcessZToolData;
    #elif defined (ZAPP_P1) || defined (ZAPP_P2)
    uartConfig.callBackFunc = MT_UartProcessZAppData;
    #else
    uartConfig.callBackFunc = NULL;
    #endif

    HalUARTOpen (HAL_UART_PORT_0, &uartConfig);
    if(count==0)
    {
    sprintf(str, "%s",cmd_mode);
    HalUARTWrite(HAL_UART_PORT_0,cmd_mode,5);
    memset(str,0,10);
    count = count+1;
    }
    sprintf(str, "%s",cmd_co2);

    HalUARTWrite(HAL_UART_PORT_0,cmd_co2,3);
    memset(str,0,10);
    HalUARTRead(HAL_UART_PORT_0,str1,10);

    HalUARTWrite(HAL_UART_PORT_0,str1,10);
    memset(str1,0,10);
    HalLedSet( HAL_LED_1, HAL_LED_MODE_TOGGLE );
    }
  • Do you implement UART RX callback and assign to uartConfig.callBackFunc?

  • No sir.... Can I change that in the above
  • 1. You have to implement a UART RX callback like

    uint8 pBuf[128];
    void uartRxCB( uint8 port, uint8 event )
    {
    if ( event != HAL_UART_TX_EMPTY )
    {

    // Read data from UART to pBuf
    HalUARTRead( HAL_UART_PORT_0, pBuf, MT_UART_DEFAULT_MAX_RX_BUFF );
    }
    }

    2. assign it to uartConfig.callBackFunc like
    uartConfig.callBackFunc = uartRxCB;

    Then, when there is UART RX data coming, callback uartRxCB will be called to collect data from UART.
  • HI Sir,
    I have tried using the above steps you have suggested. and got the above error in linker



    Error[e46]: Undefined external "uartRxCB::?relay" referred in SimpleSensor ( C:\ZStack-CC2530-2.3.01.4.0\Projects\zstack\Samples\ SimpleApp\CC2530DB\ SimpleSensorEB\Obj\SimpleSensor.r51 )

    This is how i have modified it...

    uint8 myApp_ReadTemperature( void )
    {
    unsigned char str[10];
    uint8 pBuf[128];
    unsigned char cmd_mode[5]= {'K',' ','2','\r','\n'};
    unsigned char cmd_co2[3]= {'Z','\r','\n'};
    #ifndef HAL_UART
    #define HAL_UART TRUE
    #endif
    MT_UartInit ();

    halUARTCfg_t uartConfig;

    /* Initialize APP ID */
    // App_TaskID = 0;

    /* UART Configuration */
    uartConfig.configured = TRUE;
    uartConfig.baudRate = MT_UART_DEFAULT_BAUDRATE;
    uartConfig.flowControl = MT_UART_DEFAULT_OVERFLOW;
    uartConfig.flowControlThreshold = MT_UART_DEFAULT_THRESHOLD;
    uartConfig.rx.maxBufSize = MT_UART_DEFAULT_MAX_RX_BUFF;
    uartConfig.tx.maxBufSize = MT_UART_DEFAULT_MAX_TX_BUFF;
    uartConfig.idleTimeout = MT_UART_DEFAULT_IDLE_TIMEOUT;
    uartConfig.intEnable = TRUE;
    #if defined (ZTOOL_P1) || defined (ZTOOL_P2)
    uartConfig.callBackFunc = MT_UartProcessZToolData;
    #elif defined (ZAPP_P1) || defined (ZAPP_P2)
    uartConfig.callBackFunc = MT_UartProcessZAppData;
    #else
    uartConfig.callBackFunc = uartRxCB;
    #endif

    HalUARTOpen (HAL_UART_PORT_0, &uartConfig);
    if(count<=4)
    {
    sprintf(str, "%s",cmd_mode);
    HalUARTWrite(HAL_UART_PORT_0,cmd_mode,5);
    memset(str,0,10);
    sprintf(str, "%s",cmd_co2);
    HalUARTWrite(HAL_UART_PORT_0,cmd_co2,3);
    memset(str,0,10);
    ////////////////////////
    //uint8 pBuf[128];

    uartRxCB( HAL_UART_PORT_0, HAL_UART_TX_EMPTY );
    {
    if ( event != HAL_UART_TX_EMPTY )
    {
    // Read data from UART to pBuf
    HalUARTRead( HAL_UART_PORT_0, pBuf, MT_UART_DEFAULT_MAX_RX_BUFF );
    }
    }
    count = count+1;
    }
    //sprintf(str, "%s",cmd_co2);

    //HalUARTWrite(HAL_UART_PORT_0,cmd_co2,3);
    //memset(str,0,10);
    //HalUARTRead(HAL_UART_PORT_0,str,10);

    HalUARTWrite(HAL_UART_PORT_0,str,8);
    //memset(str,0,10);
    HalLedSet( HAL_LED_1, HAL_LED_MODE_TOGGLE );
    }
  • I think you miss function prototype "void uartRxCB( uint8 port, uint8 event );" in the beginning of C file.
  • Hi Sir,
    now i got the error cleared but am not able to read the character using Haluartread. please suggest a solution..


    definition of uartRxCB function
    /////////////////////////////////////
    void uartRxCB( uint8 port, uint8 event )
    {
    if ( event != HAL_UART_TX_EMPTY )
    {
    // Read data from UART to pBuf
    HalUARTRead( HAL_UART_PORT_0, pBuf, MT_UART_DEFAULT_MAX_RX_BUFF );
    }
    }


    actual code where haluartread is used
    ///////////////////////////////////////////////

    uint8 myApp_ReadTemperature( void )
    {
    unsigned char str[10];
    //uint8 pBuf[128];
    static unsigned char cmd_mode[5]= {'K',' ','2','\r','\n'};
    static unsigned char cmd_co2[3]= {'Z','\r','\n'};
    //static unsigned char cmd_all[3]= {'Q','\r','\n'};

    #ifndef HAL_UART
    #define HAL_UART TRUE
    #endif
    MT_UartInit ();

    halUARTCfg_t uartConfig;

    /* Initialize APP ID */
    // App_TaskID = 0;

    /* UART Configuration */
    uartConfig.configured = TRUE;
    uartConfig.baudRate = MT_UART_DEFAULT_BAUDRATE;
    uartConfig.flowControl = MT_UART_DEFAULT_OVERFLOW;
    uartConfig.flowControlThreshold = MT_UART_DEFAULT_THRESHOLD;
    uartConfig.rx.maxBufSize = MT_UART_DEFAULT_MAX_RX_BUFF;
    uartConfig.tx.maxBufSize = MT_UART_DEFAULT_MAX_TX_BUFF;
    uartConfig.idleTimeout = MT_UART_DEFAULT_IDLE_TIMEOUT;
    uartConfig.intEnable = TRUE;
    #if defined (ZTOOL_P1) || defined (ZTOOL_P2)
    uartConfig.callBackFunc = MT_UartProcessZToolData;
    #elif defined (ZAPP_P1) || defined (ZAPP_P2)
    uartConfig.callBackFunc = MT_UartProcessZAppData;
    #else
    uartConfig.callBackFunc = uartRxCB;
    #endif

    HalUARTOpen (HAL_UART_PORT_0, &uartConfig);

    if(count<=5)
    {
    sprintf(str, "%s",cmd_co2);
    HalUARTWrite(HAL_UART_PORT_0,str,3);
    memset(str,0,sizeof(str));

    HalUARTRead(HAL_UART_PORT_0,pBuf,8);
    sprintf(str,"%s",pBuf);
    count = count+1;
    HalLedSet( HAL_LED_2, HAL_LED_MODE_TOGGLE);
    }
    HalUARTWrite(HAL_UART_PORT_0,str,8);

    }
  • When there is RX coming, does it go to UartRxCB?
  • Hi sir,
    while debugging the halread routine is not getting the characters. it just exists the haluartdma while checking this
    if (!HAL_UART_DMA_NEW_RX_BYTE(dmaCfg.rxHead)).. it is not loading the characters into buffer
  • Do you use scope to check your RX signal?
  • instead i read the RX signal with another serial converter.. am getting the rxdata.. but it is not read by the sensor node
  • i have another doubt... the simplesensor is already configured for a uint8 data report to be sent to the coordinator.. what should i do to change that the report returned to be a uint16(eg: sensor return value will be in 4 digits like 9999)and the pdata in the collector to be the uint16 value..
  • So, basically, you can get uartRxCB but there is no data doing HalUARTRead()?
  • yes sir.. :(
  • i got some doubts

    1) i didnt find this function being called... is it the right way of defining the uartRxCB

    /*******************************************************************************
    Receiving character
    *******************************************************************************/
    void uartRxCB( uint8 port, uint8 event )
    {
    if ( event != HAL_UART_TX_EMPTY )
    {
    // Read data from UART to pBuf
    HalUARTRead( HAL_UART_PORT_0, pBuf, MT_UART_DEFAULT_MAX_RX_BUFF );
    }
    }

    2) should i have all these calling back functions

    #if defined (ZTOOL_P1) || defined (ZTOOL_P2)
    uartConfig.callBackFunc = MT_UartProcessZToolData;
    #elif defined (ZAPP_P1) || defined (ZAPP_P2)
    uartConfig.callBackFunc = MT_UartProcessZAppData;
    #else
    uartConfig.callBackFunc = uartRxCB;
    #endif

    3) is this the rightway to get read the character.. in my system when i transmit some characters it responds by sending characters.. i need to read those characters...

    HalUARTOpen (HAL_UART_PORT_0, &uartConfig);

    HalUARTWrite(HAL_UART_PORT_0,cmd_co2,3);
    HalUARTRead(HAL_UART_PORT_0,pBuf,8);
    HalLedSet( HAL_LED_2, HAL_LED_MODE_TOGGLE);

    please help me in reading the data...
  • 1. I see you told me you can see uartRxCB is called.
    2. You should only keep uartConfig.callBackFunc = uartRxCB.
    3. You should use HalUARTRead in uartRXCB.

    By the way, do you test this on a sleeping device?
  • Sorry sir, i cant see the function UartRxCB being called..

    powersaving compiler flag was enabled in the preprocessor... but i dont know exactly that its a sleeping device.. sorry :(

    should i use these

    HAL_UART=TRUE
    UART_DMA=TRUE
    UART_ISR=FALSE
    i have used these compiler flags on the preprocessor
  • If you enable POWER_SAVING, device will enter sleeping mode. When device is under sleeping, it can not receive UART RX signal.
  • hi sir, am now am able to read the data as soon as i removed the powersaving flag as you doubted :).. now is it possible to change the data report size uint16 and receive the same in collector..
  • It is good to know it works now. Please help to press verify button to benefit others have the same problem. For your current question, i don't understand well. Can you describe more clear ?
  • sure sir.. actually the simple sensor program has been written to transmit the ADC data from the internal battery monitor and internal temperature sensor whose ADC value returned can only be uint8(0-255). but i need it to be uint16(0-65536). so that i can configure upto 14 bit ADC. i need to use a sensor whose resolution needs to be 12bit. so inordewr to use it the return value should be uint16
  • You can use API HalADCRead in hal_adc.c to do ADC reading and it will return uint16
  • but in the receiving end the value is truncated to 8bit value
  • I don't have simple sensor on my hand. Can you show me your source code to send/receive sensor data?

  • sure... the following is the source code for sending the battery voltage using internal ADC based battery monitor.. in that the uint8 myApp_ReadBattery returns the ADC value everytime its called... eventhough its configured as 10bit ADC, they are truncating the actual value from the ADC registers.. i need to send the actual value which will be between 0-1024.. so for that i need to change the uint8 to uint16..

    the next modification to be made in the collector which i have added below the code..

    /******************************************************************************
    * @fn myApp_ReadBattery
    *
    * @brief Reports battery sensor reading
    *
    * @param
    *
    * @return
    ******************************************************************************/
    uint8 myApp_ReadBattery( void )
    {

    #if defined (HAL_MCU_CC2430) || defined (HAL_MCU_CC2530)

    uint16 value;

    /* Clear ADC interrupt flag */
    ADCIF = 0;

    ADCCON3 = (HAL_ADC_REF_125V | HAL_ADC_DEC_128 | HAL_ADC_CHN_VDD3);

    /* Wait for the conversion to finish */
    while ( !ADCIF );

    /* Get the result */
    value = ADCL;
    value |= ((uint16) ADCH) << 8;

    /*
    * value now contains measurement of Vdd/3
    * 0 indicates 0V and 32767 indicates 1.25V
    * voltage = (value*3*1.25)/32767 volts
    * we will multiply by this by 10 to allow units of 0.1 volts
    */

    value = value >> 6; // divide first by 2^6
    value = (uint16)(value * 37.5);
    value = value >> 9; // ...and later by 2^9...to prevent overflow during multiplication

    return value;

    #endif // CC2430 or CC2530
    }
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////


    for the above problem i tried changing the uint8 myApp_ReadBattery to uint16 myApp_ReadBattery, and it worked... but i am not able to get the same at the collector node... where the value is truncated. For eg if i transmit ADC value 320(in binary = 1 0100 0000) with uint16 myApp_readbattery to the collector node, it is received as 64 (0100 0000).. only the 8 LSB bits were taken as its defined as uint8 *pData in the below routine.

    void zb_ReceiveDataIndication( uint16 source, uint16 command, uint16 len, uint8 *pData )

    /******************************************************************************
    * @fn zb_ReceiveDataIndication
    *
    * @brief The zb_ReceiveDataIndication callback function is called
    * asynchronously by the ZigBee stack to notify the application
    * when data is received from a peer device.
    *
    * @param source - The short address of the peer device that sent the data
    * command - The commandId associated with the data
    * len - The number of bytes in the pData parameter
    * pData - The data sent by the peer device
    *
    * @return none
    */
    CONST uint8 strDevice[] = "Device:0x";
    CONST uint8 strTemp[] = "Temp: ";
    CONST uint8 strBattery[] = "Battery: ";
    void zb_ReceiveDataIndication( uint16 source, uint16 command, uint16 len, uint8 *pData )
    {
    uint8 buf[32];
    uint8 *pBuf;
    uint8 tmpLen;
    uint8 sensorReading;

    if (command == SENSOR_REPORT_CMD_ID)
    {
    // Received report from a sensor
    sensorReading = pData[1];

    // If tool available, write to serial port

    tmpLen = (uint8)osal_strlen( (char*)strDevice );
    pBuf = osal_memcpy( buf, strDevice, tmpLen );
    _ltoa( source, pBuf, 16 );
    pBuf += 4;
    *pBuf++ = ' ';

    if ( pData[0] == BATTERY_REPORT )
    {
    tmpLen = (uint8)osal_strlen( (char*)strBattery );
    pBuf = osal_memcpy( pBuf, strBattery, tmpLen );

    *pBuf++ = (sensorReading / 10 ) + '0'; // convent msb to ascii
    *pBuf++ = '.'; // decimal point ( battery reading is in units of 0.1 V
    *pBuf++ = (sensorReading % 10 ) + '0'; // convert lsb to ascii
    *pBuf++ = ' ';
    *pBuf++ = 'V';
    }
    else
    {
    tmpLen = (uint8)osal_strlen( (char*)strTemp );
    pBuf = osal_memcpy( pBuf, strTemp, tmpLen );

    *pBuf++ = (sensorReading / 10 ) + '0'; // convent msb to ascii
    *pBuf++ = (sensorReading % 10 ) + '0'; // convert lsb to ascii
    *pBuf++ = ' ';
    *pBuf++ = 'C';
    }

    *pBuf++ = '\r';
    *pBuf++ = '\n';
    *pBuf = '\0';

    #if defined( MT_TASK )
    debug_str( (uint8 *)buf );
    #endif

    // can also write directly to uart

    }
    }


    Please give me some suggestion
  • You don't show me how you transmit 16 bits ADC reading on sender.
  • Here below i have added the code which is same expect the report function definition



    /******************************************************************************
    * @fn myApp_ReadBattery
    *
    * @brief Reports battery sensor reading
    *
    * @param
    *
    * @return
    ******************************************************************************/
    uint16 myApp_ReadBattery( void )
    {

    #if defined (HAL_MCU_CC2430) || defined (HAL_MCU_CC2530)

    uint16 value;

    /* Clear ADC interrupt flag */
    ADCIF = 0;

    ADCCON3 = (HAL_ADC_REF_125V | HAL_ADC_DEC_128 | HAL_ADC_CHN_VDD3);

    /* Wait for the conversion to finish */
    while ( !ADCIF );

    /* Get the result */
    value = ADCL;
    value |= ((uint16) ADCH) << 8;

    /*
    * value now contains measurement of Vdd/3
    * 0 indicates 0V and 32767 indicates 1.25V
    * voltage = (value*3*1.25)/32767 volts
    * we will multiply by this by 10 to allow units of 0.1 volts
    */

    value = value >> 2;

    return value;

    #endif // CC2430 or CC2530
    }
  • I mean you have to show me how you send ADC value on sender side after you call myApp_ReadBattery().
  • IS THIS WHAT YOU ASKED...?? Sorry i cant get you sir.

    void zb_HandleOsalEvent( uint16 event )
    {
    uint16 pData[2];

    if ( event & MY_START_EVT )
    {
    zb_StartRequest();
    }
    if ( event & MY_REPORT_BATTERY_EVT )
    {
    pData[0] = BATTERY_REPORT;
    pData[1] = myApp_ReadBattery();
    zb_SendDataRequest( 0xFFFE, SENSOR_REPORT_CMD_ID, 2, pData, 0, AF_ACK_REQUEST, 0 );
    osal_start_timerEx( sapi_TaskID, MY_REPORT_TEMP_EVT, myAppBatteryReportPeriod );
    }

    if ( event & MY_FIND_COLLECTOR_EVT )
    {
    // Find and bind to a collector device
    zb_BindDevice( TRUE, SENSOR_REPORT_CMD_ID, (uint8 *)NULL );
    }

    }

    void myApp_StartReporting( void )
    {
    osal_start_timerEx( sapi_TaskID, MY_REPORT_BATTERY_EVT, myAppBatteryReportPeriod );
    HalLedSet( HAL_LED_1, HAL_LED_MODE_ON );
    }

  • As you can see, you only use 1 byte pData[1] to send uint16 and it is not enough. You have to do some revisions to send uint16.

    uint16 pData[3];

    if ( event & MY_START_EVT )
    {
    zb_StartRequest();
    }
    if ( event & MY_REPORT_BATTERY_EVT )
    {
    // Read and report temperature value
    pData[0] = TEMP_REPORT;
    pData[1] = (uint8)(myApp_ReadTemperature()&0x00FF);
    pData[2] = (uint8)((myApp_ReadTemperature()&0xFF00)>>8);
    zb_SendDataRequest( 0xFFFE, SENSOR_REPORT_CMD_ID, 3, pData, 0, AF_ACK_REQUEST, 0 );
    osal_start_timerEx( sapi_TaskID, MY_REPORT_TEMP_EVT, myTempReportPeriod );
    }

    And, you have to reconstruct it to uint16 on receiver side.
  • hi sir.. why a character which is printed using haluartwrite getting printed thrice in hyperterminal... am writting a buffer ['T','\r','\n'] content using haluartwrite.. all of a sudden it started printing the same thrice for a single call of haluartwrite... what could be the problem..
  • Can you show me your code to do this?
  • Hi sir, greetrings...

    this is the code am working with

    uint16 myApp_ReadTemperature( void )
    {
    char Temp_out[4];
    uint16 Temp_out_16;

    //static unsigned char cmd_mode[5]= {'K',' ','2','\r','\n'};
    static unsigned char cmd_Temp[3]= {'T','\r','\n'};
    //static unsigned char cmd_all[3]= {'Q','\r','\n'};
    #ifndef HAL_UART
    #define HAL_UART TRUE
    #endif

    MT_UartInit ();
    halUARTCfg_t uartConfig;
    uartConfig.configured = TRUE;
    uartConfig.baudRate = MT_UART_DEFAULT_BAUDRATE;
    uartConfig.flowControl = MT_UART_DEFAULT_OVERFLOW;
    uartConfig.flowControlThreshold = MT_UART_DEFAULT_THRESHOLD;
    uartConfig.rx.maxBufSize = MT_UART_DEFAULT_MAX_RX_BUFF;
    uartConfig.tx.maxBufSize = MT_UART_DEFAULT_MAX_TX_BUFF;
    uartConfig.idleTimeout = MT_UART_DEFAULT_IDLE_TIMEOUT;
    uartConfig.intEnable = TRUE;
    uartConfig.callBackFunc = uartRxCB;

    HalUARTOpen (HAL_UART_PORT_0, &uartConfig);

    HalUARTWrite(HAL_UART_PORT_0,cmd_Temp,3);

    HalLedSet( HAL_LED_2, HAL_LED_MODE_TOGGLE);

    memcpy(Temp_out,pBuf+4,4);

    memset(pBuf,0,sizeof(pBuf));

    Temp_out_16 = (uint16)(atoi(Temp_out));

    memset(Temp_out,0,sizeof(Temp_out));
    HalUARTWrite(HAL_UART_PORT_0,cmd_Temp,3);
    return Temp_out_16;
    }
  • You can not use HalUARTWrite more than one in a single function of Z-Stack.
  • sorry i have corrected it... but still its not working ji :( it worked well first.. but now i dont know what has gone wrong
  • What do you mean it doesn't work? TX not work or RX not work?
  • the haluartwrite which i have called in that routine prints it thrice like
    T
    T
    T

    Thats what i meant sir
  • If you intent to output a value from UART, try my following codes:

    char str[8];

    int a =100;

    sprintf(str, "%d", a);

    HalUARTWrite(HAL_UART_PORT_0, str, 8);
  • still the same issue persists sir.

    it prints like as below

    100100100
  • Do you use CC2530DK or your customized PCB?
  • but i have used HalUARTwrite in collector code where everything works fine... :( what could be the reason of this malfunctioning sir
  • I have no idea so I try to get more information to help you.
  • okay sir thank you
  • hi sir its due to the repeated usage of myApp_ReadTemperature(); in the void zb_HandleOsalEvent( uint16 event ) for taking the uint16 value masked and thrown in to pData..
  • It good to know you finally find where the problem is.