'Can't get a ZNF to become coordinator to form a zigbee network

So this is the communication that goes between host and sonoff dongle running latest zstack firmware...

 // Write startup option to clear NV when reset (3.8.1.9)
 0xFE 0x05 0x21 0x09 0x00 0x03 0x00 0x01 0x03 0x2C
    SRSP -> Sys Interface -> OSAL NV Write result: 2
 // Do Reset, Clear NV  
 0xFE 0x01 0x41 0x00 0x01 0x41
    AREQ -> Sys Interface -> Reset Response -> 0x80 0x00 0x02 0x01 0x02 0x07 0x01
 
 // Write ZCD_NV_LOGICAL_TYPE to 0 which means coordinator  (3.8.1.9)   
 0xFE 0x05 0x21 0x09 0x00 0x87 0x00 0x01 0x00 0xAB
    SRSP -> Sys Interface -> OSAL NV Write result: 2
    
 // Set Primary channel mask to channel 13 only (3.13.1.6)
 0xFE 0x05 0x2F 0x08 0x01 0x00 0x00 0x20 0x00 0x03
    SRSP -> Callback -> Channel set result: Success
 // Set Secondary channel to 0x0 to disable secondary channel mask (3.13.1.6)   
 0xFE 0x05 0x2F 0x08 0x00 0x00 0x00 0x00 0x00 0x22
    SRSP -> Callback -> Channel set result: Success
    
 // Start commissioning using network formation as parameter to start coordinator (3.13.1.5)    
 0xFE 0x01 0x2F 0x05 0x04 0x2F
    SRSP -> Callback -> Start Commissioning result -> Success
    AREQ -> ZDO Interface -> State Change Indication -> New State 9
    AREQ -> Callback -> BDB Commissioning Notification -> Mode: Initialization -> Status: Network Restored -> Remaining Mode: Network Formation
    AREQ -> Callback -> BDB Commissioning Notification -> Mode: Formation -> Status: Formation Failure

The numbers between parentheses is where i found the command in the 'Z-Stack Monitor and Test API' spec.

The issue is probably the lines that result in 'OSAL NV Write result: 2' but i don't know what i'm doing wrong...



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source