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.

cc2530通过串口发送指令修改设备类型(协调器、路由、终端)

一般都是通过烧写不同的工程来区别设备的类型,现在想用一个工程,通过串口发送命令来修改这个设备的类型。该怎么弄呢?

一般都是不同的工程选择不同配置文件tools文件夹下面,f8wcood.cfg,f8wendev.cfg,f8wrouter.cfg分别选择这3个配置来控制设备类型的,以及nv里面ZCD_NV_LOGICAL_TYPE保存的logicalType.二者来区分设备类型的。

nv可以通过串口发送不同指令修改,但cfg里面的都是声明和宏定义,该如何修改呢?

  • /* MAC Settings */
    -DMAC_CFG_APP_PENDING_QUEUE=TRUE
    -DMAC_CFG_TX_DATA_MAX=5
    -DMAC_CFG_TX_MAX=8
    -DMAC_CFG_RX_MAX=5

    /* Router Settings */
    -DRTR_NWK // Router Functions

  • 可以参考VV的解释

     To configure the device as either a router or a coordinator, you need to ensure that you have the following lines defined. Typically these lines are defined in the files f8wCoord.cfg which should be included in the IAR--> (tab)Project--> Options, C/C++ compiler tab Extra Options.

    You will need to set zgDeviceLogicalType according to the required logical type (ZG_DEVICETYPE_COORDINATOR, or ZG_DEVICETYPE_ROUTER before calling the ZDOInitDevice() function to start the device. 

    /* Coordinator Settings */

    -DZDO_COORDINATOR // Coordinator Functions
    -DRTR_NWK // Router Functions

    另外在IAR->Linker->Extra Options 加上Alldevice的lib文件