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.

CC2630中NV的使用?



请问:

uint8_t zclport_readNV(uint16_t id, uint16_t subId, uint16_t ndx, uint16_t len,void *buf)

中的subId - NV ID如何理解?

uint8 osal_nv_read( uint16 id, uint16 offset, uint16 len, void *buf );

这两者之间的id,分配规则,App中是独立的?还是延续

// NV Items Reserved for applications (user applications)
// 0x0401 ?0x0FFF

谢谢

  • 在ZComDef.h 中定义了NV的ID , ID 都是协议栈中规定好的

    // OSAL NV item IDs
    #define ZCD_NV_EXTADDR                    0x0001
    #define ZCD_NV_BOOTCOUNTER                0x0002
    #define ZCD_NV_STARTUP_OPTION             0x0003
    #define ZCD_NV_START_DELAY                0x0004

    // NWK Layer NV item IDs
    #define ZCD_NV_NIB                        0x0021
    #define ZCD_NV_DEVICE_LIST                0x0022
    #define ZCD_NV_ADDRMGR                    0x0023
    #define ZCD_NV_POLL_RATE                  0x0024
    #define ZCD_NV_QUEUED_POLL_RATE           0x0025
    #define ZCD_NV_RESPONSE_POLL_RATE         0x0026
    #define ZCD_NV_REJOIN_POLL_RATE           0x0027
    #define ZCD_NV_DATA_RETRIES               0x0028
    #define ZCD_NV_POLL_FAILURE_RETRIES       0x0029
    #define ZCD_NV_STACK_PROFILE              0x002A
    #define ZCD_NV_INDIRECT_MSG_TIMEOUT       0x002B
    #define ZCD_NV_ROUTE_EXPIRY_TIME          0x002C
    #define ZCD_NV_EXTENDED_PAN_ID            0x002D
    #define ZCD_NV_BCAST_RETRIES              0x002E
    #define ZCD_NV_PASSIVE_ACK_TIMEOUT        0x002F
    #define ZCD_NV_BCAST_DELIVERY_TIME        0x0030
    #define ZCD_NV_NWK_MODE                   0x0031
    #define ZCD_NV_CONCENTRATOR_ENABLE        0x0032
    #define ZCD_NV_CONCENTRATOR_DISCOVERY     0x0033
    #define ZCD_NV_CONCENTRATOR_RADIUS        0x0034
    #define ZCD_NV_CONCENTRATOR_RC            0x0036
    #define ZCD_NV_NWK_MGR_MODE               0x0037


    // APS Layer NV item IDs
    #define ZCD_NV_BINDING_TABLE              0x0041
    #define ZCD_NV_GROUP_TABLE                0x0042
    #define ZCD_NV_APS_FRAME_RETRIES          0x0043
    #define ZCD_NV_APS_ACK_WAIT_DURATION      0x0044
    #define ZCD_NV_APS_ACK_WAIT_MULTIPLIER    0x0045
    #define ZCD_NV_BINDING_TIME               0x0046
    #define ZCD_NV_APS_USE_EXT_PANID          0x0047
    #define ZCD_NV_APS_USE_INSECURE_JOIN      0x0048
    #define ZCD_NV_APSF_WINDOW_SIZE           0x0049     // Window size for fregmentation
    #define ZCD_NV_APSF_INTERFRAME_DELAY      0x004A     // The delay between tx blocks when using fragmentaition
    #define ZCD_NV_APS_NONMEMBER_RADIUS       0x004B     // Multicast non_member radius
    #define ZCD_NV_APS_LINK_KEY_TABLE         0x004C

    // Security NV Item IDs
    #define ZCD_NV_SECURITY_LEVEL             0x0061
    #define ZCD_NV_PRECFGKEY                  0x0062
    #define ZCD_NV_PRECFGKEYS_ENABLE          0x0063
    #define ZCD_NV_SECURITY_MODE              0x0064
    #define ZCD_NV_SECURE_PERMIT_JOIN         0x0065
    #define ZCD_NV_lOCAL_CERTIFICATE          0x0069
    #define ZCD_NV_STATIC_PRIVATE_KEY         0x006a
    #define ZCD_NV_CA_PUBLIC_KEY              0x006b
    #define ZCD_NV_STATIC_PUBLIC_KEY          0x006c
    #define ZCD_NV_USE_DEFAULT_TCLK           0x006d
    #define ZCD_NV_TRUSTCENTER_ADDR           0x006e
    #define ZCD_NV_RNG_COUNTER                0x006f
    #define ZCD_NV_RANDOM_SEED                0x0070

    // ZDO NV Item IDs
    #define ZCD_NV_USERDESC                   0x0081
    #define ZCD_NV_NWKKEY                     0x0082
    #define ZCD_NV_PANID                      0x0083
    #define ZCD_NV_CHANLIST                   0x0084
    #define ZCD_NV_LEAVE_CTRL                 0x0085
    #define ZCD_NV_SCAN_DURATION              0x0086
    #define ZCD_NV_LOGICAL_TYPE               0x0087
     
    #define ZCD_NV_ZDO_DIRECT_CB              0x008F

    // ZCL NV item IDs
    #define ZCD_NV_SCENE_TABLE                0x0091

    // Non-standard NV item IDs
    #define ZCD_NV_SAPI_ENDPOINT              0x00A1

    // NV Items Reserved for Trust Center Link Key Table entries
    // 0x0101 - 0x01FF
    #define ZCD_NV_TCLK_TABLE_START           0x0101
     
    // NV Items Reserved for applications (user applications)
    // 0x0201 – 0x0FFF


  • 我想问的是:

    uint8_t zclport_readNV(uint16_t id, uint16_t subId, uint16_t ndx, uint16_t len,void *buf)

    黄色标记的 subid?

    void zclGeneral_ScenesInit(void)
    {
        uint16_t x;

       for(x = 0; x < ZCL_GEN_MAX_SCENES; x++)
      {
           zclport_initializeNVItem(zclSceneNVID, x,
           sizeof(zclGenSceneNVItem_t), NULL);
      }
    }

    此处应用中的zclSceneNVID 为 0X0001,这是为什么?

    其次subid 为 x ?