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.

CC2538: Zstack3.0.2 can receive serial data directly or USB instead of UART ?

Part Number: CC2538
Other Parts Discussed in Thread: Z-STACK

Hi TI team 

I am doing combine the application code on the ZC-ota dongle orignal example proiect,

Has encountered the problem:1 start the timer event on the init function,

                                                  if ( events & AMOSDONGLE_USB_POLL_EVT )

{

   while (Hal_UART_RxBufLen(HAL_UART_PORT_0) > 0 ) 

   {

         HalUARTRead (HAL_UART_PORT_0, &ch, 1);

if (ch != 'S') continue;
HalUARTRead (HAL_UART_PORT_0, &ch, 1);
if (ch != 'S') continue;
HalUARTRead (HAL_UART_PORT_0, &ch, 1);
if (ch != 'S') continue;
HalUARTRead (HAL_UART_PORT_0, &len, 1);

  }

See these code,it can run normal on USB interface on the genercial example project,

But on the UART interface,it just seem that can receive these data sometimes,seem that block.

2.So in order to solve the fist problem.I change the UART to USB,and appeared the error on the IAR FOR ARM 8.22.1 

  

So What I can do for it?

Thanks!

  • It seems that you add source files contain those Functions twice in your project.

  • Hi userjiabo,

    I suggest you define HAL_UART_USB and USB_SETUP_MAX_NUMBER_OF_INTERFACES=5, add $PROJ_DIR$\..\..\..\..\Components\usblib\cc2538\bin\iar\usbcdc.lib to Options -> Linker -> Library, and include the following directories to Options -> C/C++ Compiler -> Preprocessor:

    $PROJ_DIR$\..\..\..\..\..\Components\usblib\cc2538\source\library
    $PROJ_DIR$\..\..\..\..\..\Components\usblib\cc2538\source\library\cc2538
    $PROJ_DIR$\..\..\..\..\..\Components\usblib\cc2538\source
    $PROJ_DIR$\..\..\..\..\..\Components\usblib\cc2538\source\class_cdc

    Regards,
    Ryan

  • Hi YiKai Chen

    yes,it seem that,but on the project[C:\Texas Instruments\Z-Stack 3.0.2\Projects\zstack\HomeAutomation\GenericApp\CC2538] use USB,it can work normally.

    I think that it related to the CC2538 M3 code speed and UART receive speed.

    USB speed has 12Mbps. 

    Thanks!

  • Hi Brown1

    on the project[D:\Texas Instruments\Z-Stack 3.0.2\Projects\zstack\OTA\Dongle\CC2538]

    set the parmeters as follows:

    ewarm
    CC2538_USE_ALTERNATE_INTERRUPT_MAP=1
    FEATURE_RESET_MACRO
    SECURE=1
    TC_LINKKEY_JOIN
    ZDSECMGR_TC_DEVICE_MAX=16
    NV_INIT
    NV_RESTORE
    ZTOOL_P1
    MT_TASK
    MT_APP_FUNC
    MT_SYS_FUNC
    MT_ZDO_FUNC
    MT_NWK_FUNC
    MT_NWK_CB_FUNC
    MT_UTIL_FUNC
    MT_OTA_FUNC
    xLEGACY_LCD_DEBUG
    xLCD_SUPPORTED=DEBUG
    OTA_SERVER=TRUE
    OTA_HA
    ZCL_REPORT
    ZCL_READ
    ZCL_WRITE
    ZCL_BASIC
    ZCL_GROUPS
    ZCL_REPORT_DESTINATION_DEVICE
    BDB_REPORTING
    ZCL_REPORTING_DEVICE
    ZCL_IDENTIFY
    xMT_UART_DEFAULT_OVERFLOW=FALSE
    xHAL_UART
    HAL_UART_USB
    USB_SETUP_MAX_NUMBER_OF_INTERFACES=5
    xTest_Hub

    add the source code path as follows;

    $PROJ_DIR$\..\Source
    $PROJ_DIR$\..\..\Source
    $PROJ_DIR$\..\..\..\SE\Source
    $PROJ_DIR$\..\..\..\Zmain\TI2538DB
    $PROJ_DIR$\..\..\..\..\..\Components\hal\include
    $PROJ_DIR$\..\..\..\..\..\Components\hal\target\CC2538
    $PROJ_DIR$\..\..\..\..\..\Components\driverlib\cc2538\inc
    $PROJ_DIR$\..\..\..\..\..\Components\driverlib\cc2538\source
    $PROJ_DIR$\..\..\..\..\..\Components\bsp\srf06eb_cc2538\drivers\source
    $PROJ_DIR$\..\..\..\..\..\Components\mac\include
    $PROJ_DIR$\..\..\..\..\..\Components\mac\high_level
    $PROJ_DIR$\..\..\..\..\..\Components\mac\low_level\srf05
    $PROJ_DIR$\..\..\..\..\..\Components\mac\low_level\srf05\single_chip
    $PROJ_DIR$\..\..\..\..\..\Components\mt
    $PROJ_DIR$\..\..\..\..\..\Components\osal\include
    $PROJ_DIR$\..\..\..\..\..\Components\osal\mcu\cc2538
    $PROJ_DIR$\..\..\..\..\..\Components\services\ecc\binary163
    $PROJ_DIR$\..\..\..\..\..\Components\services\ecc\binary283
    $PROJ_DIR$\..\..\..\..\..\Components\services\saddr
    $PROJ_DIR$\..\..\..\..\..\Components\services\sdata
    $PROJ_DIR$\..\..\..\..\..\Components\stack\af
    $PROJ_DIR$\..\..\..\..\..\Components\stack\gp
    $PROJ_DIR$\..\..\..\..\..\Components\stack\bdb
    $PROJ_DIR$\..\..\..\..\..\Components\stack\nwk
    $PROJ_DIR$\..\..\..\..\..\Components\stack\sapi
    $PROJ_DIR$\..\..\..\..\..\Components\stack\sec
    $PROJ_DIR$\..\..\..\..\..\Components\stack\sys
    $PROJ_DIR$\..\..\..\..\..\Components\stack\zcl
    $PROJ_DIR$\..\..\..\..\..\Components\stack\zdo
    $PROJ_DIR$\..\..\..\..\..\Components\zmac
    $PROJ_DIR$\..\..\..\..\..\Components\zmac\f8w
    D:\Texas Instruments\Z-Stack 3.0.2\Components\usblib\cc2538\source\library\cc2538
    D:\Texas Instruments\Z-Stack 3.0.2\Components\usblib\cc2538\source\class_cdc
    D:\Texas Instruments\Z-Stack 3.0.2\Components\usblib\cc2538\source\library
    D:\Texas Instruments\Z-Stack 3.0.2\Components\usblib\cc2538\source

    also the IAR FOR ARM 8.22.1 appeared the picture problem:

    Thanks!

  • Hi YiKai Chen

    What can I install this USB port.

    I want to install on my PC. I had forgot and can not find about this.

    Thanks!

  • I couldn't understand your question. The screenshot shows your PC already install CDC driver for CC2538 properly.

  • Hi YiKai Chen

    yes,notebook can not install,this is the computer can install it, where the usb driver I can find to install it,I had found,but found no.

    Thanks!

  • Attach driver for your reference.

    drivers.zip

  • Hi YiKai Chen

    Ok,mark!

    Thanks!

  • I had no build errors when all instructions provided were completed for an out-of-box GenericApp example.

    Edit: Same for ZC OTA Dongle project

    Regards,
    Ryan

  • Hi Brown1

    yes,I had build on the an out-of-box GenericApp example also the same result to you,but now on the dongle example had appeared this,

    So strange?

    Thanks!

  • Hi YiKai Chen

    I had add these source code and the Serial protocol also use the TI default  protocol,

    this line code[HalUARTWrite(HAL_UART_PORT_0, "hello_CMD_SERIAL_MSG", 21);] frush out very well. no any block.

    just send the event to application loop,no MT loop.

    case CMD_SERIAL_MSG:
    HalUARTWrite(HAL_UART_PORT_0, "hello_CMD_SERIAL_MSG", 21);
    mtOSALSerialData_t *pMessage = (mtOSALSerialData_t *)MSGpkt;
    uint8 *msg_ptr = pMessage->msg;
    MT_ProcessIncoming(msg_ptr);
    break;

    So I think it is related to the CC2538 M3 code speed and UART receive speed,in spite of  115200/N/8/1.

    in spite of these source code:

    osal_set_event(OTA_Dongle_TaskID, AMOSDONGLE_USB_POLL_EVT);

    if ( events & AMOSDONGLE_USB_POLL_EVT )

       HalUARTPoll();
      while (Hal_UART_RxBufLen(HAL_UART_PORT_0) > 0 )

      {

    macMcuTimerForceDelay(20);
    HalUARTRead (HAL_UART_PORT_0, &ch, 1);
    if (ch != 'S') continue;
    HalUARTRead (HAL_UART_PORT_0, &ch, 1);
    if (ch != 'S') continue;
    HalUARTRead (HAL_UART_PORT_0, &ch, 1);
    if (ch != 'S') continue;
    HalUARTRead (HAL_UART_PORT_0, &len, 1);
    length = len;

      }

    }

    Thanks!

  • I don't see any build errors for the ZC OTA Dongle project as well, using the same steps as before.  Perhaps you should try evaluating a new stack installation.

    Regards,
    Ryan

  • Hi Brown1

    OK,I wll try again.

    Thanks!

  • Hi Brown1

    ok,I had try again and had no any error during build the dongle project.

    and the USB protocol can be enabled and the tramit and receive successfully.

    i add source code as follows:

    void osal_start_system( void )
    {

    halUARTCfg_t usbUARTCfg;

    usbUARTCfg.baudRate = 4;
    usbUARTCfg.callBackFunc = NULL;
    //usbUARTCfg.callBackFunc = MT_UartProcessZToolData;
    HalUARTOpen(0, &usbUARTCfg);

    -------------------------

    }

    so this post problem can be solved entirely,

    So I had added my previous source code on the dongle project,

    And I will test this stability. and modify the per ota packet from 32 byte to 80 byte,

    complete the entire zigbee process from the 16min to 7min.

    and will test it again.

    Thanks!