Getting Started with Seeed Studio XIAO RA4M1
Introduction
The XIAO RA4M1 integrates Renesas' RA4M1 chip (32-bit ARM® Cortex®-M4 MCU up to 48 MHz) into the classic XIAO form factor. This development board offers 256KB Flash, 32KB SRAM, 8KB EEPROM, a USB 2.0 connector, reset and boot buttons, 3 LEDs, a 14-bit A/D converter, a 12-bit D/A converter, and a CAN BUS interface. With onboard charging circuitry and low-power modes (as low as 45μA), it’s ideal for battery-powered applications. Sharing the same 32-bit R7FA4M1AB3CFM microcontroller as the Arduino Uno R4, it's natively compatible with Arduino IDE and the extensive XIAO accessories, making it the perfect starting point for electronics projects.
Features
- Popular Microcontroller Onboard: Powered by Renesas RA4M1, an 32-bit ARM® Cortex®-M4 R7FA4M1AB3CFM MCU operating at up to 48 MHz, 256 KB of Flash memory, and 32 KB of SRAM.
- Highlighted Onboard Resources: Equipped with a 14-bit ADC, 12-bit DAC, CAN BUS, USB 2.0, and an onboard RGB LED.
- Expanded 8 New IOs: Adds 8 new IO pins on the back compared to previous XIAO boards (19 GPIOs in total), enabling more complex applications.
- Powerful Security Features: Built-in hardware encryption, secure boot, key storage, and other functions to ensure application security.
- Software Compatibility: Fully compatible with Arduino IDE for seamless project development and prototyping.
- Efficient Power Design: Offers 4 operating modes with power consumption as low as 45μA in deep sleep, and supports lithium battery charge management.
- Compact Thumb-Sized Design: Measuring 21 x 17.8mm, adopting Seeed Studio's classic XIAO form factor, ideal for space-conscious applications.
- Production-Friendly: Surface Mount Device (SMD) design with all components on the front and stamp holes on both sides, facilitating efficient mass production.
Specification
Product | XIAO RA4M1 |
---|---|
Processor | Renesas RA4M1 |
48-MHz Arm® Cortex®-M4 Core | |
RAM | 32 KB SRAM |
Flash | 256 KB |
LEDs | 1 User LED, 1 Power LED, 1 RGB LED |
Interfaces | 19 Pins:14x Analog,19x Digital, 2x IIC, 2x UART, 2x SPI |
Buttons | 1 RESET Button, 1 BOOT Button |
Security | AES128/256 |
Low Power | 45μA |
Software Compatibility | Arduino IDE |
Working Temperature | -20°C-70°C |
Dimensions | 21x17.8 mm |
Power | Type-C: 5V BAT: 3.8V |
Hardware Overview
Before everything starts, it is quite essential to have some basic parameters of the product. The following table provides information about the characteristics of Seeed Studio XIAO RA4M1.
XIAO RA4M1 front indication diagram |
---|
XIAO RA4M1 Pin List |
Getting Started
Hardware Preparation
You need to prepare the following:
- 1 x Seeed Studio XIAO RA4M1
- 1 x Computer
- 1 x USB Type-C cable
Some USB cables can only supply power and cannot transfer data. If you don't have a USB cable or don't know if your USB cable can transmit data, you can check Seeed USB Type-C support USB 3.1.
Software Preparation
The recommended programming tool for the XIAO RA4M1 is the Arduino IDE, so as part of the software preparation, you will need to complete the Arduino installation.
If this is your first time using Arduino, we highly recommend you to refer to Getting Started with Arduino.
- Step 1. Download and Install the stable version of Arduino IDE according to your operating system.
Step 2. Launch the Arduino application.
Step 3. Add RA4M1 board package to your Arduino IDE.
Navigate to File > Preferences, and fill "Additional Boards Manager URLs" with the url below: https://files.seeedstudio.com/arduino/package_renesas_1.2.0_index.json
Navigate to Tools > Board > Boards Manager..., type the keyword RA4M1 in the search box, select the latest version of Seeed Renesas Board, and install it.
Step 4. Select your board and port.
On top of the Arduino IDE, you can search for xiao in the development board on the left, select XIAO_RA4M1, and select the port directly.
BootLoader Mode
Sometimes, using the wrong program can cause the XIAO to lose its port or not function correctly. Common issues include:
- The XIAO is connected to the computer, but no port number is found.
- The XIAO is connected, and a port number appears, but the program upload fails.
When you encounter the above two situations, you can try to put XIAO into BootLoader mode, which can solve most of the problems of unrecognized devices and failed uploads. The specific method is:
- Method 1. Press and hold the
BOOT
button on the XIAO RA4M1 without releasing it. - Method 2. Keep the
BOOT
button pressed and then connect to the computer via the data cable. Release the BOOT button after connecting to the computer.
Reset
When the program runs abnormally, you can press Reset
once during power-up to let XIAO re-execute the uploaded program.
When you press and hold the BOOT
key while powering up and then press the Reset
key once, you can also enter BootLoader mode.
Run your first Blink program
By now, I believe you have a good understanding of the features and hardware of the XIAO RA4M1. Next, let's take the simplest Blink program as an example and perform the first blink for your XIAO RA4M1!
Step 1. Launch the Arduino application.
Step 2. Navigate to File > Examples > 01.Basics > Blink, open the program.
Step 3. Select the board model to XIAO RA4M1, and select the correct port number to upload the program.
Once the program is successfully uploaded, you will see the following output message and you can observe that the orange LED on the right side of the XIAO RA4M1 is blinking.
Congratulations, you've learned how to write and upload programs for the XIAO RA4M1!
The LED will only turn off when the user LED pin on the XIAO RA4M1 is set to a high level, and it will only turn on when the pin is set to a low level.
Play with RGB LEDs
The XIAO RA4M1 comes with a build-in RGB LED that you can control, follow is a example of how to smoothly change the LED color between red, green, and blue.
- Step 1. Download the
Adafruit_NeoPixel
library
Navigate to Sketch > Include Liarbry > Manage Libraries..., and search Adafruit_NeoPixel, install the lastest version.
- Step 2. Copy following code to a new sketch:
#include <Adafruit_NeoPixel.h>
#define LED_PIN RGB_BUILTIN // Define the pin for the built-in RGB LED
#define NUM_PIXELS 1 // Number of WS2812 LEDs
Adafruit_NeoPixel pixels(NUM_PIXELS, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pinMode(PIN_RGB_EN, OUTPUT); // Set up the power pin
digitalWrite(PIN_RGB_EN, HIGH); //Turn on power to the LED
pixels.begin(); // Initialize the NeoPixel library
}
void loop() {
// Transition from Red to Green
for (int i = 0; i <= 255; i++) {
pixels.setPixelColor(0, pixels.Color(255 - i, i, 0)); // Red decreases, Green increases
pixels.show();
delay(10); // Adjust delay for smoothness
}
// Transition from Green to Blue
for (int i = 0; i <= 255; i++) {
pixels.setPixelColor(0, pixels.Color(0, 255 - i, i)); // Green decreases, Blue increases
pixels.show();
delay(10); // Adjust delay for smoothness
}
// Transition from Blue to Red
for (int i = 0; i <= 255; i++) {
pixels.setPixelColor(0, pixels.Color(i, 0, 255 - i)); // Blue decreases, Red increases
pixels.show();
delay(10); // Adjust delay for smoothness
}
}
- Step 3. Select the board model to XIAO RA4M1, and select the correct port number to upload the program.
Battery & Power Management
Is it possible to read the battery voltage without extra components? Yes, with the XIAO RA4M1, it’s easier than ever. In previous XIAO family members, such as the XIAO ESP32C3, reading the battery voltage required manually connecting to A0 with a resistor.
But with the XIAO RA4M1, this process is simplified. You can now directly use the BAT_DET_PIN/P105
pin to read the battery voltage level, streamlining your design and development. Just remember to set the BAT_READ_EN/P400
pin to high, as it’s necessary to enable battery level reading.
- Step 1. Harware Preparation
Seeed Studio XIAO RA4M1 | Seeed Studio Expansion Base for XIAO with Grove OLED |
---|---|
The OLED display on the XIAO expansion board uses the I2C protocol and is connected to the XIAO's I2C interface through the I2C circuit on the board. Therefore, we can directly plug the XIAO into the expansion board and program it to display content on the screen.
- Step 2. Install the u8g2 library.
- Step 3. Copy the code and stick on the Ardiono IDE.
#include <Arduino.h>
#include <U8x8lib.h>
#include <Wire.h>
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* clock=*/ WIRE_SCL_PIN, /* data=*/ WIRE_SDA_PIN, /* reset=*/ U8X8_PIN_NONE); // OLEDs without Reset of the Display
#define enablePin BAT_READ_EN // Pin for enabling battery voltage reading
#define adcPin BAT_DET_PIN // Analog input pin (GPIO29 in your case)
const float referenceVoltage = 3.3; // Reference voltage for the ADC
const float voltageDivider = 2.0; // Voltage divider factor
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
pinMode(enablePin, OUTPUT); // Set the enable pin as an output
digitalWrite(enablePin, HIGH); // Set the pin high to enable battery voltage reading
u8x8.begin();
u8x8.setFlipMode(1); // set number from 1 to 3, the screen word will rotary 180
u8x8.setFont(u8x8_font_chroma48medium8_r);
}
void loop() {
int rawValue = analogRead(adcPin); // Read the analog input value
float voltage = rawValue * (referenceVoltage / 1023.0) * voltageDivider; // Calculate the voltage
// Print the raw value and the calculated voltage
u8x8.setCursor(0, 0);
u8x8.print("Raw value:0x");
u8x8.print(rawValue, HEX);
u8x8.setCursor(0, 2);
u8x8.print("Voltage:");
u8x8.print(voltage, 2);
u8x8.print("V");
delay(500); // Delay for 500 milliseconds
}
- Step 4. Select the board model to XIAO RA4M1, and select the correct port number to upload the program
Resources
- 📄 [PDF] RA4M1 datasheet
- 📄 [PDF] Seeed Studio XIAO RA4M1 Schematic
- 📄 [ZIP] KiCAD Libraries
- 🔗 [Kicad] Seeed Studio XIAO RA4M1 FootPrint
Troubleshooting
Q1: What should I look for when soldering pins
Due to the miniature size of XIAO RA4M1, please be careful when soldering headers, do not stick different pins together, and do not stick solder to the shield or other components. Otherwise, it may cause XIAO to short circuit or not work properly, and the consequences caused by this will be borne by the user.
Tech Support & Product Discussion
Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.