View Single Post
  #4   Spotlight this post!  
Unread 17-01-2013, 09:41
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: CAN bus async receive

Quote:
Originally Posted by kenfox View Post
Isochronous status reporting by the Jaguar needs a firmware update, right?
I can't seem to find a CAN message spec for the Jaguar, so all of this is based on reading the LV CAN implementation and trying to figure out the messages.

It looks like almost message contains only one data field. So, if you were to send every data configuration field at 5hz you would probably be good, but there's a lot of overhead (a Complete CAN frame is almost 100 bits for a mere 16 bits of data, you could package an additional 6 bytes for only their space in the message (e.g. adding 6 more bytes to the frame without additional header space) aside from bit stuffing, and the protocol would be more efficient, but unfortunately for most messages it is not efficient.

It looks like there is a Message ID which is OR'd with the jaguar ID to find the CAN message ID.

It looks like the only exception to this is the scheduled status frames. 4 messages (Periodic Status Config 0-3) are built with the 8 bytes corresponding to the byte ID of the data requested. Multibyte data has multiple byte ID's, one per bit. Another transaction (with Ack) is done to set the speed, using Periodic Status Enable 0-3 and a time in milliseconds.

The Jaguar would then return the status data at the frequency you request. The Periodic Status Data 0-3 messages contain 8 bytes corresponding to the byte ID's requested.

It looks like the black box code only stores one message per ID. There are several cases where the comments say 'Skip any previous acks that were ignored' and they do this by executing a Read for the Ack with a timeout of 0 and ignoring the response.

So yeah, if you built a purely isochronous system and sent the configs out at 5hz-20hz, periodic status at varying speed (maybe 100hz for status 0, 50hz status 1, etc. for more important data) and sent the Ackless motor command at 100hz, and never cared about the Ack message, you would be able to use a single thread and monitor them based on their Periodic Status messages in a single thread. They would configure themselves when they booted up within 200ms for the 5hz stuff and 50ms for the 20hz stuff, with no additional code to detect and reconfigure a reset Jaguar.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack