Login  Register

Re: Custom CDC to SID text

Posted by Karlis on Sep 22, 2016; 4:38am
URL: http://bluesaab-forum.90.s1.nabble.com/Custom-CDC-to-SID-text-tp90p683.html

So I think I've made some progress.

Here are my findings.

In order for a node to write on SID, it "has" to ask for a grant from SID to access a certain resource (0-both rows of SID, 1-top row, 2-bottom row).
This is achieved by sending a display resource request frame, which looks something like this:

<node ID> : NODE_APL_ADR,0x02,0x01,NODE_SID_FUNCTION_ID,0x00,0x00,0x00,0x00

Only four bytes. 0x02 means the requested object on SID (bottom row in this case). 0x01 means what type of message does the node want to write on SID. For now I'm assuming that 0x01 means "Test" and 0x05 means "Static text".

So the frame mentioned above would translate in "hey, I would like to write a test message on bottom row of the SID". If we want to write on SID, we have to ask for a grant, but no more frequently than every 1000ms. We may not start writing on SID if we haven't received a grant. Doing so will make all the nodes on the bus unhappy.

Once SID is happy and gives us a grant, the frame itself would look something like this:

0x368 : 0x02,NODE_SID_FUNCTION_ID,0x00,0x00,0x00,0x00,0x00,0x00,0x00

This literally means "go ahead, node with function ID x, you have been given grant to write on object (row) 2 of SID"

Then the node interested in writing to SID sends a group of three frames with ~35ms interval. This would look something like this:

<node->SID control ID> : 0x42,0x96,0x02,ASCII[0],ASCII[1],ASCII[2],ASCII[3],ASCII[4]
<node->SID control ID> : 0x01,0x96,0x02,ASCII[5],ASCII[6],ASCII[7],ASCII[8],ASCII[9]
<node->SID control ID> : 0x00,0x96,0x02,ASCII[10],ASCII[11],ASCII[12],ASCII[13],ASCII[14]

Bytes 0x42, 0x01 and 0x00 represent the frame sequence
Byte 0x96 is the address of SID
Byte 0x02 means that the frame has been sent on basetime (every 1000ms). If this byte is 0x82, that means that the particular frame has been sent on an event (text on SID has changed) and the whole basetime timing after this needs to be reset.

ASCII chars...the actual message.

Now here's the tricky part

SID can only show 12 characters on each row, but we need to send 15 to form a proper group of frames. So before sending the actual text, it needs to be "stripped" (zeroed out) of anything that's exceeding 12 chars. If this is not done, SID will be unhappy... :)

I may be wrong in some assumptions, but so far using these ideas I have been able to have custom SID text displayed without any flickering.
2001 9-5 SE V6; 2006 9-5 Wagon; iOS; BlueSaab version = "latest and greatest" :)