just checked repo, you have an outdated version your overriding. setTx was changed to setTX couple updates ago. use github copy with latest patch
Ahh okay, I had the version shipped with TD1.52
I'll download the latest from Github and retry. Thx!
just checked repo, you have an outdated version your overriding. setTx was changed to setTX couple updates ago. use github copy with latest patch
Happy to try and help with my basic knowledge of vehicle oriented CAN - what are you trying to extract from the data?so after trying the transceiver connected to a car and printing data to an sd card it seems to work.
now using the can data is where it looks like the learning curve goes vertical
Happy to try and help with my basic knowledge of vehicle oriented CAN - what are you trying to extract from the data?
CAN1 MB: 3 ID: 0x200 EXT: 0 LEN: 8 DATA: 0 20 0 0 0 0 0 0 TS: 11576
CAN1 MB: 0 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 60011
CAN1 MB: 1 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 3611
CAN1 MB: 2 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 102 TS: 10797
CAN1 MB: 3 ID: 0x312 EXT: 0 LEN: 8 DATA: 8 47 8 47 9 189 7 156 TS: 37056
CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 103 TS: 20802
CAN1 MB: 1 ID: 0x210 EXT: 0 LEN: 8 DATA: 0 0 0 64 0 0 0 255 TS: 26693
CAN1 MB: 2 ID: 0x416 EXT: 0 LEN: 8 DATA: 114 0 0 0 0 0 0 0 TS: 33619
CAN1 MB: 3 ID: 0x608 EXT: 0 LEN: 8 DATA: 53 0 24 195 255 1 171 0 TS: 1734
CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 106 TS: 50781
CAN1 MB: 1 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 167 TS: 56434
CAN1 MB: 2 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 63509
CAN1 MB: 3 ID: 0x200 EXT: 0 LEN: 8 DATA: 0 116 0 0 0 0 0 0 TS: 26022
CAN1 MB: 0 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 8921
CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 109 TS: 15243
CAN1 MB: 2 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 13 TS: 20886
CAN1 MB: 3 ID: 0x608 EXT: 0 LEN: 8 DATA: 53 0 24 195 255 1 163 0 TS: 51585
CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 111 TS: 35223
CAN1 MB: 1 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 193 TS: 40877
CAN1 MB: 2 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 48917
CAN1 MB: 3 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 12556
CAN1 MB: 0 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 133 TS: 60869
CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 114 TS: 65246
CAN1 MB: 2 ID: 0x212 EXT: 0 LEN: 8 DATA: 5 95 0 0 104 69 0 0 TS: 5554
CAN1 MB: 3 ID: 0x608 EXT: 0 LEN: 8 DATA: 53 0 24 195 255 1 160 0 TS: 36080
CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 116 TS: 19702
CAN1 MB: 1 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 107 TS: 25320
CAN1 MB: 2 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 32385
CAN1 MB: 3 ID: 0x200 EXT: 0 LEN: 8 DATA: 0 92 0 0 0 0 0 0 TS: 60451
CAN1 MB: 0 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 43368
CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 119 TS: 49677
CAN1 MB: 2 ID: 0x443 EXT: 0 LEN: 6 DATA: 1 0 0 0 0 0 TS: 58927
CAN1 MB: 3 ID: 0x608 EXT: 0 LEN: 8 DATA: 53 0 24 195 255 1 161 0 TS: 20485
CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 121 TS: 4115
CAN1 MB: 1 ID: 0x212 EXT: 0 LEN: 8 DATA: 5 95 0 0 104 69 0 0 TS: 9984
CAN1 MB: 2 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 17812
CAN1 MB: 3 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 46989
CAN1 MB: 0 ID: 0x210 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 255 TS: 29720
CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 124 TS: 34126
CAN1 MB: 2 ID: 0x584 EXT: 0 LEN: 1 DATA: 192 TS: 43545
CAN1 MB: 3 ID: 0x608 EXT: 0 LEN: 8 DATA: 53 0 24 195 255 1 164 0 TS: 4829
CAN1 MB: 0 ID: 0x443 EXT: 0 LEN: 6 DATA: 1 0 0 0 0 0 TS: 54052
CAN1 MB: 1 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 47 TS: 59790
CAN1 MB: 2 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 1283
CAN1 MB: 3 ID: 0x443 EXT: 0 LEN: 6 DATA: 1 0 0 0 0 0 TS: 29500
CAN1 MB: 0 ID: 0x210 EXT: 0 LEN: 8 DATA: 0 0 0 64 0 0 0 255 TS: 14095
CAN1 MB: 1 ID: 0x416 EXT: 0 LEN: 8 DATA: 115 0 0 0 0 0 0 0 TS: 21409
CAN1 MB: 2 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 130 TS: 28599
CAN1 MB: 3 ID: 0x608 EXT: 0 LEN: 8 DATA: 53 0 24 195 255 1 158 0 TS: 54773
CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 131 TS: 38583
CAN1 MB: 1 ID: 0x308 EXT: 0 LEN: 8 DATA: 128 5 215 0 0 53 255 0 TS: 44419
CAN1 MB: 2 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 52272
CAN1 MB: 3 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 15899
CAN1 MB: 0 ID: 0x210 EXT: 0 LEN: 8 DATA: 0 0 0 64 0 0 0 255 TS: 64041
CAN1 MB: 1 ID: 0x416 EXT: 0 LEN: 8 DATA: 114 0 0 0 0 0 0 0 TS: 5851
CAN1 MB: 2 ID: 0x584 EXT: 0 LEN: 1 DATA: 192 TS: 12430
CAN1 MB: 3 ID: 0x608 EXT: 0 LEN: 8 DATA: 53 0 24 195 255 1 158 0 TS: 39112
CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 136 TS: 23047
CAN1 MB: 1 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 227 TS: 28665
CAN1 MB: 2 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 35722
CAN1 MB: 3 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 1186
CAN1 MB: 0 ID: 0x308 EXT: 0 LEN: 8 DATA: 128 5 210 0 0 53 255 0 TS: 48970
CAN1 MB: 1 ID: 0x416 EXT: 0 LEN: 8 DATA: 114 0 0 0 0 0 0 0 TS: 55849
CAN1 MB: 2 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 140 TS: 63049
CAN1 MB: 3 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 30207
CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 141 TS: 7508
CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 142 TS: 17512
CAN1 MB: 2 ID: 0x584 EXT: 0 LEN: 1 DATA: 192 TS: 26886
CAN1 MB: 3 ID: 0x312 EXT: 0 LEN: 8 DATA: 8 38 8 43 9 186 7 156 TS: 53199
CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 144 TS: 37509
CAN1 MB: 1 ID: 0x308 EXT: 0 LEN: 8 DATA: 128 5 207 0 0 53 255 0 TS: 43034
CAN1 MB: 2 ID: 0x443 EXT: 0 LEN: 6 DATA: 1 0 0 0 0 0 TS: 49651
CAN1 MB: 3 ID: 0x312 EXT: 0 LEN: 8 DATA: 8 35 8 33 9 186 7 156 TS: 17622
CAN1 MB: 0 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 61173
CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 147 TS: 1959
CAN1 MB: 2 ID: 0x443 EXT: 0 LEN: 6 DATA: 1 0 0 0 0 0 TS: 14306
CAN1 MB: 3 ID: 0x200 EXT: 0 LEN: 8 DATA: 0 24 0 53 0 54 0 53 TS: 42752
CAN1 MB: 0 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 25624
CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 150 TS: 31966
CAN1 MB: 2 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 47 TS: 37595
CAN1 MB: 3 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 133 TS: 2044
CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 152 TS: 51982
CAN1 MB: 1 ID: 0x210 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 255 TS: 57090
CAN1 MB: 2 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 64643
CAN1 MB: 3 ID: 0x200 EXT: 0 LEN: 8 DATA: 0 108 0 55 0 56 0 55 TS: 27207
CAN1 MB: 0 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 10094
CAN1 MB: 1 ID: 0x584 EXT: 0 LEN: 1 DATA: 192 TS: 15800
CAN1 MB: 2 ID: 0x308 EXT: 0 LEN: 8 DATA: 128 5 193 0 0 53 255 0 TS: 21763
CAN1 MB: 3 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 47 TS: 51951
CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 157 TS: 36424
CAN1 MB: 1 ID: 0x312 EXT: 0 LEN: 8 DATA: 8 32 8 37 9 180 7 154 TS: 41818
CAN1 MB: 2 ID: 0x443 EXT: 0 LEN: 6 DATA: 1 0 0 0 0 0 TS: 49863
CAN1 MB: 3 ID: 0x200 EXT: 0 LEN: 8 DATA: 0 0 0 57 0 58 0 57 TS: 11645
CAN1 MB: 0 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 60076
CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 160 TS: 890
CAN1 MB: 2 ID: 0x312 EXT: 0 LEN: 8 DATA: 8 38 8 36 9 180 7 154 TS: 6494
CAN1 MB: 3 ID: 0x312 EXT: 0 LEN: 8 DATA: 8 41 8 41 9 183 7 156 TS: 36480
CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 162 TS: 20875
FIFO Disabled
Mailboxes:
MB0 code: RX_EMPTY (Standard Frame)
MB1 code: RX_EMPTY (Standard Frame)
MB2 code: RX_EMPTY (Standard Frame)
MB3 code: RX_EMPTY (Standard Frame)
MB4 code: TX_INACTIVE
MB5 code: TX_INACTIVE
MB6 code: TX_INACTIVE
MB7 code: TX_INACTIVE
MB8 code: TX_INACTIVE
MB9 code: TX_INACTIVE
#include <FlexCAN_T4.h>
#include <elapsedMillis.h>
FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_128> LCAN;
elapsedMillis tsk1000msCounter;
CAN_message_t msg0E0;
void setup() {
LCAN.begin();
LCAN.setClock(CLK_60MHz);
LCAN.setBaudRate(500000);
LCAN.setMaxMB(10);
LCAN.setMB(MB0, RX); /* Set Mailbox RX Direction */
LCAN.setMB(MB1, RX); /* Set Mailbox RX Direction */
LCAN.setMB(MB2, RX); /* Set Mailbox RX Direction */
for (int i = 4; i < 10; i++) LCAN.setMB((FLEXCAN_MAILBOX)(i), TX); /* Set Mailbox TX Direction */
msg0E0.id = 0x0E0;
msg0E0.len = 5; // Data length
Serial.begin(1000000); delay(1000);
Serial.print("LCAN Setup: ");
LCAN.mailboxStatus();
}
void loop() {
if (tsk1000msCounter >= 1000) {
tsk1000msCounter = 0; // Reset 1000ms timer
msg0E0.buf[0]++;
LCAN.write(msg0E0);
}
}
Time Chn ID Counter Dir DLC Data Frame Duration Diff Time
1.06017148 CAN 1 E0 3 Rx 5 07 00 00 00 00 0.194 ms (97 bits) 1.05811794
1.06036166 CAN 1 E0 4 Rx 5 08 00 00 00 00 0.190 ms (95 bits) 0.00019017
3.06014850 CAN 1 E0 5 Rx 5 09 00 00 00 00 0.190 ms (95 bits) 1.99978684
3.06033867 CAN 1 E0 6 Rx 5 0A 00 00 00 00 0.190 ms (95 bits) 0.00019017
5.06012951 CAN 1 E0 7 Rx 5 0B 00 00 00 00 0.190 ms (95 bits) 1.99979084
5.06031967 CAN 1 E0 8 Rx 5 0C 00 00 00 00 0.190 ms (95 bits) 0.00019016
7.06010653 CAN 1 E0 9 Rx 5 0D 00 00 00 00 0.188 ms (94 bits) 1.99978686
7.06029470 CAN 1 E0 10 Rx 5 0E 00 00 00 00 0.188 ms (94 bits) 0.00018817
EDIT, msadie the count and increments look correct, but that would mean that scope would have to be called twice, perhaps an elapsedmillis bug? can you try using millis() instead? if this were a bug the library is not capable of incrementing a pattern that the loop is totally in control of
I dont understandIve got comma for that
just some basic stuff to start with would be good to try and get a bit more of an understanding (things like engine rpm ,coolant temp, vehicle speed)
i've kinda got the grasp that there are two versions that seem to appear on cars (message IDs can be 11bit and 29 bit) and the data length is some where between 1 and 8 bytes.
having looked through the wiki on OBDII PID's and watching a load of videos on YT but it just sort seems like of people just quote the wiki without actually explaining as i would of thought that basic data should be fairly universal across all cars with the amount of generic Bluetooth readers but i might be looking at this the wrong way.
It also seems that the data needs to be requested by sending a low priority message with an id around the 0x7e* range which might be what those cheap BT readers do or it might be software side.
this is a sample of the data that was just on the CAN(this is from a 2006 Mitsubishi). I imported it to openoffice calc and tried to break it down and it looks like 0x608 may contain coolant temp data in the first byte as it seemed to start off low (53) and leveled off at (130 ish) then when i did a second run it started (86) then leveled off at (130 ish) again but i guess these will require some sort of calculation (like those shown in the wiki page)
i'm going to see if i can set the writing to SD card to increment the file name so the data doesn't get confused and too large.
Code:CAN1 MB: 3 ID: 0x200 EXT: 0 LEN: 8 DATA: 0 20 0 0 0 0 0 0 TS: 11576 CAN1 MB: 0 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 60011 CAN1 MB: 1 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 3611 CAN1 MB: 2 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 102 TS: 10797 CAN1 MB: 3 ID: 0x312 EXT: 0 LEN: 8 DATA: 8 47 8 47 9 189 7 156 TS: 37056 CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 103 TS: 20802 CAN1 MB: 1 ID: 0x210 EXT: 0 LEN: 8 DATA: 0 0 0 64 0 0 0 255 TS: 26693 CAN1 MB: 2 ID: 0x416 EXT: 0 LEN: 8 DATA: 114 0 0 0 0 0 0 0 TS: 33619 CAN1 MB: 3 ID: 0x608 EXT: 0 LEN: 8 DATA: 53 0 24 195 255 1 171 0 TS: 1734 CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 106 TS: 50781 CAN1 MB: 1 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 167 TS: 56434 CAN1 MB: 2 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 63509 CAN1 MB: 3 ID: 0x200 EXT: 0 LEN: 8 DATA: 0 116 0 0 0 0 0 0 TS: 26022 CAN1 MB: 0 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 8921 CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 109 TS: 15243 CAN1 MB: 2 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 13 TS: 20886 CAN1 MB: 3 ID: 0x608 EXT: 0 LEN: 8 DATA: 53 0 24 195 255 1 163 0 TS: 51585 CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 111 TS: 35223 CAN1 MB: 1 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 193 TS: 40877 CAN1 MB: 2 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 48917 CAN1 MB: 3 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 12556 CAN1 MB: 0 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 133 TS: 60869 CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 114 TS: 65246 CAN1 MB: 2 ID: 0x212 EXT: 0 LEN: 8 DATA: 5 95 0 0 104 69 0 0 TS: 5554 CAN1 MB: 3 ID: 0x608 EXT: 0 LEN: 8 DATA: 53 0 24 195 255 1 160 0 TS: 36080 CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 116 TS: 19702 CAN1 MB: 1 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 107 TS: 25320 CAN1 MB: 2 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 32385 CAN1 MB: 3 ID: 0x200 EXT: 0 LEN: 8 DATA: 0 92 0 0 0 0 0 0 TS: 60451 CAN1 MB: 0 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 43368 CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 119 TS: 49677 CAN1 MB: 2 ID: 0x443 EXT: 0 LEN: 6 DATA: 1 0 0 0 0 0 TS: 58927 CAN1 MB: 3 ID: 0x608 EXT: 0 LEN: 8 DATA: 53 0 24 195 255 1 161 0 TS: 20485 CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 121 TS: 4115 CAN1 MB: 1 ID: 0x212 EXT: 0 LEN: 8 DATA: 5 95 0 0 104 69 0 0 TS: 9984 CAN1 MB: 2 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 17812 CAN1 MB: 3 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 46989 CAN1 MB: 0 ID: 0x210 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 255 TS: 29720 CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 124 TS: 34126 CAN1 MB: 2 ID: 0x584 EXT: 0 LEN: 1 DATA: 192 TS: 43545 CAN1 MB: 3 ID: 0x608 EXT: 0 LEN: 8 DATA: 53 0 24 195 255 1 164 0 TS: 4829 CAN1 MB: 0 ID: 0x443 EXT: 0 LEN: 6 DATA: 1 0 0 0 0 0 TS: 54052 CAN1 MB: 1 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 47 TS: 59790 CAN1 MB: 2 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 1283 CAN1 MB: 3 ID: 0x443 EXT: 0 LEN: 6 DATA: 1 0 0 0 0 0 TS: 29500 CAN1 MB: 0 ID: 0x210 EXT: 0 LEN: 8 DATA: 0 0 0 64 0 0 0 255 TS: 14095 CAN1 MB: 1 ID: 0x416 EXT: 0 LEN: 8 DATA: 115 0 0 0 0 0 0 0 TS: 21409 CAN1 MB: 2 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 130 TS: 28599 CAN1 MB: 3 ID: 0x608 EXT: 0 LEN: 8 DATA: 53 0 24 195 255 1 158 0 TS: 54773 CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 131 TS: 38583 CAN1 MB: 1 ID: 0x308 EXT: 0 LEN: 8 DATA: 128 5 215 0 0 53 255 0 TS: 44419 CAN1 MB: 2 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 52272 CAN1 MB: 3 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 15899 CAN1 MB: 0 ID: 0x210 EXT: 0 LEN: 8 DATA: 0 0 0 64 0 0 0 255 TS: 64041 CAN1 MB: 1 ID: 0x416 EXT: 0 LEN: 8 DATA: 114 0 0 0 0 0 0 0 TS: 5851 CAN1 MB: 2 ID: 0x584 EXT: 0 LEN: 1 DATA: 192 TS: 12430 CAN1 MB: 3 ID: 0x608 EXT: 0 LEN: 8 DATA: 53 0 24 195 255 1 158 0 TS: 39112 CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 136 TS: 23047 CAN1 MB: 1 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 227 TS: 28665 CAN1 MB: 2 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 35722 CAN1 MB: 3 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 1186 CAN1 MB: 0 ID: 0x308 EXT: 0 LEN: 8 DATA: 128 5 210 0 0 53 255 0 TS: 48970 CAN1 MB: 1 ID: 0x416 EXT: 0 LEN: 8 DATA: 114 0 0 0 0 0 0 0 TS: 55849 CAN1 MB: 2 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 140 TS: 63049 CAN1 MB: 3 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 30207 CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 141 TS: 7508 CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 142 TS: 17512 CAN1 MB: 2 ID: 0x584 EXT: 0 LEN: 1 DATA: 192 TS: 26886 CAN1 MB: 3 ID: 0x312 EXT: 0 LEN: 8 DATA: 8 38 8 43 9 186 7 156 TS: 53199 CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 144 TS: 37509 CAN1 MB: 1 ID: 0x308 EXT: 0 LEN: 8 DATA: 128 5 207 0 0 53 255 0 TS: 43034 CAN1 MB: 2 ID: 0x443 EXT: 0 LEN: 6 DATA: 1 0 0 0 0 0 TS: 49651 CAN1 MB: 3 ID: 0x312 EXT: 0 LEN: 8 DATA: 8 35 8 33 9 186 7 156 TS: 17622 CAN1 MB: 0 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 61173 CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 147 TS: 1959 CAN1 MB: 2 ID: 0x443 EXT: 0 LEN: 6 DATA: 1 0 0 0 0 0 TS: 14306 CAN1 MB: 3 ID: 0x200 EXT: 0 LEN: 8 DATA: 0 24 0 53 0 54 0 53 TS: 42752 CAN1 MB: 0 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 25624 CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 150 TS: 31966 CAN1 MB: 2 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 47 TS: 37595 CAN1 MB: 3 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 133 TS: 2044 CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 152 TS: 51982 CAN1 MB: 1 ID: 0x210 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 255 TS: 57090 CAN1 MB: 2 ID: 0x423 EXT: 0 LEN: 6 DATA: 3 0 0 9 22 111 TS: 64643 CAN1 MB: 3 ID: 0x200 EXT: 0 LEN: 8 DATA: 0 108 0 55 0 56 0 55 TS: 27207 CAN1 MB: 0 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 10094 CAN1 MB: 1 ID: 0x584 EXT: 0 LEN: 1 DATA: 192 TS: 15800 CAN1 MB: 2 ID: 0x308 EXT: 0 LEN: 8 DATA: 128 5 193 0 0 53 255 0 TS: 21763 CAN1 MB: 3 ID: 0xC0 EXT: 0 LEN: 5 DATA: 228 0 0 7 47 TS: 51951 CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 0 157 TS: 36424 CAN1 MB: 1 ID: 0x312 EXT: 0 LEN: 8 DATA: 8 32 8 37 9 180 7 154 TS: 41818 CAN1 MB: 2 ID: 0x443 EXT: 0 LEN: 6 DATA: 1 0 0 0 0 0 TS: 49863 CAN1 MB: 3 ID: 0x200 EXT: 0 LEN: 8 DATA: 0 0 0 57 0 58 0 57 TS: 11645 CAN1 MB: 0 ID: 0x1E1 EXT: 0 LEN: 8 DATA: 0 0 0 0 0 0 0 0 TS: 60076 CAN1 MB: 1 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 160 TS: 890 CAN1 MB: 2 ID: 0x312 EXT: 0 LEN: 8 DATA: 8 38 8 36 9 180 7 154 TS: 6494 CAN1 MB: 3 ID: 0x312 EXT: 0 LEN: 8 DATA: 8 41 8 41 9 183 7 156 TS: 36480 CAN1 MB: 0 ID: 0x2 EXT: 0 LEN: 2 DATA: 1 162 TS: 20875
LCAN Setup: FIFO Disabled
Mailboxes:
MB0 code: RX_FULL
MB1 code: RX_FULL
MB2 code: RX_FULL
MB3 code: RX_OVERRUN
MB4 code: TX_INACTIVE
MB5 code: TX_INACTIVE
MB6 code: TX_INACTIVE
MB7 code: TX_INACTIVE
MB8 code: TX_INACTIVE
MB9 code: TX_INACTIVE
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 50688 ID: E0 Buffer: 2E 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 26401 ID: E0 Buffer: 2F 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 2114 ID: E0 Buffer: 30 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 43363 ID: E0 Buffer: 31 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 19076 ID: E0 Buffer: 32 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 60325 ID: E0 Buffer: 33 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 36038 ID: E0 Buffer: 34 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 11751 ID: E0 Buffer: 35 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 53000 ID: E0 Buffer: 36 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 28713 ID: E0 Buffer: 37 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 4426 ID: E0 Buffer: 38 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 45675 ID: E0 Buffer: 39 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 21388 ID: E0 Buffer: 3A 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 62637 ID: E0 Buffer: 3B 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 38350 ID: E0 Buffer: 3C 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 14063 ID: E0 Buffer: 3D 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 55312 ID: E0 Buffer: 3E 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 31025 ID: E0 Buffer: 3F 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 6738 ID: E0 Buffer: 40 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 47988 ID: E0 Buffer: 41 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 23701 ID: E0 Buffer: 42 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 64950 ID: E0 Buffer: 43 0 0 0 0
After some tests, I'm fairly certain the reason your different results was your test had other bus traffic. If teensy node running the sample code is TX'ing to a bus with only receiving nodes (for ack only, no TX), then i see the anomaly. If another node on the bus is transmitting, the incoming message seems to dislodge the stuck TX message. Can you please try this again with a quiet bus to check that case?they are full and overrun because no callback was made and nothing was removing frames from MB, in your demo.
void loop() {
// Your existing code here
static uint32_t timeout = millis();
if ( millis() - timeout > 1000 ) {
Serial.print("CAN1.ECR.TX_ERR_COUNTER: "); Serial.println(uint16_t(FLEXCAN_ECR_TX_ERR_COUNTER(FLEXCANb_ECR(CAN1))));
Serial.print("CAN1.ECR.RX_ERR_COUNTER: "); Serial.println(uint16_t(FLEXCAN_ECR_RX_ERR_COUNTER(FLEXCANb_ECR(CAN1))));
Serial.print("CAN1.ESR1: 0x"); Serial.println(uint32_t(FLEXCANb_ESR1(CAN1)),HEX);
timeout = millis();
}
}
#include <FlexCAN_T4.h>
#include <elapsedMillis.h>
FlexCAN_T4<CAN3, RX_SIZE_256, TX_SIZE_128> LCAN;
elapsedMillis tsk1000msCounter;
CAN_message_t msg0E0;
void setup() {
LCAN.begin();
LCAN.setClock(CLK_60MHz);
LCAN.setBaudRate(500000);
LCAN.setMaxMB(10);
LCAN.setMB(MB0, RX); /* Set Mailbox RX Direction */
LCAN.setMB(MB1, RX); /* Set Mailbox RX Direction */
LCAN.setMB(MB2, RX); /* Set Mailbox RX Direction */
for (int i = 4; i < 10; i++) LCAN.setMB((FLEXCAN_MAILBOX)(i), TX); /* Set Mailbox TX Direction */
msg0E0.id = 0x0E0;
msg0E0.len = 5; // Data length
Serial.begin(500000); delay(1000);
LCAN.onReceive(canSniff);
LCAN.enableMBInterrupts();
Serial.print("LCAN Setup: ");
LCAN.mailboxStatus();
}
void loop() {
if (tsk1000msCounter >= 1000) {
tsk1000msCounter = 0; // Reset 1000ms timer
msg0E0.buf[0]++;
LCAN.write(msg0E0);
}
}
void canSniff(const CAN_message_t &msg) {
Serial.print("MB "); Serial.print(msg.mb);
Serial.print(" OVERRUN: "); Serial.print(msg.flags.overrun);
Serial.print(" LEN: "); Serial.print(msg.len);
Serial.print(" EXT: "); Serial.print(msg.flags.extended);
Serial.print(" RTR: "); Serial.print(msg.flags.remote);
Serial.print(" TS: "); Serial.print(msg.timestamp);
Serial.print(" ID: "); Serial.print(msg.id, HEX);
Serial.print(" Buffer: ");
for ( uint8_t i = 0; i < msg.len; i++ ) {
Serial.print(msg.buf[i], HEX); Serial.print(" ");
} Serial.println();
static uint32_t _time = millis();
Serial.print("Time between frames: ");
Serial.println(millis() - _time);
_time = millis();
}
LCAN Setup: FIFO Disabled
Mailboxes:
MB0 code: RX_EMPTY (Standard Frame)
MB1 code: RX_EMPTY (Standard Frame)
MB2 code: RX_EMPTY (Standard Frame)
MB3 code: RX_EMPTY (Standard Frame)
MB4 code: TX_INACTIVE
MB5 code: TX_INACTIVE
MB6 code: TX_INACTIVE
MB7 code: TX_INACTIVE
MB8 code: TX_INACTIVE
MB9 code: TX_INACTIVE
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 165 ID: E0 Buffer: 60 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 41415 ID: E0 Buffer: 61 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 17129 ID: E0 Buffer: 62 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 58379 ID: E0 Buffer: 63 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 34093 ID: E0 Buffer: 64 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 9807 ID: E0 Buffer: 65 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 51057 ID: E0 Buffer: 66 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 26771 ID: E0 Buffer: 67 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 2485 ID: E0 Buffer: 68 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 43735 ID: E0 Buffer: 69 0 0 0 0
Time between frames: 1000
MB 99 OVERRUN: 0 LEN: 5 EXT: 0 RTR: 0 TS: 19449 ID: E0 Buffer: 6A 0 0 0 0
[COLOR="#FF0000"]Time between frames: 1000[/COLOR]