Go to Post Blasphemy! Everyone knows Mountain Dew is roboteer fuel. - Racer26 [more]
Home
Go Back   Chief Delphi > Technical > Electrical > CAN
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Spotlight this post!  
Unread 27-02-2010, 03:23
imac256 imac256 is offline
Registered User
AKA: Ian McInerney
FRC #2022 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jun 2009
Rookie Year: 2009
Location: Aurora, IL
Posts: 30
imac256 is a glorious beacon of lightimac256 is a glorious beacon of lightimac256 is a glorious beacon of lightimac256 is a glorious beacon of lightimac256 is a glorious beacon of light
Re: CAN Jaguar enhancements

A couple of things:

1st:
The device number is set in the setTransaction method in the sendMessage call. Here is the code for that from Rev 50.
Code:
    byte setTransaction(int messageID, byte[] data, byte dataSize) {
        int ackMessageID = LM_API_ACK | m_deviceNumber;

        // Make sure we don't have more than one transaction with the same Jaguar outstanding.
        synchronized (m_transactionSemaphore) {
            // Throw away any stale acks.
//            receiveMessage(ackMessageID, kNoData, 10.0);
            // Send the message with the data.
            sendMessage(messageID | m_deviceNumber, data, dataSize);
            // Wait for an ack.
//            dataSize = receiveMessage(ackMessageID, kNoData, 0.0);
        }
        return dataSize;
The Bitwise OR operation in the sendMessage call appends the device number to the messageID field, so the sync routine should work since sendMessage is called directly.

The trusted messages feature works because they use a bitwise AND statement to determine the messageID for comparison, so this line:
Code:
if ((kFullMessageIDMask & messageID) == kTrustedMessages[i]) {
basically removes the device number from the ID temporarily for the check against the message headers to determine if it is trusted or not and then goes from there.

2nd:
I think that you might want to include more than just the API call in the messageID. For the syncronization program I am writing for my team in C++ I include every field so that my final message ID is this:
Code:
#define CAN_MSGID_MFR_BCAST         0x00000000    //Define the Broadcast manufacturer
//Define the Syncronization message Header
#define LM_API_SYNC       CAN_MSGID_DTYPE_BCAST | CAN_MSGID_MFR_BCAST| CAN_MSGID_API_SYNC
Unfortunately I have not had much time to actually test it thoroughly, but I believe it works. I will have to fire up the cRIO and some Jaguars that we kept this week to see what happens.

That is all that I notice right now, but with more information about what the Jaguars are doing we should be able to help more.

-Ian McInerney
Programmer, Team 2022
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CAN Jaguar Malfunction PranavSathy CAN 4 21-02-2010 18:32
CAN Jaguar Synchronous Updates?? Bryscus Programming 3 30-01-2010 16:13
Getting started with CAN/Jaguar CVassos Programming 1 27-01-2010 23:43
CAN bus Jaguar intermittent errors bear1511 Programming 1 27-01-2010 22:49
Black Jaguar RS232->CAN - anyone? oddjob C/C++ 12 22-01-2010 16:25


All times are GMT -5. The time now is 02:55.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi