How to configure TWAI MASK and CODE
Posted: Thu Feb 06, 2025 4:32 pm
Hello,
I am working on an old code based on esp idf 4.3. I have TWAI already setup with acceptance code ~(0x100 << 21) and acceptance mask of ~(0x100 << 21).
But this mask blocks a new frame in my system which is 0x130.
Basically my systems needs these frames :
0x18
0x20
0x130
0x600
0x610
0x618
0x620
0x627
0x640
I know I can't filter only these frames. But I do need to change my mask. I have tried various mask following advice on this forum, in the doc or on some git repo, but with no success. The one I though will work was ~(0x7FF << 21) for the mask and (0x600 << 21) for the code. But this filter blocks every frame.
Because this is not spicy enough, if I set the twai filter to accept all, some random CAN frames appear, my peakcan do not see any of these new frames. Is it normal ?
Does someone know how I can set up a new twai filter ? And what is the correct way to compute it ?
I am working on an old code based on esp idf 4.3. I have TWAI already setup with acceptance code ~(0x100 << 21) and acceptance mask of ~(0x100 << 21).
But this mask blocks a new frame in my system which is 0x130.
Basically my systems needs these frames :
0x18
0x20
0x130
0x600
0x610
0x618
0x620
0x627
0x640
I know I can't filter only these frames. But I do need to change my mask. I have tried various mask following advice on this forum, in the doc or on some git repo, but with no success. The one I though will work was ~(0x7FF << 21) for the mask and (0x600 << 21) for the code. But this filter blocks every frame.
Because this is not spicy enough, if I set the twai filter to accept all, some random CAN frames appear, my peakcan do not see any of these new frames. Is it normal ?
Does someone know how I can set up a new twai filter ? And what is the correct way to compute it ?