Comments (13)
I added the dual filter.
from arduino-can.
Thank you very much @silk-indus, really appreciated. I'll see what changes you made and try to add another one myself as I need at least 3.
from arduino-can.
I have used the hardware support of the filtering (I only need to set hardware registers), i.e. no software check is required. The packets are filtered on the hardware level and as far as I know, data are even not stored in the module. However, I think it is possible to use more than two filters, but another software check is required. This could be done in the onReceive call.
from arduino-can.
I added the dual filter.
Where?
from arduino-can.
I added the dual filter.
Where?
Please look on my fork:
https://github.com/silk-indus/CAN-ESP32
from arduino-can.
You mean this ?
"virtual int filters(int id1, int mask1, int id2, int mask2);"
SO I can use filter for 2 ID's?
What about 3 or more? Some mask?
from arduino-can.
Yes, exactly.
Two filters are supported by the hardware, i.e., this is evaluated on hardware level, so you don't need to do anything more. If you want to have sophisticated filtering, you must do it in software way, for instance check on every message if ID match the conditions. This solution doesn't reduce the traffic and moreover reduce the computation power.
from arduino-can.
Ok, what about filtering by mask?
Maybe this way is better for more ID's?
from arduino-can.
Mask is like a pattern. The HW way is to write the pattern to the HW register, and the HW do the filtering job. If HW is unable to process more than 2 filters (doesn't have more filter registers, what is our case), you have no other ways, just to filter the packets by the SW. You can use the same patterns, but all the stuff is up to you. That means you have to check every incoming packet (OR, XOR, … whatever, depending on your imagination) if matching your criteria.
from arduino-can.
I use filter because I have a lot of ID's and I lose some of them.
I tried oncallback but the cpu is restart without filter
from arduino-can.
I think, you have a different problem. If the bus is overloaded, filtering does not solve your problem. Filtering can reduce the job of the receiving device. If the bus is ok, then most probably you are not properly receiving the packets. The good practice is to receive packets using interrupts (not by polling).
from arduino-can.
I use callback and write data to LCD and is ok. But when I run sample callback receive and uart my cpu restart after moment
from arduino-can.
Sorry for the delay.
This error is likely connected with insufficient time for the interrupt. In other words, the next interrupt comes before the old one finishes. A general rule says to reduce interrupt instructions. A common mistake is Serial.print() instruction in the interrupt. Oh, and LCD.print as well. Please definitely avoid it.
from arduino-can.
Related Issues (20)
- How can i use this library with a raspberry pi pico?
- Not getting messages
- Esp32 s3 support HOT 2
- Not working with Espressif 3.0 HOT 1
- 怎么知道数据有没有发送成功
- Esp32 multiple ID filter HOT 1
- CPU restart in callback HOT 1
- Working with MCP2515 on Arduino Nano, but fails on ESP32 HOT 2
- ESP32SJA1000Class::filterExtended mask calculation incorrect
- setup() and loop() functions are missing
- can i work with the MCP2515 SPI MODULE instead of the MKR can shield
- #warning esp_intr.h is deprecated HOT 1
- setPins() for rx/tx and cs/irq?
- ARDUINO_ARCH_ESP32 forcing ESP32 internal CAN controller - Need MC2515
- Custom MCP2515+TJA1042T board stuck on sending
- Error compiling with Adafruit Feather v2: `esp_intr.h: No such file or directory` HOT 1
- Fatal Error: esp_intr.h: No such file or directory HOT 3
- Solved: Fatal Error: esp_intr.h: No such file or directory HOT 2
- soc/dport_reg.h HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-can.