您好!
在运行时是否有任何方法可以更改信道、因此下次恢复网络时、它会有新的信道?
我尝试使用 SYS_OSAL_NV_WRITE (ID=0x0084)写入 NVRAM、之后进行软复位、但似乎没有任何变化。
BR、
Aiman
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.
请尝试参阅 sunmaysky.blogspot.com/.../use-ztool-z-stack-30-znp-to-set-up.html 中的步骤
_NIB 是 Z-Stack 中用于保存网络信息的数据结构。 ZCD_NV_NIB 为0x0021、nwkLogicalChannel 为_NIB 数据结构中的第22个字节。 您可以 监视和测试 API SYS_OSAL_NV_WRITE 以修改 ID 0x0021的值(偏移量为22)、从而将 nwkLogicalChannel 设置为所需值、并复位 CC2530以使其更改通道。
nIB 是 nwkIB_t 的结构变量、可在 nwk、h 中找到
typedef struct
{
byte SequenceNum;
byte PassiveAckTimeout;
byte MaxBroadcastRetries;
byte MaxChildren;
byte MaxDepth;
byte MaxRouters;
byte dummyNeighborTable; // to make everything a byte!!
byte BroadcastDeliveryTime;
byte ReportConstantCost;
byte RouteDiscRetries;
byte dummyRoutingTable; // to make everything a byte!!
byte SecureAllFrames;
byte SecurityLevel;
#if defined ( COMPATIBILITY_221 ) // Obsolete - do not use
byte nwkAllFresh;
#endif
byte SymLink;
byte CapabilityFlags;
uint16 TransactionPersistenceTime;
byte nwkProtocolVersion;
// non-standard attributes
byte RouteDiscoveryTime;
byte RouteExpiryTime; // set to 0 to turn off expiration of routes
// non-settable
uint16 nwkDevAddress;
byte nwkLogicalChannel;
uint16 nwkCoordAddress;
byte nwkCoordExtAddress[Z_EXTADDR_LEN];
uint16 nwkPanId;
// Other global items - non-settable
nwk_states_t nwkState;
uint32 channelList;
byte beaconOrder;
byte superFrameOrder;
byte scanDuration;
byte battLifeExt;
uint32 allocatedRouterAddresses;
uint32 allocatedEndDeviceAddresses;
byte nodeDepth;
// Version 1.1 - extended PAN ID
uint8 extendedPANID[Z_EXTADDR_LEN];
// Network key flag
uint8 nwkKeyLoaded;
// Key information - Moved out of the NIB structure after ZStack 2.3.0
// If these elements are going to be reused make sure to consider the size
// of the structures and padding specific to the target where the stack is
// going to be running.
nwkKeyDesc spare1; // Not used
nwkKeyDesc spare2; // Not used
// Zigbee Pro extensions
uint8 spare3; // nwkAddrAlloc deprecated - not used anymore
uint8 spare4; // nwkUniqueAddr deprecated - not used anymore
uint8 nwkLinkStatusPeriod; // The time in seconds betwee link status
// command frames
uint8 nwkRouterAgeLimit; // The number of missed link status
// command frames before resetting the
// link cost to zero
uint8 nwkUseMultiCast;
// ZigBee Pro extentions: MTO routing
uint8 nwkIsConcentrator; // If set, then the device is concentrator
uint8 nwkConcentratorDiscoveryTime; // Time period between two consecutive MTO route discovery
uint8 nwkConcentratorRadius; // Broadcast radius of the MTO route discovery
#if defined ( COMPATIBILITY_221 ) // Obsolete - do not use
uint8 nwkMaxSourceRoute;
uint8 nwkSrcRtgExpiryTime;
#else
uint8 nwkAllFresh;
#endif
uint16 nwkManagerAddr; // Network Manager Address
uint16 nwkTotalTransmissions;
uint8 nwkUpdateId;
} nwkIB_t;查看结构:
// non-standard attributes byte RouteDiscoveryTime; byte RouteExpiryTime; // set to 255 to turn off expiration of routes // non-settable uint16_t nwkDevAddress; byte nwkLogicalChannel; uint16_t nwkCoordAddress; byte nwkCoordExtAddress[Z_EXTADDR_LEN]; uint16_t nwkPanId;
注释显示它是不可设置的。 这是否意味着它具有某种写保护?
这是 ID 为0x0021且偏移量为22的 SYS_OSAL_NV_READ 的结果。
FE 60 61 8 0 5e 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 57
ID 为0x0021且偏移量为0x00的 SYS_OSAL_NV_READ 为
FE 76 61 8 0 74 cc 5 2 15 f 15 0 1e 0 0 1 5 1 8f 0 7f 0 2 5 ff 0 0 f 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 26 AD 8 0 0 80 0 f 4 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 17
76 C2 24 0 4b 12 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f 3 1 0 0 A 1 0 0 0 7 0 0 0 6A
结果是:
FE 76 61 8 0 74 12 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 80 24 0 80 4c 4D 0 20 4c 4D 0 20 48 75 2 0 0 0 0 5 0 C8 1 0 20 dc 1c 0 20 dc 1c 0 20 dc 0 20 20 0 0 E2
这对我来说不是很好,但我现在没有 CC26xx 来测试它。 我可以在访问我的套件并对其进行测试后回复。
Ryan Brown1 您有什么意见吗?