jameswhiteman

Recent activity

Posted in extra byte in ChannelUpdateEvent (9)

My apologies, I interpreted the documentation incorrectly.

On a different note, we are going to be changing the way we have currently implemented nocan. So we are going to break up our board to be individual boards, thus making it more modular. We are looking to have a standard board design that will include the nocan chip the board chip and a optic coupler, from this we will then add what ever sensor we need (rfid/analog ..etc). The board will have edge connectors that will slot into a backing board that will feed the nocan comms and the power feed. So what we will end up with is a rack mounting system.

I was then hoping that you could plug in a board then on a front end interface you can select what kind of board , which updates the device shadow, change of device shadow tells you what board is in what slot connects to S3 downloads appropriate binary for board and deploys, hence being able to ship components with out even needing the binary installed. The problem comes with mapping the nodes. Does the configuration for the nodes sit in .nocand/cache. Does it just increment the nodes? So if I had 10 slots on my backing board and I put a board in slot 9 and had no other boards in the rack, would that device end up as node 1?

Do you see any issues with what we are proposing? (we will be happy to release designs to the opensource project)

Posted in extra byte in ChannelUpdateEvent (9)

Thank you Alain, this is indeed my problem (strip), I was trying to strip away the tab, so just to clarify every event packet will have a 0x09 [tab] then a length byte, then the packet ?
I was expecting it to start with just the event packet e.g. 01 for a channel update
Thank you
James

Started extra byte in ChannelUpdateEvent (9)

Hi Alain,

background

So i'm publishing to a registered channel with the following c++ code, cut and pasted and mixed and matched but for the general idea;

 1// in .h
 2char eventWeightStream[21];
 3// in the .ccp
 4memset(d1station1.eventWeightStream, 0, sizeof(d1station1.eventWeightStream));
 5d1station1.eventWeightStream[0] = d1station1.id;
 6strncat(d1station1.eventWeightStream,d1station1.rfidobj1->readOne,16);
 7d1station1.eventWeightStream[4] = 0x20;
 8int32_t temp = d1station1.weightValueEMA;
 9if (temp <= 0) temp = 0;
10temp = SwapEndian_32(temp);
11memcpy(&d1station1.eventWeightStream[17], &temp, 4);
12
13NocanMessage canMsgS;
14canMsgS.channel_id = getStreamChanId();
15canMsgS.data_len = 21;
16memcpy(canMsgS.data, d1station1.eventWeightStream, 21);
17Nocan.publishMessage(canMsgS);

I'm receiving the message in python using something like the following

1data = s.recv(BUFFER_SIZE).strip()
2# hx =  ''.join([ "%02X" % x for x in data ])
3hx = ''.join([hex(ord(c))[2:].zfill(2) for c in data])
4print(hx)

problem

the printed hex I get is as follows;
1c010003025753150239343220303030303236383736373739000062fd
Notice the 1c ? also I have another event and the data I get back has hex 24 infront of the message eg 24010004.... , orginally I just skipped the first hex byte, and then started reading the message, but then I wanted to add some more data so I added the following to the c++

 1// in .h
 2char eventWeightStream[25];
 3// in the .ccp
 4memset(d1station1.eventWeightStream, 0, sizeof(d1station1.eventWeightStream));
 5d1station1.eventWeightStream[0] = d1station1.id;
 6strncat(d1station1.eventWeightStream,d1station1.rfidobj1->readOne,16);
 7d1station1.eventWeightStream[4] = 0x20;
 8int32_t temp = d1station1.weightValueEMA;
 9if (temp <= 0) temp = 0;
10temp = SwapEndian_32(temp);
11memcpy(&d1station1.eventWeightStream[17], &temp, 4);
12int32_t temp2 = d1station1.weightValueEMA2;
13if (temp2 <= 0) temp2 = 0;
14temp = SwapEndian_32(temp2);
15memcpy(&d1station1.eventWeightStream[21], &temp2, 4);
16
17NocanMessage canMsgS;
18canMsgS.channel_id = getStreamChanId();
19canMsgS.data_len = 25;
20memcpy(canMsgS.data, d1station1.eventWeightStream, 25);
21Nocan.publishMessage(canMsgS);

An then it started to publish without any msyterious byte in front of the message
eg 01000302575315023 .....
So now my code broke because ignoring the first byte throws everything out.

Is this something to do with my poor c++ knowledge or is this something more ?
Kind Regards,
James

Posted in PiMaster doesn't work on the balenaFin

Yeah Nice,
Update:
last night for what ever reason (possibly a low voltage event), the balenaFin dropped out and the node stayed on. Which did result in case 3 So this morning we have the node running, but no comms in or out.
So with the cases presented above I believe the most elegant solution is one that Justin proposed, which is to have a power relay running of the nocan master to the supply of our node. (due to power consumption we wanted to ignore this solution, but I see no alternative)
Alain do you foresee any issues with the solution mentioned above?
Cheers,
James

Posted in PiMaster doesn't work on the balenaFin

OK seem like it allows the node to come up, but at a best guess what is happening is that now the nocand server doesn't even register the node, as nocanc list-nodes and nocanc list-channels returns nothing. Also I can see that our node is running correctly and it publishes data correctly, except the local lambda function that is listening for events on the nocand server receives nothing, which lines up with there being no node or channel.

This could also be because we register the nocan channel when our node boots up in setup

 1NocanChannelId cid1;
 2NocanChannelId cid2;
 3NocanChannelId cid3;
 4NocanMessage msg;
 5void canbusSetup()
 6{
 7    for (;;) 
 8    {
 9        if (Nocan.open()>=0)
10            break;
11        delay(1000);
12    }
13
14    Nocan.registerChannel("AE", &cid1);
15    Nocan.registerChannel("ER", &cid2);
16    Nocan.registerChannel("DT", &cid3);
17}

Which if the nocand now some how allows it to register, yet doesn't actually register the channels (I'm definitely wading out of my depth here)

Are there any options we could put in our side of code ?

FYI, to keep with testing of hardware and logging of data, I rolled back to
nocand version 0.2.4-linux-arm