Closed Stapelzeiger closed 10 years ago
The datagram already contains a CRC, so the parameters are guaranteed to be correct (excluding collisions).
what if you loose a datagram / someone else writes a datagram with the same id?
Well I thought you would put a whole page into one big datagram, so it is CRC checked.
Are we talking about CAN datagrams?
Arf, maybe it was not clear in the specification. Both serial and CAN encapsulates the given datagram format. The CAN transport layer is only used to adapt from message oriented to stream oriented.
Ok, I thought the datagram format was just to be able to send the equivalent of a can frame over a uart byte stream. I think it would be more efficient and simpler to have a different format for CAN.
More efficient ? I think the overhead of the datagram format is really low, if you take into account that the length of the data will be very big most of the time (~1kB if we send one page per datagram).
I don't think it would be simpler to have another format for CAN because it would mean less code reuse between the two versions of the bootloader.
If you have any idea I am open to suggestions.
Since you have multiple bytes in a can frame you don't have to reserve and escape bytes over can. Of course the datagram format for uart would also work over can, but it's not very elegant.
A very simple protocol over can would be to use one of the can-id bits as a first-frame-of-datagram indicator and just put all the bytes in the can frame without any transformation.
How would you handle lost frames in a given datagram ?
via a crc Edit: could be transmitted in the first frame for example
So the format would look like this ?
That's ok for me, it is almost the same format as for the UART (except start marker escaping).
Yes, that would work
After discussing, I propose the following format for CAN messages ID :
Then for the datagram format I propose the following :
Ok for you ?
I suggest the write command also sends a crc, so that a erroneous page is never written to flash.