Arduino UNO R4 Minima CAN Bus

Learn how to send messages using the CAN bus on the UNO R4 Minima.

In this tutorial you will learn how to use the CAN controller on the Arduino UNO R4 Minima board. The CAN controller is embedded in the UNO R4 Minima's microcontroller (RA4M1). CAN is a serial protocol that is mainly used in the automotive industry.

Please note that CAN controller requires an external transceiver to function. Instructions and hardware examples are provided in this tutorial.


The goals of this tutorial are:

  • Get an overview of the built-in CAN library
  • Learn how to connect a board to a CAN transceiver module
  • Send a CAN message between two Arduino boards

Hardware & Software Needed

  • In this tutorial, we are using a SN65HVD230 breakout module.

Controller Area Network (CAN)

The CAN bus uses two wires: CAN high and CAN low. On the Arduino UNO R4 Minima, these pins are:

  • D5/CANRX0 (receive)
  • D4/CANTX0 (transmit)

To communicate with other CAN devices however, you need a transceiver module. In this tutorial, we will be using a SN65HVD230 breakout. To connect this, you can follow the circuit diagram available in the section below.

For this tutorial, we will use a simple example that sends a CAN message between two UNO R4 Minima devices. If you wish, you can also connect an existing CAN device to the UNO R4 Minima.


To connect the CAN transceiver, follow the table and circuit diagram below:

UNO R4 MinimaCAN Transceiver
3.3 VVCC

Then, between the CAN transceivers, connect the following:

CAN Transceiver 1CAN Transceiver 2

Code Examples

The following code examples needs to be uploaded to each of the UNO R4 Minima boards, one will send a message, one will receive it. These examples are available in the Renesas core, and using the Arduino IDE, you can access them by navigating to File > Examples > Arduino_CAN > CANWrite/CANRead

The library used is built in to the core, so no need to install the library if you have the core installed.

To initialize the library, use

, where a CAN bit rate is specified. Choose between:

  • BR_125k (125000)
  • BR_250k (250000)
  • BR_500k (500000)
  • BR_1000k (1000000)

CAN Write

To send a CAN message, you can create a

object, which should contain the
, size and message data. Below is an example on how to create such object.

1uint8_t const msg_data[] = {0xCA,0xFE,0,0,0,0,0,0};
2memcpy((void *)(msg_data + 4), &msg_cnt, sizeof(msg_cnt));
3CanMsg msg(CAN_ID, sizeof(msg_data), msg_data);

After you have crafted a CAN message, we can send it off, by using the

method. The following example creates a CAN message that increases each time
void loop()
is executed.

Code Source on Github

CAN Read

To read an incoming CAN message, first use

to check if data is available, before using
to read the message.

Code Source on Github


This tutorial shows how to use the CAN bus available on the UNO R4 Minima, and how to send and receive data using the Arduino_CAN library.

Read more about this board in the Arduino UNO R4 Minima documentation.

Contribute to Arduino

Join the community and suggest improvements to this article via GitHub. Make sure to read out contribution policy before making your pull request.

Missing something?

Check out our store and get what you need to follow this tutorial.

Suggest Changes

The content on is facilitated through a public GitHub repository. You can read more on how to contribute in the contribution policy.