Project logs before sleep... I have issues...

A project log for CANcrusher Car Hack / Development Platform

CANcrusher is an Open Source CANbus development system for hackers and developers interested in a low-cost alternative to the $$$$ systems.

davidDavid 08/15/2015 at 09:270 Comments

Worked through some of the major software architecture "snakes" this week. I have the basis of a communication protocol between the CANcrusher and the computer/tablet/whatever whether it's via USB or bluetooth. One of the hurdles I wanted to deal with was how to buffer the transmitted data, how much to buffer, etc. When CAN messages are flowing into the stream in 170-200us bursts and there are multiple CAN channels being monitored and sent off or logged, some of the packets have to be buffered. Since I'm using RawHID for the USB interface, I'm limited to 64 byte frames. I like using circular buffers for this type of thing, but I didn't want a single big buffer of all the frame bytes mashed into a single holding array and I didn't want some kind of rolling buffer of arrays. Instead I ended implementing a circular buffer of array pointers, addresses to the head and tail buffers. This seems to work well. The goal (crazy as it sounds) is to have the basic structure of this concept working this weekend and implemented on both a simple Java app and in the CANcrusher. We'll see how it goes...