|
Can
Nov 16, 2020 7:41:58 GMT
via mobile
Post by kotparo on Nov 16, 2020 7:41:58 GMT
Hey Which CAN ID corresponds to the TORQUE_u32ATXTorqueLimit variable? In general how can I know which index of "pu8CANDataBuffer" refers to which CAN Frame?
|
|
|
Can
Nov 20, 2020 13:44:11 GMT
Post by Admin on Nov 20, 2020 13:44:11 GMT
Hi mate,
For now the CAN IDs to monitor are hard coded in DIAG.c.
You can see the u32CANPriorityAddress array (length 4 IDs) are set to 80, 1096, 1088, 428 for the VW DSG. These are the 4 CAN messages that will be monitored.
The 4 x 8 byte received CAN frames are stored in the same order at the u32CANPriorityAddress array order.
So CANID=80, CANID=1096, CANID=1088, CANID=428 received data are stored at buffer pu8CANDataBuffer.
pu8CANBuffer[0] to pu8CANBuffer[7] is data for CANID=80, pu8CANBuffer[8] to pu8CANBuffer[15] is data for CANID=1096, etc.
For the Teensy CAN controller, the CAN buffer is represented by 32-bit values, but these are little endian so the data becomes backwards.
So you will see at the pu8CANBuffer:
CANID=XXX [BYTE1][BYTE2][BYTE3][BYTE4][BYTE5][BYTE6][BYTE7][BYTE8] -------------------------------------------------------------------- CANID=80 [3][2][1][0][7][6][5][4] <- data array index CANID=1096 [11][10][9][8][15][14][13][12] CANID=1088 [19][18][17][16][23][22][21][20] CANID=428 [27][26][25][24][31][30][29][28]
TORQUE_u32ATXTorqueLimit is data array index 16 so that is CANID=1088 4th byte. You can see this from the code.
Hope this helps!
Matthew
|
|