µTasker Forum
µTasker Forum => NXPTM M522XX, KINETIS and i.MX RT => Topic started by: tr111 on November 29, 2007, 03:16:01 AM
-
I have success in doing send the data from the CAN-bus using Utasker!
the Utasker is great!
like this:
static void fnConfigCAN_BUS(void)
{
CANTABLE tCANParameters; // table for passing information to driver
tCANParameters.Task_to_wake = OWN_TASK; // wake us on buffer events
tCANParameters.Channel = 0; // first hardware interface
tCANParameters.ulSpeed = 100000; // 100K speed
tCANParameters.ulTxID = 0x000; // default ID of destination
tCANParameters.ulRxID = (CAN_EXTENDED_ID | 0x00000105); // our ID
tCANParameters.ulRxIDMask = CAN_EXTENDED_MASK;
// use all bits for compare
tCANParameters.usMode = 0x00; // 1 use for lpb mode
tCANParameters.ucTxBuffers = 2; // assign two tx buffers for use
tCANParameters.ucRxBuffers = 3; // assign three rx buffers for use
CAN_interface_ID = fnOpen( TYPE_CAN, FOR_I_O, &tCANParameters );
}
static void fnSENDCAN_BUS(void)
{
unsigned char ucTestMessage[] = {0xab,0xcd,0xef,0x52,0x23,0x5e,7}; // Test message
if (fnWrite(CAN_interface_ID, ucTestMessage, sizeof(ucTestMessage))
!= sizeof(ucTestMessage)) {
// Error. Eg. no transmission buffer free
fnDebugMsg("\n\r SENT ERROR\n\r");
}
I will get some data for the SJA1000!
07 00 00 ab cd ef 52 23 5e 07
the first is the length.
00 00 is the default ID of destination !
Is something question about the default ID of destination !
I don't know why I send the only "unsigned char ucTestMessage[] = {0xab,0xcd,0xef,0x52,0x23,0x5e,7}; "
but get the 07 00 00 ab cd ef 52 23 5e 07! is too more???
the Standard ID[28:18] Extended ID[17:0] is include???????
tCANParameters.ulRxID = (CAN_EXTENDED_ID | 0x00000105); // our ID
how can send to the "our ID"form MY sja1000! the id is the 0x105 or the 0x10500000????
I am not sure?????
The message buffer structure used by the FlexCAN module is shown in Figure 30-13. Both standard andextended frames used in the CAN Specification Version 2.0, Part B are represented. A standard frame isrepresented by the 11-bit standard identifier, and an extended frame is represented by the combined 29-bits of the standard identifier (11 bits) and the extended identifier (18 bits).
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0x0 CODE SRR IDE RTR LENGTH TIME STAMP
0x4 Standard ID[28:18] Extended ID[17:0]
0x8 Data Byte 0 Data Byte 1 Data Byte 2 Data Byte 3
0xC Data Byte 4 Data Byte 5 Data Byte 6 Data Byte 7