The Controller Area network (CAN) HAL module provides a high-level API for CAN applications and supports the CAN peripherals available on RA microcontroller hardware. A user-callback function must be defined that the driver will invoke when transmit, receive or error interrupts are received. The callback is passed a parameter which indicates the channel, mailbox and event as well as the received data (if available).
This module can be added to the Stacks tab via New Stack > Connectivity > CAN (r_can). Non-secure callable guard functions can be generated for this module by right clicking the module in the RA Configuration tool and checking the "Non-secure Callable" box.
Configuration | Options | Default | Description |
General |
Name | Name must be a valid C symbol | g_can0 | Module name. |
Channel | Channel should be 0 or 1 | 0 | Specify the CAN channel to use. |
Clock Source | MCU Specific Options | | Select the CAN clock source. |
Overwrite/Overrrun Mode |
-
Overwrite Mode
-
Overrrun Mode
| Overwrite Mode | Select whether receive mailbox will be overwritten or overrun if data is not read in time. |
Global ID Mode |
-
Standard ID Mode
-
Extended ID Mode
-
Mixed ID Mode
| Standard ID Mode | Select whether the driver will use CAN Standard IDs, Extended IDs or a mix of both. |
Number of Mailboxes |
-
4 Mailboxes
-
8 Mailboxes
-
16 Mailboxes
-
24 Mailboxes
-
32 Mailboxes
| 32 Mailboxes | Select 4, 8, 16, 24 or 32 mailboxes. In FIFO mailbox mode up to 24 mailboxes are available. |
Baud Rate Settings |
Baud Rate Settings > Auto-generated Settings |
Sample-Point (%) | Must be a valid integer between 0 and 100. Ignore when Override Baud Settings is Enabled. | 75 | Sample-Point = (TSEG1 + 1) / (TSEG1 + TSEG2 + 1). |
CAN Baud Rate (Hz) | Must be a valid integer configurable upto maximum 1MHz. Ignore when Override Baud Settings is Enabled. | 500000 | Specify baud rate in Hz.
If the requested baud rate cannot be achieved, the settings with the largest possible baud rate that is less than or equal to the requested baud rate is used. If multiple combinations would result in the best baud rate, the combination with the least absolute error for the ratio is chosen. The theoretical calculated baud rate and ratio are printed in a comment in the generated can_bit_timing_cfg_t structure. |
Baud Rate Settings > Override Auto-generated Settings |
Override Baud Settings |
| Disabled | Override calculated baudrate parameters and instead use the ones specified below. This option ignores the parameters specified under Sample-Point (%) and CAN Baud Rate (Hz) |
Baud Rate Prescaler | Value must be a non-negative integer between 1 and 1024. | 1 | Specify division value of baud rate prescaler (baud rate prescalar + 1). |
Time Segment 1 | Refer to the RA Configuration tool for available options. | 4 Time Quanta | Select the time segment 1 value. (4-16). Check module usage notes for how to calculate this value. |
Time Segment 2 |
-
2 Time Quanta
-
3 Time Quanta
-
4 Time Quanta
-
5 Time Quanta
-
6 Time Quanta
-
7 Time Quanta
-
8 Time Quanta
| 2 Time Quanta | Select the time segment 2 value (2-8). Check module usage notes for how to calculate this value. |
Synchronization Jump Width |
-
1 Time Quanta
-
2 Time Quanta
-
3 Time Quanta
-
4 Time Quanta
| 1 Time Quanta | Select the Synchronization Jump Width value (1-4). Check module usage notes for how to calculate this value. |
Interrupts |
Callback | Name must be a valid C symbol | can_callback | A user callback function. If this callback function is provided, it is called from the interrupt service routine (ISR) each time any interrupt occurs. |
Interrupt Priority Level | MCU Specific Options | | Transmit/Receive/Error interrupt priority. |
Transmit FIFO Interrupt Mode |
| Every Message | Select whether the receive FIFO should throw an interrupt on every received message or when it becomes empty. |
Input |
Input > Receive FIFO |
Input > Receive FIFO > Receive ID 1 |
ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 0 | Select the first ID for the receive FIFO, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. |
ID Mode |
| Standard ID | Select whether the receive FIFO is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Remote Mailbox | Select whether the receive FIFO is used to capture data frames or remote frames. |
Mask | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 0x1FFFFFFF | Select the Mask for the receive FIFO. In Mixed ID Mode the Standard ID mask is the upper 11 bits of the full 29-bit mask value. |
Input > Receive FIFO > Receive ID 2 |
ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 0 | Select the second ID for the receive FIFO, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. |
ID Mode |
| Standard ID | Select whether the receive FIFO is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Remote Mailbox | Select whether the receive FIFO is used to capture data frames or remote frames. |
Mask | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 0x1FFFFFFF | Select the Mask for the receive FIFO. In Mixed ID Mode the Standard ID mask is the upper 11 bits of the full 29-bit mask value. |
Input > Mailbox 0-3 Group |
Input > Mailbox 0-3 Group > Mailbox ID |
Mailbox 0 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 0 | Select the receive ID for mailbox 0, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 1 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 1 | Select the receive ID for mailbox 1, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 2 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 2 | Select the receive ID for mailbox 2, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 3 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 3 | Select the receive ID for mailbox 3, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Input > Mailbox 0-3 Group > Mailbox ID Mode |
Mailbox 0 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 1 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 2 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 3 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Input > Mailbox 0-3 Group > Mailbox Type |
Mailbox 0 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Transmit Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 1 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 2 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 3 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Input > Mailbox 0-3 Group > Mailbox Frame Type |
Mailbox 0 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Remote Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 1 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 2 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 3 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 0-3 Group Mask | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 0x1FFFFFFF | Select the Mask for mailboxes 0-3. In Mixed ID Mode the Standard ID mask is the upper 11 bits of the full 29-bit mask value. |
Input > Mailbox 4-7 Group |
Input > Mailbox 4-7 Group > Mailbox ID |
Mailbox 4 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 4 | Select the receive ID for mailbox 4, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 5 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 5 | Select the receive ID for mailbox 5, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 6 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 6 | Select the receive ID for mailbox 6, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 7 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 7 | Select the receive ID for mailbox 7, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Input > Mailbox 4-7 Group > Mailbox ID Mode |
Mailbox 4 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 5 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 6 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 7 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Input > Mailbox 4-7 Group > Mailbox Type |
Mailbox 4 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 5 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 6 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 7 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Input > Mailbox 4-7 Group > Mailbox Frame Type |
Mailbox 4 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 5 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 6 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 7 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 4-7 Group Mask | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 0x1FFFFFFF | >Select the Mask for mailboxes 4-7. In Mixed ID Mode the Standard ID mask is the upper 11 bits of the full 29-bit mask value. |
Input > Mailbox 8-11 Group |
Input > Mailbox 8-11 Group > Mailbox ID |
Mailbox 8 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 8 | Select the receive ID for mailbox 8, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 9 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 9 | Select the receive ID for mailbox 9, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 10 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 10 | Select the receive ID for mailbox 10, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 11 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 11 | Select the receive ID for mailbox 11, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Input > Mailbox 8-11 Group > Mailbox ID Mode |
Mailbox 8 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 9 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 10 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 11 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Input > Mailbox 8-11 Group > Mailbox Type |
Mailbox 8 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 9 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 10 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 11 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Input > Mailbox 8-11 Group > Mailbox Frame Type |
Mailbox 8 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 9 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 10 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 11 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 8-11 Group Mask | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 0x1FFFFFFF | Select the Mask for mailboxes 8-11. In Mixed ID Mode the Standard ID mask is the upper 11 bits of the full 29-bit mask value. |
Input > Mailbox 12-15 Group |
Input > Mailbox 12-15 Group > Mailbox ID |
Mailbox 12 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 12 | Select the receive ID for mailbox 12, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 13 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 13 | Select the receive ID for mailbox 13, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 14 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 14 | Select the receive ID for mailbox 14, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 15 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 15 | Select the receive ID for mailbox 15, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Input > Mailbox 12-15 Group > Mailbox ID Mode |
Mailbox 12 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 13 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 14 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 15 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Input > Mailbox 12-15 Group > Mailbox Type |
Mailbox 12 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 13 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 14 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 15 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Input > Mailbox 12-15 Group > Mailbox Frame Type |
Mailbox 12 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 13 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 14 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 15 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 12-15 Group Mask | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 0x1FFFFFFF | Select the Mask for mailboxes 12-15. In Mixed ID Mode the Standard ID mask is the upper 11 bits of the full 29-bit mask value. |
Input > Mailbox 16-19 Group |
Input > Mailbox 16-19 Group > Mailbox ID |
Mailbox 16 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 16 | Select the receive ID for mailbox 16, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 17 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 17 | Select the receive ID for mailbox 17, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 18 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 18 | Select the receive ID for mailbox 18, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 19 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 19 | Select the receive ID for mailbox 19, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Input > Mailbox 16-19 Group > Mailbox ID Mode |
Mailbox 16 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 17 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 18 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 19 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Input > Mailbox 16-19 Group > Mailbox Type |
Mailbox 16 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 17 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 18 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 19 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Input > Mailbox 16-19 Group > Mailbox Frame Type |
Mailbox 16 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 17 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 18 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 19 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 16-19 Group Mask | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 0x1FFFFFFF | Select the Mask for mailboxes 16-19. In Mixed ID Mode the Standard ID mask is the upper 11 bits of the full 29-bit mask value. |
Input > Mailbox 20-23 Group |
Input > Mailbox 20-23 Group > Mailbox ID |
Mailbox 20 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 20 | Select the receive ID for mailbox 20, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 21 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 21 | Select the receive ID for mailbox 21, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 22 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 22 | Select the receive ID for mailbox 22, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 23 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 23 | Select the receive ID for mailbox 23, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Input > Mailbox 20-23 Group > Mailbox ID Mode |
Mailbox 20 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 21 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 22 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 23 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Input > Mailbox 20-23 Group > Mailbox Type |
Mailbox 20 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 21 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 22 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 23 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Input > Mailbox 20-23 Group > Mailbox Frame Type |
Mailbox 20 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 21 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 22 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 23 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 20-23 Group Mask | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 0x1FFFFFFF | Select the Mask for mailboxes 20-23. In Mixed ID Mode the Standard ID mask is the upper 11 bits of the full 29-bit mask value. |
Input > Mailbox 24-27 Group |
Input > Mailbox 24-27 Group > Mailbox ID |
Mailbox 24 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 24 | Select the receive ID for mailbox 24, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 25 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 25 | Select the receive ID for mailbox 25, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 26 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 26 | Select the receive ID for mailbox 26, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 27 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 27 | Select the receive ID for mailbox 27, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Input > Mailbox 24-27 Group > Mailbox ID Mode |
Mailbox 24 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 25 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 26 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 27 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Input > Mailbox 24-27 Group > Mailbox Type |
Mailbox 24 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 25 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 26 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 27 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Input > Mailbox 24-27 Group > Mailbox Frame Type |
Mailbox 24 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 25 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 26 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 27 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 24-27 Group Mask | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 0x1FFFFFFF | Select the Mask for mailboxes 24-27. In Mixed ID Mode the Standard ID mask is the upper 11 bits of the full 29-bit mask value. |
Input > Mailbox 28-31 Group |
Input > Mailbox 28-31 Group > Mailbox ID |
Mailbox 28 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 28 | Select the receive ID for mailbox 28, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 29 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 29 | Select the receive ID for mailbox 29, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 30 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 30 | Select the receive ID for mailbox 30, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Mailbox 31 ID | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 31 | Select the receive ID for mailbox 31, between 0 and 0x7ff when using standard IDs, between 0 and 0x1FFFFFFF when using extended IDs. Value is not used when the mailbox is set as transmit type. |
Input > Mailbox 28-31 Group > Mailbox ID Mode |
Mailbox 28 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 29 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 30 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Mailbox 31 ID Mode |
| Standard ID | Select whether the mailbox is used to receive Standard or Extended ID messages. This setting is only valid when Global ID Mode is set to 'Mixed ID Mode'. |
Input > Mailbox 28-31 Group > Mailbox Type |
Mailbox 28 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 29 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 30 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Mailbox 31 Type |
-
Receive Mailbox
-
Transmit Mailbox
| Receive Mailbox | Select whether the mailbox is used for receive or transmit. |
Input > Mailbox 28-31 Group > Mailbox Frame Type |
Mailbox 28 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 29 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 30 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 31 Frame Type |
-
Data Mailbox
-
Remote Mailbox
| Data Mailbox | Select whether the mailbox is used to capture data frames or remote frames (ignored for transmit mailboxes). |
Mailbox 28-31 Group Mask | Value must be decimal or HEX integer of 0x1FFFFFFF or less. | 0x1FFFFFFF | Select the Mask for mailboxes 28-31. In Mixed ID Mode the Standard ID mask is the upper 11 bits of the full 29-bit mask value. |
The CAN peripheral uses the CANMCLK (main-clock oscillator) or PCLKB as its clock source (fCAN, CAN System Clock.) The default CAN configuration will provide a CAN bit rate of 500 Kbit using CANMCLK as the clock source. To set the PCLKB frequency, use the Clocks tab of the RA Configuration editor. To change the clock frequency at run-time, use the CGC Interface. Refer to the CGC module guide for more information on configuring clocks.
The CAN peripheral module uses pins on the MCU to communicate to external devices. I/O pins must be selected and configured as required by the external device. A CAN channel would consist of two pins - CRX and CTX for data transmission/reception.
For convenience, the baudrate of the CAN peripheral is automatically set through the RA Configuration editor using a best effort approach. If the auto-generated baud settings cause deviation that is not tolerable by the application, the user can override the auto-generated settings and put in manually calculated values through RA Configuration editor. For more details on how the baudrate is set refer to section 37.4 "Data Transfer Rate Configuration" of the RA6M3 User's Manual (R01UH0886EJ0100).
When FIFO Support is enabled, mailboxes 24-27 form a 4-stage transmit FIFO and mailboxes 28-31 form a 4-stage receive FIFO. The receive FIFO supports two independent ID/mask settings for acceptance filtering.
This is a basic example of minimal use of the CAN in an application.
This example requires the CTX and CRX pins to be connected. If a CAN tranciever is onboard a 120 Ohm resistor should be connected across CANH and CANL instead. The mailbox numbers are arbitrarily chosen.