Forum Rule: Always post complete source code & details to reproduce any issue!
Page 31 of 32 FirstFirst ... 21 29 30 31 32 LastLast
Results 751 to 775 of 788

Thread: FlexCAN_T4 - FlexCAN for Teensy 4

  1. #751
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,801
    enhancefilter is for setmbfilter

  2. #752
    Quote Originally Posted by tonton81 View Post
    enhancefilter is for setmbfilter
    So what happens when I use it with setmbuserfilter? I can't use a mask to ignore J1939 SA and use enhancefilter?

    That still does not explain why I can't use a 7ff mask with the setmbuser filter as in the same code?

    It does not filter and just allows reception mb0 in the code above.

    Why isn't setmbuser free not filtering with a 7ff mask?

  3. #753
    Thanks...Bruce

  4. #754
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,801
    if only MB0 is receiving it means everything is being captured in MB0 and read fast enough by interrupt that no other frames reach the remaining mailboxes. try setting the filter the same as the ID and see if the other's fall through?

  5. #755
    As in the modified example code above I set 4 I'd of a dozen or so on the bus with setmbuserfilter and used 07ff as the mask. Only mb0 was receiving. I switched to setmbfilter and then only 4 IDs are are captured in the correct mb per the filter. Again setmbuserfilter does not filter with 0x7ff as a mask.

    Thanks bruce

  6. #756
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,801
    the mask is for setmbfilter is calculated properly
    your mask must be wrong, try to debug the setmbfilter to print out what the mask should actually look like so you know what to put for usermask, all 32 bits are important here, even though you're using 11, then you'll see what was wrong?

    i created the automatic masking calculations to make it easy for people to just enter IDs

    the demo someone made for j1939 used 0xFF, which means the remaining 24 bits were set to don't care
    Last edited by tonton81; 06-06-2021 at 10:40 PM.

  7. #757
    For J1939 the don't care would be the SA and the rest would need to go the the necessary MB.

    For setMBUserFilter, if I only set one ID then should the mask just be all F's? because I only want to capture the one ID for one MB.

    Anyways I will try to understand what the mask is come from setMBFilter as to what the filter should be.

    Thanks

    Bruce

  8. #758
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,801
    print the one from the setmbfilter function

    Serial.println(mask)
    Better yet, you can print it from setMBFilterProcessing section before the function exits
    Serial.println(mask)
    this way all the filter functions get printed and you will see all the bits they use
    what happens if you try 0xFFF for the mask in userfilter?

  9. #759
    Well I replaced the user filter for the setmbfilter for the standard frames.

    Nothing.

    So then I bypassed all the filter setting and put setmbfilter accept all and still nothing. I can't understand why I can't get the interrupt to fire. I do don't get it. Could it be something to do with the mycan-> instead of can0.?

    Should I try pollingto see if the messages are received?

    Other thoughts?

    I have 40 is mailboxes set to std receive and accept all and I don't get an idea interrupt to fire...😲

    Thanks

    Bruce

  10. #760
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,801
    what happens if you put events() in the loop? does the frames show up in callback? something wrong in your code if it wont receive frames

  11. #761

    No callback

    Quote Originally Posted by tonton81 View Post
    what happens if you put events() in the loop? does the frames show up in callback? something wrong in your code if it wont receive frames
    That is the problem.

    I am setting up the MB correctly because it shows up in MBStatus.

    I am accepting all frames but I get no call back...makes no sense.

    I thought events() was for FIFO? FIFO is disabled. You can see that in the MBStatus.

    I also disabled in the sample code.

    Thanks

    Bruce

  12. #762
    Of all the things that could be messed up, you can not cast the baud rate calc as an uint16_t.

    That certainly is a "smack your forehead against a brick wall moment.

    So this is what the captured frames look like now:
    8.95,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    8.96,Bus:1,ID:1b5,Overun:0,MB:38,Len:8,cc,1,5,90,2 2,20,22,20
    8.96,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    8.96,Bus:1,ID:4bc,Overun:0,MB:17,Len:8,0,0,fd,ea,2 7,10,0,0
    8.96,Bus:1,ID:2b6,Overun:0,MB:27,Len:8,28,7d,4,df, 28,7d,4,e0
    8.96,Bus:1,ID:379,Overun:0,MB:25,Len:8,10,0,0,fc,0 ,1e,3a,ff
    8.96,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5e,0,0,0 ,0,fa,0
    8.96,Bus:1,ID:1b7,Overun:0,MB:37,Len:8,0,0,0,ff,ff ,0,ff,ff
    8.97,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    8.97,Bus:1,ID:1b3,Overun:0,MB:39,Len:8,c6,32,0,0,7 d,0,0,fc
    8.97,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    8.97,Bus:1,ID:4be,Overun:0,MB:16,Len:8,0,0,0,0,0,0 ,0,0
    8.97,Bus:1,ID:2a8,Overun:0,MB:32,Len:8,0,0,0,0,0,0 ,0,ff
    8.97,Bus:1,ID:4b6,Overun:0,MB:19,Len:8,3a,39,29,95 ,30,39,0,0
    8.97,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5e,0,0,0 ,0,fa,0
    8.97,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    8.98,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    8.98,Bus:1,ID:2b0,Overun:0,MB:30,Len:8,e5,39,3a,10 ,24,40,24,60
    8.98,Bus:1,ID:379,Overun:0,MB:25,Len:8,10,0,0,fc,0 ,1e,3a,ff
    8.98,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5e,0,0,0 ,0,fa,0
    8.99,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    8.99,Bus:1,ID:2b2,Overun:0,MB:29,Len:8,ff,ff,ff,ff ,ff,7f,1f,1f
    8.99,Bus:1,ID:1b3,Overun:0,MB:39,Len:8,c6,32,0,0,7 d,0,0,fc
    8.99,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    8.99,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5e,0,0,0 ,0,fa,0
    8.99,Bus:1,ID:250,Overun:0,MB:33,Len:8,0,0,30,17,1 ,16,b,5d
    8.99,Bus:1,ID:249,Overun:0,MB:36,Len:8,9e,30,6,0,0 ,0,4,0
    9.00,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.00,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.00,Bus:1,ID:2b4,Overun:0,MB:28,Len:8,ff,ff,ff,ff ,ff,7f,1f,1f
    9.00,Bus:1,ID:379,Overun:0,MB:25,Len:8,10,0,0,fc,0 ,1e,3a,ff
    9.00,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5e,0,0,0 ,0,fa,0
    9.01,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.01,Bus:1,ID:1b3,Overun:0,MB:39,Len:8,c6,32,0,0,7 d,0,0,fc
    9.01,Bus:1,ID:1b5,Overun:0,MB:38,Len:8,cc,1,5,90,2 2,20,22,20
    9.01,Bus:1,ID:2b6,Overun:0,MB:27,Len:8,28,7d,4,df, 28,7d,4,e0
    9.01,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.01,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5e,0,0,0 ,0,fa,0
    9.01,Bus:1,ID:1b7,Overun:0,MB:37,Len:8,0,0,0,ff,ff ,0,ff,ff
    9.01,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.02,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.02,Bus:1,ID:379,Overun:0,MB:25,Len:8,10,0,0,fc,0 ,1e,3a,ff
    9.02,Bus:1,ID:2a8,Overun:0,MB:32,Len:8,0,0,0,0,0,0 ,0,ff
    9.02,Bus:1,ID:4a4,Overun:0,MB:22,Len:8,0,2,39,2,0, 0,0,0
    9.02,Bus:1,ID:4b6,Overun:0,MB:19,Len:8,3a,39,29,95 ,30,39,0,0
    9.02,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5e,0,0,0 ,0,fa,0
    9.03,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.03,Bus:1,ID:2b0,Overun:0,MB:30,Len:8,e5,39,3a,10 ,24,40,24,60
    9.03,Bus:1,ID:1b3,Overun:0,MB:39,Len:8,c6,32,0,0,7 d,0,0,fc
    9.03,Bus:1,ID:4a6,Overun:0,MB:21,Len:8,3a,30,f,a0, 0,fa,f,a0
    9.03,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.03,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5e,0,0,0 ,0,fa,0
    9.04,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.04,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.04,Bus:1,ID:2b2,Overun:0,MB:29,Len:8,ff,ff,ff,ff ,ff,7f,1f,1f
    9.04,Bus:1,ID:4b0,Overun:0,MB:20,Len:8,0,0,0,0,7d, 7c,0,6
    9.04,Bus:1,ID:379,Overun:0,MB:25,Len:8,10,0,0,fc,0 ,1e,3a,ff
    9.04,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5e,0,0,0 ,0,fa,0
    9.04,Bus:1,ID:150,Overun:0,MB:43,Len:8,fc,f8,ff,ff ,ff,ff,ff,ff
    9.05,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.05,Bus:1,ID:1b3,Overun:0,MB:39,Len:8,c6,32,0,0,7 d,0,0,fc
    9.05,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.05,Bus:1,ID:2b4,Overun:0,MB:28,Len:8,ff,ff,ff,ff ,ff,7f,1f,1f
    9.05,Bus:1,ID:4ba,Overun:0,MB:18,Len:8,0,0,0,0,0,0 ,7,d0
    9.05,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5e,0,0,0 ,0,fa,0
    9.05,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.06,Bus:1,ID:1b5,Overun:0,MB:38,Len:8,cc,1,5,90,2 2,20,22,20
    9.06,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.06,Bus:1,ID:4bc,Overun:0,MB:17,Len:8,0,0,fd,ea,2 7,10,0,0
    9.06,Bus:1,ID:2b6,Overun:0,MB:27,Len:8,28,7d,4,df, 28,7d,4,e0
    9.06,Bus:1,ID:379,Overun:0,MB:25,Len:8,10,0,0,fc,0 ,1e,3a,ff
    9.06,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5e,0,0,0 ,0,fa,0
    9.06,Bus:1,ID:1b7,Overun:0,MB:37,Len:8,0,0,0,ff,ff ,0,ff,ff
    9.07,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.07,Bus:1,ID:4be,Overun:0,MB:16,Len:8,0,0,0,0,0,0 ,0,0
    9.07,Bus:1,ID:1b3,Overun:0,MB:39,Len:8,c6,32,0,0,7 d,0,0,fc
    9.07,Bus:1,ID:2a8,Overun:0,MB:32,Len:8,0,0,0,0,0,0 ,0,ff
    9.07,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.07,Bus:1,ID:4b6,Overun:0,MB:19,Len:8,3a,39,29,95 ,30,39,0,0
    9.07,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5e,0,0,0 ,0,fa,0
    9.08,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.08,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.08,Bus:1,ID:2b0,Overun:0,MB:30,Len:8,e5,39,3a,10 ,24,40,24,a0
    9.08,Bus:1,ID:379,Overun:0,MB:25,Len:8,10,0,0,fc,0 ,1e,3a,ff
    9.08,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5e,0,0,0 ,0,fa,0
    9.09,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.09,Bus:1,ID:1b3,Overun:0,MB:39,Len:8,c6,32,0,0,7 d,0,0,fc
    9.09,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.09,Bus:1,ID:2b2,Overun:0,MB:29,Len:8,ff,ff,ff,ff ,ff,7f,1f,1f
    9.09,Bus:1,ID:250,Overun:0,MB:33,Len:8,0,0,30,17,1 ,16,b,5d
    9.09,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5e,0,0,0 ,0,fa,0
    9.09,Bus:1,ID:249,Overun:0,MB:36,Len:8,9f,38,7,0,0 ,0,4,0
    9.09,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.10,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.10,Bus:1,ID:2b4,Overun:0,MB:28,Len:8,ff,ff,ff,ff ,ff,7f,1f,1f
    9.10,Bus:1,ID:379,Overun:0,MB:25,Len:8,10,0,0,fc,0 ,1e,3a,ff
    9.10,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5d,0,0,0 ,0,fa,0
    9.11,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.11,Bus:1,ID:2b6,Overun:0,MB:27,Len:8,28,7d,4,df, 28,7d,4,e0
    9.11,Bus:1,ID:1b3,Overun:0,MB:39,Len:8,c6,32,0,0,7 d,0,0,fc
    9.11,Bus:1,ID:1b5,Overun:0,MB:38,Len:8,cc,1,5,90,2 2,20,22,20
    9.11,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.11,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5d,0,0,0 ,0,fa,0
    9.11,Bus:1,ID:1b7,Overun:0,MB:37,Len:8,0,0,0,ff,ff ,0,ff,ff
    9.12,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.12,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.12,Bus:1,ID:379,Overun:0,MB:25,Len:8,10,0,0,fc,0 ,1e,3a,ff
    9.12,Bus:1,ID:2a8,Overun:0,MB:32,Len:8,0,0,0,0,0,0 ,0,ff
    9.12,Bus:1,ID:4a4,Overun:0,MB:22,Len:8,0,2,39,2,0, 0,0,0
    9.12,Bus:1,ID:4b6,Overun:0,MB:19,Len:8,3a,39,29,95 ,30,39,0,0
    9.12,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5d,0,0,0 ,0,fa,0
    9.13,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.13,Bus:1,ID:1b3,Overun:0,MB:39,Len:8,c6,32,0,0,7 d,0,0,fc
    9.13,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.13,Bus:1,ID:2b0,Overun:0,MB:30,Len:8,e5,39,3a,10 ,24,40,24,60
    9.13,Bus:1,ID:4a6,Overun:0,MB:21,Len:8,3a,30,f,a0, 0,fa,f,a0
    9.13,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5d,0,0,0 ,0,fa,0
    9.14,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.14,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.14,Bus:1,ID:2b2,Overun:0,MB:29,Len:8,ff,ff,ff,ff ,ff,7f,1f,1f
    9.14,Bus:1,ID:4b0,Overun:0,MB:20,Len:8,0,0,0,0,7d, 7c,0,6
    9.14,Bus:1,ID:379,Overun:0,MB:25,Len:8,10,0,0,fc,0 ,1e,3a,ff
    9.14,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5d,0,0,0 ,0,fa,0
    9.14,Bus:1,ID:150,Overun:0,MB:43,Len:8,fc,f8,ff,ff ,ff,ff,ff,ff
    9.15,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.15,Bus:1,ID:2b4,Overun:0,MB:28,Len:8,ff,ff,ff,ff ,ff,7f,1f,1f
    9.15,Bus:1,ID:1b3,Overun:0,MB:39,Len:8,c6,32,0,0,7 d,0,0,fc
    9.15,Bus:1,ID:4ba,Overun:0,MB:18,Len:8,0,0,0,0,0,0 ,7,d0
    9.15,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.15,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5d,0,0,0 ,0,fa,0
    9.16,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.16,Bus:1,ID:1b5,Overun:0,MB:38,Len:8,cc,1,5,90,2 2,20,22,20
    9.16,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.16,Bus:1,ID:4bc,Overun:0,MB:17,Len:8,0,0,fd,ea,2 7,10,0,0
    9.16,Bus:1,ID:2b6,Overun:0,MB:27,Len:8,28,7d,4,df, 28,7d,4,e0
    9.16,Bus:1,ID:379,Overun:0,MB:25,Len:8,10,0,0,fc,0 ,1e,3a,ff
    9.16,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5d,0,0,0 ,0,fa,0
    9.16,Bus:1,ID:1b7,Overun:0,MB:37,Len:8,0,0,0,ff,ff ,0,ff,ff
    9.17,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.17,Bus:1,ID:1b3,Overun:0,MB:39,Len:8,c6,32,0,0,7 d,0,0,fc
    9.17,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.17,Bus:1,ID:4be,Overun:0,MB:16,Len:8,0,0,0,0,0,0 ,0,0
    9.17,Bus:1,ID:2a8,Overun:0,MB:32,Len:8,0,0,0,0,0,0 ,0,ff
    9.17,Bus:1,ID:4b6,Overun:0,MB:19,Len:8,3a,39,29,95 ,30,39,0,0
    9.17,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5d,0,0,0 ,0,fa,0
    9.18,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.18,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.18,Bus:1,ID:2b0,Overun:0,MB:30,Len:8,e5,39,3a,10 ,24,40,24,60
    9.18,Bus:1,ID:379,Overun:0,MB:25,Len:8,10,0,0,fc,0 ,1e,3a,ff
    9.18,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5d,0,0,0 ,0,fa,0
    9.19,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.19,Bus:1,ID:2b2,Overun:0,MB:29,Len:8,ff,ff,ff,ff ,ff,7f,1f,1f
    9.19,Bus:1,ID:1b3,Overun:0,MB:39,Len:8,c6,32,0,0,7 d,0,0,fc
    9.19,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.19,Bus:1,ID:250,Overun:0,MB:33,Len:8,0,0,30,17,1 ,16,b,5e
    9.19,Bus:1,ID:249,Overun:0,MB:36,Len:8,80,50,0,0,0 ,0,4,0
    9.19,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5d,0,0,0 ,0,fa,0
    9.20,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.20,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.20,Bus:1,ID:2b4,Overun:0,MB:28,Len:8,ff,ff,ff,ff ,ff,7f,1f,1f
    9.20,Bus:1,ID:379,Overun:0,MB:25,Len:8,10,0,0,fc,0 ,1e,3a,ff
    9.20,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5d,0,0,0 ,0,fa,0
    9.21,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.21,Bus:1,ID:1b3,Overun:0,MB:39,Len:8,c6,32,0,0,7 d,0,0,fc
    9.21,Bus:1,ID:1b5,Overun:0,MB:38,Len:8,cc,1,5,90,2 2,20,22,20
    9.21,Bus:1,ID:2b6,Overun:0,MB:27,Len:8,28,7d,4,df, 28,7d,4,e0
    9.21,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.21,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5d,0,0,0 ,0,fa,0
    9.21,Bus:1,ID:1b7,Overun:0,MB:37,Len:8,0,0,0,ff,ff ,0,ff,ff
    9.22,Bus:1,ID:1a0,Overun:0,MB:42,Len:8,f9,0,0,0,0, 0,0,0
    9.22,Bus:1,ID:378,Overun:0,MB:26,Len:8,10,ff,ff,ff ,ff,c1,ff,ff
    9.22,Bus:1,ID:379,Overun:0,MB:25,Len:8,10,0,0,fc,0 ,1e,3a,ff
    9.22,Bus:1,ID:2a8,Overun:0,MB:32,Len:8,0,0,0,0,0,0 ,0,ff
    9.22,Bus:1,ID:4a4,Overun:0,MB:22,Len:8,ff,f2,39,2, 0,0,0,0
    9.22,Bus:1,ID:4b6,Overun:0,MB:19,Len:8,3a,39,29,95 ,30,39,0,0
    9.22,Bus:1,ID:1a2,Overun:0,MB:41,Len:8,13,5d,0,0,0 ,0,fa,0
    I still do not quite understand the mask calculation as the mask being calculated for each of the 42 receive mailboxes (for this sample DBC file) that I am setting up is "1FFC0000" which would infer that I "do not care" about the bits I am trying to filter.

    For the standard frames to mask does not matter so much but for the extended frame with possible J1939 traffic, I need to understand how the masking work and that seems counter intuitive to me based on the results of this DBC file.

    Any insights into the mask calculation?

    Anyways thanks for handing in their with me but now seems all systems are go, except understanding the mask calcualtion.

    Thanks

    Bruce

  13. #763
    Junior Member
    Join Date
    Mar 2021
    Posts
    9
    Hi tonton81,
    solved my problem by using a different sample point which I took from an Example of a Peak interface: Sample point 83,333 works well for 2MBit, no loss of Messages anymore.

    Thanks for always having an open ear for someone elses problems!

    Ralph

  14. #764
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,801
    Bruce, the masking is quite complex in FlexCAN, and it is way worse in FIFO mode as the bits are offset. Working on automated masking capability and testing it was quite a bit of work.

    What you can try to do is take one standard ID and print out it's mask when you use setmbfilter. once you get that mask, try adding dual ID and you may get an idea of how the bit's are compared

    2 IDs for example are 1a0 and 1a2 you have on your bus

    setMBFilter(0, 1A0); //check printed mask
    setMBFilter(0, 1A0, 1A2); // check printed mask
    then see how the bits look like

    16 bit baudrate? yeah that can fail miserably, at 1mbps, your baudrate would be 576

  15. #765
    Quote Originally Posted by tonton81 View Post
    Bruce, the masking is quite complex in FlexCAN, and it is way worse in FIFO mode as the bits are offset. Working on automated masking capability and testing it was quite a bit of work.

    What you can try to do is take one standard ID and print out it's mask when you use setmbfilter. once you get that mask, try adding dual ID and you may get an idea of how the bit's are compared

    2 IDs for example are 1a0 and 1a2 you have on your bus

    setMBFilter(0, 1A0); //check printed mask
    setMBFilter(0, 1A0, 1A2); // check printed mask
    then see how the bits look like
    Right now I do not plan on masking 11 bit ID only 29 bit/J1939 ID's so that is where I will starts.

    Thanks for the patience.

    Bruce

  16. #766

    29 bit mask

    So the 29 bit mask looks like

    3C0FF
    3E315
    3FEFC
    3FAF4
    3FEFF
    3FFFF
    3FFFF
    3FFFF

    For the following MB a

    CAN 1 RX MB Assignement(#:ID)
    RX MB 4 EXT ID: 0:9CFEF803/1:9CFEC703
    RX MB 5 EXT ID: 2:98FFFAF9/3:98FFE613
    RX MB 6 EXT ID: 4:98FF5903/5:98FF5800
    RX MB 7 EXT ID: 6:98FF550B/7:98FF5000
    RX MB 8 EXT ID: 8:98FF4F00/9:98FF4E00
    RX MB 9 EXT ID: 10:98FF4D00
    RX MB 10 EXT ID: 11:98FF3F00
    RX MB 11 EXT ID: 12:98FF3D00

    So if I have the same source ID I get and "FF" as my low byte of the mask.

    So if I want to ignore the SA would the last byte be set to "00"?

    Any thoughts?

    Thanks

    Bruce

  17. #767
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,801
    the SA? last bytes? 00 would let anything in last 8 bits pass, yes, while the upper bits if kept would be checked

  18. #768
    Quote Originally Posted by tonton81 View Post
    the SA? last bytes? 00 would let anything in last 8 bits pass, yes, while the upper bits if kept would be checked
    SA is source address. Sometimes when just monitoring J1939 you do not care about the source of the message just the PGN of the message.

    The last 8 bits of the identifier contain the address of the device transmitting the message. The address is the label or “handle” which is assigned to provide a way to uniquely access a given device on the network. For a given network, every address must be unique (254 available). This means that two different devices (ECUs) cannot use the same address.
    Thanks

    Bruce

  19. #769
    Junior Member
    Join Date
    Mar 2021
    Posts
    9
    Hi tonton81,
    if a message is being sent and no partner Acks the message (i.E. you send a FD - Message and the partner doesn't speak FD or vice versa), the message loops forever.
    Is there an easy way to reset the MB or tell the transmitter only to try it for a short time and come back with an error?

    Thanks

    Ralph

  20. #770
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,801
    well yes if they are mis-communicating because of different standards a CRC fail will issue a resend, that is hardware controlled though. You could abort the message but in your loop if you send again you'll just be going around in a rollercoaster. do you control your sends and are they one shot or do you consistantly send frames from your loop?

  21. #771
    Junior Member
    Join Date
    Mar 2021
    Posts
    9
    It's just one shot, if there is a timeout because a reply of the ECU is missing, I don't try it over and over again. In the meantime I found out that the .write() comes back with a '0' and I count those negative returns and when it reaches 2 I initialize the MB again. Then the sending loop stops. The message has been sent a hundred times or more, though. Is this the correct way to handle such an issue?

    Thanks

    Ralph

  22. #772
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,801
    the hardware itself does the resending on CRC fails (like cross-CAN2.0/FD you said you use). Software has no control over resending, this is by hardware design, if it doesn't get an ACK either, it'll keep sending as well. 2 ways to cancel the mailbox sending is to reinit it as TX or abort (not implemented as of yet). However I find the re-init is cleaner and puts it in a known state.

    do not forget your transmits are queued and offloaded by isr for performance, so when your count to 2 it means the queue is probably full and when you reset the mailbox an entry is dequeued if isr fires to send next in queue.
    Last edited by tonton81; 06-09-2021 at 04:06 PM.

  23. #773
    Junior Member
    Join Date
    Jan 2021
    Posts
    6
    Hello,
    I am trying to receive can messages with a J1939 like protocol. My Ids are 0x10EBFE-SA with SA the source adress.
    I would like to receive all messages from 0x10EBFE00 to 0x10EBFEFF in a unique mailbox.
    I tryied using setMBUserFilter(MB1, 0x10EBFE00, 0xFFFFFF00) but it seams nothing bleed through filtering.
    i also made a few test with in mask 0xF000000, 0xF000F00, 0xF000FF00 and the filtering do what it is supposed to do but with 0x1F000000, 0xFFFF00, 0xFF0000, 0xF0000 I can't receive anything.
    Did you have some explanations about how work filtering and masks are some ideas I can try?

  24. #774
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,801
    try 0xFF for filter?

  25. #775
    Junior Member
    Join Date
    Jun 2021
    Location
    Germany
    Posts
    5
    yet another n00b question.. on IFCT examples there is a sniffer, but filter is available on FlexCAN_T4. i am completely beginner, which one should i use? as from my understanding FlexCAN_T4 is the successor of IFCT and looks highly automated with lot of autodetection (which is very cool btw).

    i am looking for a very beginners friendly example code (i have nothing to show)

    What i have:
    - Teensy 3.2
    - VP230 pin 3+4
    - CAN-B Baud Rate 83300
    - CAN ID 0x0030

    What i don't know:
    - which example code should i use as base (ino)
    - should i apply filter on FIFO or MB
    - STD or EXT message

    What i want:
    I believe it is EXT because the value i want to read seems to be in CAN Message Line 22 offset 24. The desired value is KOMP_STELL according to this text file (if i got this all right)

    The project remain read-only as all i need is a watchdog to this single value (which is used as input for output PWM signal on pin6). I am not even sure if MB is a bit overloaded for such task?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •