Hello,
As stated in the heading, I’m having trouble with the nod-red ncd MCP23008. The node-red node is not connecting to the physical device. It displays “disconnected”. For the record, I have been able to confirm that AnyI2C v1.2.0 connects to the device and that I can activate all relays on the I2CIO4R4_MCP23008 board.
I’ve inserted a couple of log outputs to a couple of your files and it looks to me like maybe the issue is with the payload sent during initialization. Following is the information pertaining to the inserted log output content:
- Output1:
Filename: <<C:\Users\rts01.node-red\node_modules\ncd-red-comm\lib\NcdSerialI2C.js>>
Function: writeBytes()
writeBytes(addr, reg, …bytes){
if(bytes.constructor != Array) bytes = [bytes];
if(this.version == 3){
var payload = [190, addr, reg];
payload.push.apply(payload, bytes);
//console.log(‘v3 - write bytes’, payload);
return this.send(payload);
}else{
var payload = [addr*2, reg];
payload.push.apply(payload, bytes);
if(this.version == 1) payload.push(0);
// Rod’s code start************************
console.log(“Payload check:”,payload);
// Rod’s code end***************************
return this.send(payload);
}
}
- Output2:
Filename: <<C:\Users\rts01.node-red\node_modules\ncd-red-mcp23008\index.js>>
Function: init()
init(){
Promise.all([
this.comm.writeBytes(this.addr, 0x00, this.iodir),
this.comm.writeBytes(this.addr, 0x06, this.iodir),
this.get()
]).then((r ) => {
this.initialized = true;
}).catch((e) => {
// Rod’s code start************************
console.log(“got node.sensor.initialized error_init”);
console.dir(e);
// Rod’s code end***************************
this.initialized = false;
});
}
- Node-red output data (node-red debug mode):
Following is a screenshot of my setup for the node
Following is my comm log in AnyI2C
Thanks in advance to any help that anyone can offer up. It will certainly be greatly appreciated.
-Rod