* Question
What are the main ways to receive SJAl000 messages?
* Answer
The SJA1000 CAN controller supports two main methods for receiving messages: interrupt receiving mode and polling (query) receiving mode.
1. Interrupt Receiving Mode
In this mode, the SJA1000 generates an interrupt signal whenever a new CAN message is received.
The CPU immediately enters the interrupt service routine (ISR) to read the message data from the receive buffer and process it.
Features:
Provides high real-time performance and fast response to incoming messages.
Suitable for applications requiring timely data handling, such as automotive control systems or high-speed industrial networks.
Requires proper interrupt configuration and handling to avoid data loss or interrupt conflicts.
2. Polling (Query) Receiving Mode
In this mode, the CPU periodically checks (polls) the SJA1000’s status or interrupt register to determine whether a new message has arrived.
If a message is available, the program reads and processes it within the main loop.
Features:
The programming logic is basically the same as in the interrupt mode, except that message reception is triggered by polling instead of interrupts.
Real-time performance is lower compared to the interrupt method because message checking depends on the polling frequency.
Recommended for systems where real-time requirements are not strict, as it offers simpler control flow and easier debugging.
3. Summary
Receiving Mode | Trigger Mechanism | Real-Time Performance | Recommended Scenario |
Interrupt Receiving Mode | Hardware interrupt | High | Time-critical communication |
Polling (Query) Receiving Mode | CPU polling | Moderate to Low | Simple or low-speed applications |
In summary:
The programming concepts for both modes are largely similar.
If the system does not require strong real-time performance, it is recommended to use the polling receiving mode for simplicity.
For high-speed or time-sensitive communication, the interrupt receiving mode is preferred.

COMMENTS