Quick little update. I found every so often I would get a failed chunk received from the scantool to ECU kernel when writing. It would occur at the exact moment the scantool sends its first CAN frame which indicates its going to send lots of data.
Out of suspicion, I disabled the kernels tester present message.. and the problem disappeared.
When the scantool sends the request to upload data, the kernel responds back with a flow control message ( 7E8,30,00,00 - As per SAE spec), but instantly after the flow control, the kernel was firing off a tester present frame (As its been over 1 second since last one).
Now the issue with it sending the tester frame instantly after a flow control frame is this cleared the interrupts register flags which included clearing incoming messages flag.
This meant the Kernel was missing the first data frame after the flow control as it was cleared when sending the tester present message. Now to top that off, is the hard coded delay I had after each CAN frame write in the kernel was right on the border of missing the first data frame, so if the kernel detects requiring to send a tester present right after the flow control message, it would then miss that frame from the scantool, hence block write would fail.
Soooooo... a proper CAN transmit check is implemented instead of a (hackish) delay between frames in the write routine.
This then completely trolled me by breaking the ECU reading. The kernel was then firing off CAN frames at absolute max speed (less than half a millisecond apart) so the scantool could not keep up!
A hard coded delay between frames for the read routine is now implemented which has everything working correctly.
Anyways.. wasnt expecting to do more kernel work tonight.. but it was bugging me to see the occasional chunk miss when I know there shouldnt be a reason for it. Only way I justify the time spent is it will be applicable for all future kernels realistically
I am now officially at the absolute maximum kernel size so more additions really isnt possible without moving all variables further up into the ram as the kernel runs right up to the edge of the variables ram location.
As for software updates, I now have implemented a CRC check before writing (no point writing if its a match) along with CRC after writing to ensure its a perfect match. OS writes are currently only using a SUM due to the fairly large wait time for them.
Thats it for tonight! Sorry if the above is a little bit boring!