Coder Social home page Coder Social logo

zigbeer / cc-znp Goto Github PK

View Code? Open in Web Editor NEW
60.0 14.0 30.0 1.19 MB

The interface for a host to communicate with TI CC253X Zigbee Network Processor(ZNP) over a serial port.

License: MIT License

JavaScript 99.85% Makefile 0.15%
zigbee znp cc2530 cc2531

cc-znp's Introduction

cc-znp

The interface for a host to communicate with TI CC253X ZigBee Network Processor(ZNP) over a serial port.

NPM

Travis branch npm npm


Documentation

Please visit the Wiki.


Overview

cc-znp allows you to interact with TI's CC253X ZigBee Network Processor(ZNP) on node.js via TI Z-Stack Monitor and Test(MT) APIs upon an UART interface.


Installation

$ npm install cc-znp --save


Usage

See Usage on the Wiki for details.


License

Licensed under MIT.

cc-znp's People

Contributors

elvis-epx avatar hedywings avatar jackchased avatar simenkid avatar splitice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cc-znp's Issues

cc-znp package not working properly on my BeagleBoneBlack.

I have a CC2531 USB Evaluation Kit connected to the USB port on my BeagleBoneBlack (BBB). I also have two zigbee end-devices within the surroundings of my BBB which are expected to join the network once opened. When the following code

const ccznp = require('cc-znp');
const spCfg = {
    path: '/dev/ttyACM0',
    options: {
        baudrate: 115200,
        flowControl: true,
        rtscts: true
    }
};

ccznp.on('ready', () => {  
     console.log('Device is ready.');

     ccznp.sapiRequest('startRequest', {}, () => {
        });

        ccznp.sapiRequest('permitJoiningRequest', {destination: 0xFFFC, timeout: 0xAA}, (error, result) => {
            if (error) {
                throw error;
            }

            // Verify the results
            console.log(result);
        });
});

ccznp.on('AREQ', (data) => {
     console.dir(data);
});

ccznp.init(spCfg, (error) => {
    console.log(error);
});

ccznp.on('close', function() {
    console.log('Serial port closed.');
});

is run, I get the following error:

Error: request timeout
    at ccznp.sapiRequest (.../test.js:82:23)
    at CcZnp.<anonymous> (.../node_modules/cc-znp/lib/ccznp.js:190:13)
    at CcZnp.g (events.js:286:16)
    at emitOne (events.js:96:13)
    at CcZnp.emit (events.js:188:7)
    at Timeout.<anonymous> (.../node_modules/cc-znp/lib/ccznp.js:170:18)
    at tryOnTimeout (timers.js:224:11)
    at Timer.listOnTimeout (timers.js:198:5)  

After running the script again several times (at least 6 times), the error suddenly disappears and I get the following results:

{ 
  sof: 254,
  len: 1,
  type: 'SRSP',
  subsys: 'SAPI',
  cmd: 'permitJoiningRequest',
  payload: { status: 0 },
  fcs: 111,
  csum: 111 
}

After getting the results finally, if I run the same script again it just hangs until I stop it with CRTL+C!

It is worth noting that this procedure happens with all the other commands (e.g. UTIL_GET_DEVICE_INFO etc.) I try to call i.e. I must run the script several times, get the 'Error: request timeout' message above during each run, before it finally runs without any errors and yield the results.

Am I perhaps doing something wrong or is this a bug within the cc-znp package? I would be grateful if you can investigate this issue as soon as possible and let me know your feedback/solution.

Many thanks in advance.

Error: Unrecognized command

I'm getting this error from something on my ZigBee network:

  cc-znp Error: Unrecognized command
  cc-znp     at new ZpiObject (/opt/zigbee2mqtt/node_modules/cc-znp/lib/zpiObject.js:37:15)
  cc-znp     at CcZnp._parseMtIncomingData (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:325:18)
  cc-znp     at Unpi.parseMtIncomingData (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:92:18)

where subsys = ZDO and cmd = 200 (decimal).

Any idea what this command is?

Check if cc-znp do have the new MT commands or REQ/RSP corrections

Please check these commands and ensure their arguments and responses again.

  • MT_SYS:
    • SYS_ZDIAGS_INIT_STATS
    • SYS_ZDIAGS_CLEAR_STATS
    • SYS_ZDIAGS_GET_STATS
    • SYS_ZDIAGS_RESTORE_STATS_NV
    • SYS_ ZDIAGS_SAVE_STATS_TO_NV
    • SYS_NV_CREATE
    • SYS_NV_DELETE
    • SYS_NV_READ
    • SYS_NV_WRITE
    • SYS_NV_UPDATE
    • SYS_NV_COMPACT
  • MT_UTIL:
    • UTIL_KEY_EVENT (check if something changed?)
  • MT_ZDO:
    • ZDO_SET_REJOIN_PARAMETERS_REQ
    • ZDO_SEC_ADD_LINK_KEY
    • ZDO_SEC_ENTRY_LOOKUP_EXT
    • ZDO_SEC_DEVICE_REMOVE
    • ZDO_EXT_ROUTE_DISC
    • ZDO_EXT_ROUTE_CHECK
    • ZDO_EXT_REMOVE_GROUP
    • ZDO_EXT_REMOVE_ALL_GROUP
    • ZDO_EXT_FIND_ALL_GROUPS_ENDPOINT
    • ZDO_EXT_FIND_GROUP
    • ZDO_EXT_ADD_GROUP
    • ZDO_EXT_COUNT_ALL_GROUPS
    • ZDO_EXT_RX_IDLE
    • ZDO_EXT_UPDATE_NWK_KEY
    • ZDO_EXT_SWITCH_NWK_KEY
    • ZDO_EXT_NWK_INFO
    • ZDO_EXT_SEC_APS_REMOVE_REQ
    • ZDO_FORCE_CONCENTRATOR_CHANGE
    • ZDO_EXT_SET_PARAMS

Check ZDO Request: ZDO_MGMT_PERMIT_JOIN_REQ

ZigBee MT Cmd: ZDO_MGMT_PERMIT_JOIN_REQ
cc-znp CmdId: mgmtPermitJoinReq
Arguments: { dstaddr, duration, tcsignificance }

But MT-API guide says the argument should be: { addrmode, dstaddr, duration, tcsignificance }

image

Check AF Indication: AF_INCOMING_MSG_EXT

ZigBee MT Cmd: AF_INCOMING_MSG_EXT
cc-znp msg.ind: incomingMsgExt

Check the argument len. If a large data length causes the MT command to exceed MT_RPC_DATA_MAX, then zero bytes of the data shall be sent with this request.

1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.