Maker.io main logo

RP2040 mikroBUS™ Development Board Hookup Guide

2022-06-21 | By SparkFun Electronics

License: See Original Project

Courtesy of SparkFun

Guide by SANTA CLAUS IMPERSONATOR, MAKIN-STUFF

Introduction

The RP2040 mikroBUS™ Development Board is our latest RP2040 microcontroller (MCU) ‎development board. This new board takes advantage of the Qwiic and the mikroBUS™ ecosystems ‎and allows users to take advantage of the growing number of 94 Qwiic boards and 1079 Click ‎boards™ (as of September 2021) to develop with the Raspberry Pi RP2040 microcontroller.‎

SparkFun RP2040 mikroBUS Development Board

The Raspberry Pi RP2040 (the first MCU from the Raspberry Pi Foundation) is a low cost, dual-‎core Arm® Cortex® M0+ microcontroller with 264kB of SRAM, running at 133MHz. It includes USB ‎host functionality, a timer with 4 alarms, a real time counter (RTC), six dedicated IO pins for Quad-‎SPI flash (supporting execute in place), and thirty multifunction GPIO 

‎(*18 of which are broken out on the board), with the following capabilities:‎

  • Four 12-bit Analogue to Digital Converter (ADC) channels
  • Two UART buses
  • Two I2C buses
  • Two SPI buses
  • Up to 16 PWM channels
  • Can emulate interfaces such as SD Card and VGA

The mikroBUS™ standard was developed by MikroElektronika and provides a standardized ‎connection to interface with Click boards™.‎

mikro_1

Image source: https://www.mikroe.com/1000-click-boards

For more details, check out their blog post on the 1000th Click board™ and the origins of the ‎mikroBUS™ standard and mikroBUS™ standard specifications.‎

Required Materials

To get started, users will need a few of items listed below. (You may already have a some of these ‎items; read through the guide and modify your cart accordingly.)‎

Required Hardware

A USB-C cable is needed to connect the RP2040 mikroBUS™ Development Board to a computer.‎

Click Board™‎

We recommend purchasing a Click board™ to utilize the mikroBUS™ socket. We also suggest ‎novice users select a Click board™ that is supported with an Arduino library. Otherwise, users will ‎have difficulties programming their board to utilize the associated Click board™. Below, is a sample ‎of the options available in our catalog:‎

  • MIKROE Spectrometer Click
  • MIKROE Weather Click
  • MIKROE Air Quality 4 Click
  • MIKROE Thunder Click
  • MIKROE Load Cell Click
  • MIKROE Servo Click
  • MIKROE Accel Click
  • MIKROE LightRanger 8 Click

Optional Hardware

To connect Qwiic breakout boards for your MicroMod project, Qwiic cables are required.‎

A single-cell Lithium-ion battery can be connected to the Qwiic Carrier Board for portability.‎

To modify the jumpers, users will need soldering equipment and/or a knife.‎

Suggested Reading

The MicroMod ecosystem is a unique way to allow users to customize their project to their needs. ‎The Qwiic connect system is a simple method for interfacing with I2C devices. Click on the banners ‎below for more information on each system.‎

qwiic_2

Qwiic Connect System

 

bus_3

mikroBUS™

 

For users who aren't familiar with the following concepts, we also recommend reading the following ‎tutorials before continuing.‎

  • Serial Communication: Asynchronous serial communication concepts: packets, signal levels, ‎baud rates, UARTs and more!‎
  • Serial Peripheral Interface (SPI): SPI is commonly used to connect microcontrollers to ‎peripherals such as sensors, shift registers, and SD cards.‎
  • Pulse Width Modulation: An introduction to the concept of Pulse Width Modulation.‎
  • Logic Levels: Learn the difference between 3.3V and 5V devices and logic levels.‎
  • I2C: An introduction to I2C, one of the main embedded communications protocols in use today.‎
  • Analog vs. Digital: This tutorial covers the concept of analog and digital signals, as they relate ‎to electronics.‎
  • Processor Interrupts with Arduino: What is an interrupt? In a nutshell, there is a method ‎by which a processor can execute its normal program while continuously monitoring for some kind ‎of event, or interrupt. There are two types of interrupts: hardware and software interrupts. For the ‎purposes of this tutorial, we will focus on hardware interrupts.‎
  • Installing an Arduino Library: How do I install a custom Arduino library? It's easy! This ‎tutorial will go over how to install an Arduino library using the Arduino Library Manager. For libraries ‎not linked with the Arduino IDE, we will also go over manually installing an Arduino library.‎
  • Installing Arduino IDE: A step-by-step guide to installing and testing the Arduino software on ‎Windows, Mac, and Linux.‎
  • Installing Board Definitions in the Arduino IDE: How do I install a custom Arduino ‎board/core? It's easy! This tutorial will go over how to install an Arduino board definition using the ‎Arduino Board Manager. We will also go over manually installing third-party cores, such as the ‎board definitions required for many of the SparkFun development boards.‎
  • RP2040 Thing Plus Hookup Guide: Want to take a stab at advancing your programming ‎skills? Check out the Thing Plus - RP2040, with the first microcontroller from the Raspberry Pi ‎Foundation. This guide will get you started working with the RP2040 and programming in ‎MicroPython and C/C++.‎

UF2 Bootloader

The RP2040 mikroBUS™ Development Board is easy to program, thanks the UF2 bootloader. With ‎the UF2 bootloader, the RP2040 Thing Plus shows up on your computer as a USB storage ‎device without having to install drivers for Windows 10, Mac, and Linux!‎

boot_4

Board being recognized as a USB device

What is UF2?‎

UF2 stands for USB Flashing Format, which was developed by Microsoft for PXT (now known as ‎MakeCode) for flashing microcontrollers over the Mass Storage Class (MSC), just like a removable ‎flash drive. The file format is unique, so unfortunately, you cannot simply drag and drop any ‎compiled binary or hex file onto the board. Instead, the format of the file must have specific ‎information to tell the processor where the data goes, in addition to the data itself. For more ‎information about UF2, you can read more from the MakeCode blog, as well as the UF2 file format ‎specification.‎

BOOTSEL Mode

Users can enter BOOTSEL mode by holding down the BOOT button when the USB connection is made ‎to a computer. The board will remain in this mode until it power cycles (happens automatically after ‎uploading a .uf2 firmware file) or the RESET button is pressed. The board will appear as a USB ‎mass storage device under the name RPI-RP2.‎

connect_5

Hold down BOOT button to enter BOOTSEL mode

Note: As another option, with the USB-C cable already connected to the board and the computer, ‎users can hold down the BOOT button and toggle the RESET button to enter BOOTSEL mode. However, ‎this method does require a little bit of finger dexterity.‎

Hardware Overview

Note: Users may notice similarities between the RP2040 Thing Plus and the RP2040 mikroBUS™ ‎development board. These boards are nearly identical, apart from the board dimensions and the ‎mikroBUS™ socket. Please refer to the RP2040 Thing Plus hookup guide for more details on the ‎board design.‎

thing_6

RP2040 Thing Plus Hookup Guide

Want to take a stab at advancing your programming skills? Check out the Thing Plus - RP2040, with ‎the first microcontroller from the Raspberry Pi Foundation. This guide will get you started working ‎with the RP2040 and programming in MicroPython and C/C++.‎

Board Dimensions

The RP2040 mikroBUS™ Development Board's pin layout has a feather form factor with a ‎mikroBUS™ socket above. The board dimensions are illustrated in the drawing below.‎

dimensions_7

Board dimensions (PDF) for the RP2040 mikroBUS™ development board, in inches

Power

The RP2040 mikroBUS™ Development Board only requires 3.3V to power the board. However, the ‎simplest method to power the board is through the USB-C connector.‎

power_8

RP2040 mikroBUS™ development board power connections

The power pins that are available on the board, are detailed below:‎

  • 3V3 - A regulated 3.3V voltage source (600mA).
    • ‎Regulated from the USB 5V power and/or battery connection by a AP2112 LDO.‎
    • Used to power the RP2040 MCU, WS2812 RGB LED, W25Q128 16MB flash chip, ‎‎µSD card slot, +3.3V pin of the mikroBUS™ socket, and the Qwiic bus (I2C).‎
    • Serves as the reference voltage for the RP2040 ADC (ADC_VDD).
    • Pin can also operate as an input from an external power source.‎
  • USB - The voltage from the USB-C connector, usually 5V.‎
    • Used to provide a regulated 3.3V source through the AP2112 LDO (see above).
    • Serves as the power supply for the MCP73831 linear charge management controller to ‎the JST battery connector.‎
    • Serves as the power supply for the +5V pin of the mikroBUS™ socket.‎
    • Utilizes a P-channel MOSFET to control the power source for the AP2112 LDO.‎
    • Utilizes a BAT20J protection diode for the USB-C connection.
  • VBAT - The voltage from the JST battery connector; meant for single cell LiPo batteries.‎
    • Used to provide a regulated 3.3V source through the AP2112 LDO (see above).
    • Connected to the MCP73831 linear charge management controller.‎
  • GND - The common ground or the 0V reference for the voltage supplies.‎

pins_9

RP2040 mikroBUS™ development board power pins

Note: The RP2040 microcontroller has two low power states:‎

  • SLEEP - All the processors are asleep and most of the clocks in the chip are stopped
  • DORMANT - All clocks in the chip are stopped

The real-time clock (RTC) can wake the RP2040 chip up from both of these modes. However, to ‎wake the chip from dormant mode, the RTC must be configured to use an external reference clock, ‎supplied by a GPIO pin.‎

Power Status LED

The red, POWER LED will light up once 3.3V is supplied to the board; however, for most users, it will ‎light up when 5V is supplied through the USB connection or when a LiPo battery is connected to ‎the JST connector.‎

indicator_10

RP2040 mikroBUS™ development board POWER status LED indicator

Charging Circuit

The charging circuit utilizes the MCP73831 linear charge management controller and is powered ‎directly from the USB-C connector or USB. The controller is configured for a 500mA charge rate ‎and battery charging is indicated when the yellow, CHG LED. If the charge controller is shutdown or ‎charging is complete, the CHG LED will turn off. For more information, please refer to ‎the MCP73831 datasheet.‎

Power Control

The power source to the AP2112 LDO voltage regulator is controlled by a P-channel MOSFET. In ‎addition, the 3.3V regulated output from the AP2112 is controlled by the enable (EN) pin, broken ‎out on the board. By default, the chip enable pin (EN) is pulled high, to enable the 3.3V output, ‎supply voltage. To disable and shutdown the output voltage from the AP2112, the chip enable pin ‎‎(EN) needs to be pulled low (i.e., shorted to ground (GND)). For more information, please refer to ‎the AP2112 datasheet.‎

control_11

Enable pin on the RP2040 mikroBUS™ development board

RP2040 Microcontroller

The Raspberry Pi RP2040 is a low-cost, high-performance microcontroller with flexible digital ‎interfaces. It features:‎

  • Dual Arm® Cortex®-M0+ processors, up to 133 MHz
  • ‎264 kB of embedded SRAM in 6 banks
  • ‎6 dedicated IO for additional storage
    • Connects to QSPI Flash
    • Supports execute in place (XIP))
  • ‎30x 3.3V user-programmable high-speed IO (only 18 are broken out on the board)
    • ‎4x 12-bit 500ksps Analogue to Digital Converter (ADC)
    • Various digital peripherals
    • ‎2x UART, 2x I2C, 2x SPI, up to 16 PWM channels
    • ‎1x Timer with 4 alarms, 1x Real Time Counter
  • ‎USB 1.1 Host/Device compatible

RP_12

RP2040 on the RP2040 mikroBUS™ development board

The processor implements the ARMv6-M Thumb instruction set and provides ‎programmable (multifunction) IO (PIO), which is unique to the RP2040. For more information, ‎please refer to the RP2040 datasheet.‎

USB Functionality

The RP2040 contains a USB 2.0 controller that can operate as either:

  • Full Speed device (12 Mbit/s)
  • Host that can communicate with both Low Speed (1.5 Mbit/s) and Full Speed devices. This ‎includes multiple downstream devices connected to a USB hub‎

USB Mass Storage Interface

The Bootrom provides a standard USB bootloader that emulates a writeable drive available for ‎loading firmware to the RP2040 using UF2 files. Once a UF2 file is loaded onto the drive, it is ‎written to the flash or RAM and the device automatically reboots.‎

  • The bootrom source code is hosted on GitHub

RPI-RP2 Drive

The RP2040 appears as a standard 128MB flash drive named RPI-RP2 formatted as a single ‎partition with FAT16. There are only ever two actual files visible on the drive specified.‎

  • INFO_UF2.TXT - contains a string description of the UF2 bootloader and version
  • INDEX.HTM - redirects to information about the RP2040 device

Note: Any type of files may be written to the USB drive from the host computer, however in general ‎these are not stored, and only appear to be so because of caching on the host side. When ‎a .uf2 file is written to the device however, the special contents are recognized and data is written ‎to specified locations in RAM or Flash. On the completed download of an entire valid .uf2 file, the ‎RP2040 automatically reboots to run the newly downloaded code.‎

Flash Memory

RP2040 has embedded ROM and SRAM, and access to external flash via a QSPI interface. On ‎the RP2040 mikroBUS™ development board, an additional 16MB (128Mbit) of 133MHz memory is ‎provided by a W25Q128JVPIM chip. The flash memory is required for the RP2040 to store ‎program code, which it can boot and run from through its dedicated QSPI pins:‎

  • Pin 52: CLK
  • Pin 56: CS
  • Pin 53: DATA 0/DI
  • Pin 55: DATA 1/DO
  • Pin 54: DATA 2/WP
  • Pin 51: DATA 3/HOLD

flash_13

W25Q128JVPIM flash memory on the RP2040 mikroBUS™ development board ‎

Note: The RP2040 is able to access up to a 16MB memory window starting at 0x10000000.‎

Indicator LEDs

There are 4 indication LEDs on the RP2040 mikroBUS™ development board for:‎

  • PWR: Power (Red)‎
  • CHG: Battery Charging (Yellow)
  • 25: GPIO 25 (Blue)
  • WS2812: GPIO 08 (RGB)‎

Power LED

The red, PWR LED will light up once 3.3V is supplied to the board. For most users, it will light up ‎when 5V is supplied through the USB connection and/or when a LiPo battery is attached to the JST ‎connector.‎

status_14

RP2040 mikroBUS™ development board PWR status LED indicator

Battery Charging LED

The yellow, CHG LED will light while a battery is being charged through the charging circuit. The ‎LED will be off when no battery is present (*or dimmed), when the charge management controller is ‎in standby (after the battery charging has been completed), or when the charge management ‎controller is shutdown (thermal shutdown or when the input voltage is lower than the battery ‎voltage). The LED will be on when the charge management controller is in the process of charging ‎the battery. For more information, please refer to the MCP73831 datasheet.‎

charging_15

The battery charging (CHG) LED indicator on the RP2040 mikroBUS™ development board

table_16

‎*The charge LED may appear dimmed due a trickle charge from the MAX17048 fuel gauge. ‎Normally, the LED should be OFF.

Status LED

The blue, 25 LED is typically used as a test or status LED to make sure that a board is working or ‎for basic debugging. This indicator is connected to GPIO 25.‎

test_17

The status/test (25) LED indicator on the RP2040 mikroBUS™ development board

WS2812 RGB LED

The WS2812 RGB LED is controlled with a 24-bit (GRB) data signal. This indicator is connected ‎to GPIO 08 and the digital output pin from the LED is broken out as the WS2812 pin on the board. ‎For more information, please refer to the WS2812C datasheet.‎

rgbled_18

WS2812 LED indicator on the RP2040 mikroBUS™ development board

Buttons

The RP2040 mikroBUS™ dev. board has two buttons on the board for uploading and running code.‎

Reset Button

The RESET button is connected to the reset pin and is used to reset the microcontroller without ‎needing to unplug the board.‎

reset_19

RESET button on the RP2040 mikroBUS™ development board

Boot Button

The BOOT button is used to force the board into BOOTSEL mode, by holding down the BOOT button ‎while connecting the board to a computer through its USB-C connector. Users can then, upload ‎firmware files to the emulated RPI-RP2 USB mass storage device.‎

boot_20

BOOT button on the RP2040 mikroBUS™ development board

BOOTSEL Mode: Users can enter BOOTSEL mode by holding down the BOOT button when the USB ‎connection is made to a computer. The board will remain in this mode until it power cycles (happens ‎automatically after uploading a .uf2 firmware file) or the RESET button is pressed. The board will ‎appear as a USB mass storage device under the name RPI-RP2.‎

hold_21

Hold down BOOT button to enter BOOTSEL mode on The SparkFun Thing Plus - RP2040

MikroBUS™ Socket

The most significant feature of this board, is the addition of the MikroBUS™ socket, which provides ‎a drop-in interface for MikroElectronka&apo;s ecosystem of Click boards™ (over 1079 as of ‎September 2021).‎

The mikroBUS™ socket comprises a pair of 8-pin female headers with a standardized pin ‎configuration. The pins consist of three groups of communications pins (SPI, UART and I2C), six ‎additional pins (PWM, Interrupt, Analog input, Reset and Chip select), and two power groups ‎‎(3.3V and 5V).‎

pins_22

Standardized pin connections for the mikroBUS™ socket

  • GPIO 02: SCK
  • GPIO 03: MOSI (COPI)
  • GPIO 04: MISO (CIPO)
  • GPIO 05: CS
  • GPIO 06: SDA
  • GPIO 07/23: SCL
  • GPIO 0: TX
  • GPIO 01: RX
  • GPIO 13: RST
  • GPIO 16: PWM
  • GPIO 17: INT
  • GPIO 26: AN

socket_23

MikroBUS™ socket on the RP2040 mikroBUS™ development board

‎*For more information about the mikroBUS™ socket, click here for the mikroBUS™ standard ‎specifications.‎

µSD Slot‎

Note: To comply with the latest OSHW design practices, on the RP2040 Thing Plus we ‎have replaced the MOSI/MISO nomenclature with SDO/SDI; the terms Master and Slave are now ‎referred to as Controller and Peripheral. The MOSI signal on a controller has been replaced with the ‎title SDO. Please refer to this announcement on the decision to deprecate ‎the MOSI/MISO terminology and transition to the SDO/SDI naming convention.‎

The RP2040 mikroBUS™ development board includes an µSD card slot. This is great for data ‎logging applications or storing files. The µSD card slot is connected to the following dedicated ‎GPIO:‎

  • GPIO 09: DATA 3/CS
  • GPIO 10: DATA 2
  • GPIO 11: DATA 1‎
  • GPIO 12: DATA 0/CIPO (or Peripheral's SDO)‎
  • GPIO 14: CLK/SCK
  • GPIO 15: CMD/COPI (or Peripheral's SDI)‎

card_24

‎µSD card slot on the RP2040 mikroBUS™ development board

Primary I2C Bus

A (battery) fuel gauge and a Qwiic connector are attached to the primary I2C bus I2C1. The primary ‎I2C bus for this board utilizes the GPIO connections, detailed in the table below:‎

table_25

bus_26

I2C bus components on the RP2040 mikroBUS™ development board

Note: The clock line of the I2C bus is tied between pins 9 and 35 (GPIO 07 and GPIO 23). This ‎allows GPIO 16 - GPIO 23 to be aligned on the board's edge, for a consecutive, eight pin bus, useful ‎for things like HDMI.

shared_27

Shared pin for GPIO 07 and GPIO 23 on the RP2040 mikroBUS™ development board

‎*Since the two GPIO pins are tied together, they cannot operate simultaneously.‎

Battery Fuel Gauge

The MAX17048 fuel gauge measures the approximate charge or discharge rate, state of charge ‎‎(SOC) (based on ModelGauge algorithm), and voltage of a connected battery. Additionally, there is ‎a configurable alert pin functionality for low SOC, 1% SOC, reset, overvoltage, or undervoltage. For ‎more information, please refer to the MAX17048 datasheet.‎

fuel_28

The MAX17048 fuel gauge on the RP2040 mikroBUS™ development board

table_29

Qwiic Connector

A Qwiic connector is provided for users to seamlessly integrate with SparkFun's Qwiic Ecosystem.‎

qwiic_30

Qwiic connector on the RP2040 mikroBUS™ development board

What is Qwiic?‎

The Qwiic system is intended a quick, hassle-free cabling/connector system for I2C devices. Qwiic ‎is actually a play on words between "quick" and I2C or "iic".

 

Features of the Qwiic System

  • NO SOLDERING

Keep your soldering iron at bay.‎

Cables plug easily between boards making quick work of setting up a new prototype. We currently ‎offer three different lengths of Qwiic cables as well as a breadboard friendly cable to connect any ‎Qwiic enabled board to anything else. Initially you may need to solder headers onto the shield to ‎connect your platform to the Qwiic system but once that’s done it’s plug and go!‎

cables_31

Qwiic cables connected to Spectral Sensor Breakout

I2C Jumper

Cutting the I2C jumper will remove the 4.7kΩ pull-up resistors from the I2C bus. If you have many ‎devices on your I2C bus you may want to remove these jumpers.‎

jumper_32

I2C pull-up resistor jumper

  • POLARIZED CONNECTOR

Minimize your mistakes.

How many times have you swapped the SDA and SCL wires on your breadboard hoping the sensor will start working? The Qwiic connector is polarized so you know you’ll have it wired correctly, every time, from the start.

The PCB connector is part number SM04B-SRSS (Datasheet) or equivalent. The mating connector used on cables is part number SHR04V-S-B or equivalent. This is a common and low cost connector.

JSTConnector_33

1mm pitch, 4-pin JST connector

I2C Jumper

Cutting the I2C jumper will remove the 4.7kΩ pull-up resistors from the I2C bus. If you have many devices on your I2C bus you may want to remove these jumpers.

I2Cjumper_34

I2C pull-up resistor jumper

  • DAISY CHAIN

Expand with ease.

It’s time to leverage the power of the I2C bus! Most Qwiic boards will have two or more connectors on them allowing multiple devices to be connected.

DaisyChain_35

Shown above: Qwiic Shield for Arduino on RedBoard, Spectral Sensor Breakout - NIR, Spectral Sensor Breakout - Visible, and SparkFun GPS Breakout

I2C Jumper

Cutting the I2C jumper will remove the 4.7kΩ pull-up resistors from the I2C bus. If you have many devices on your I2C bus you may want to remove these jumpers.

I2C_36

I2C pull-up resistor jumper

Hardware Assembly

USB Programming

The USB connection is utilized for programming and serial communication. Users only need to plug ‎their RP2040 mikroBUS™ development board into a computer using a USB-C cable.‎

computer_37

A USB-C cable attached to the RP2040 mikroBUS™ development board

BOOTSEL Mode

Users can enter BOOTSEL mode by holding down the BOOT button when the USB connection is made ‎to a computer. The board will remain in this mode until it power cycles (happens automatically after ‎uploading a .uf2 firmware file) or the RESET button is pressed. The board will appear as a USB ‎mass storage device under the name RPI-RP2.‎

mode_38

Hold down BOOT button to enter BOOTSEL mode on the RP2040 mikroBUS™ development board‎

Battery

For remote applications, the RP2040 Thing Plus can be powered through its 2-pin JST battery ‎connector. Additionally, users may be interested in utilizing a solar panel and USB-C cable to ‎recharge their battery.‎

battery_39

The RP2040 mikroBUS™ development board with a battery attached ‎

Note: DO NOT remove batteries by pulling on their wires. Instead, it is recommended that pair of ‎dikes (i.e., diagonal wire cutters), pliers, or tweezers be used to pull on the JST connector housing, ‎to avoid damaging the battery wiring.‎

pair_40

Using a pair of dikes to disconnect a battery ‎

Headers

The pins for the RP2040 mikroBUS™ development board are broken out to 0.1"-spaced pins on ‎the outer edges of the board. When selecting headers, be sure you are aware of the functionality ‎you need. If you have never soldered before or need a quick refresher, check out our How to ‎Solder: Through-Hole Soldering guide.‎

solder_41

Soldering headers to the RP2040 mikroBUS™ development board

The Feather Stackable Header Kit is a great option as it allows users to stack shields (w/ Feather ‎footprint) or it can be placed on the a breadboard; while, the pins are still accessible from the ‎female/male headers.‎

mikroBUS™ Socket

The RP2040 mikroBUS™ development board has a mikroBUS™ Socket, where a Click board™ can ‎be inserted.‎

click_42

A Click board™ inserted into the mikroBUS™ socket of the RP2040 mikroBUS™ development ‎board

Note: To remove a Click board™, slowly and carefully wiggle it out of the mikroBUS™ socket to ‎avoid bending the header pins on your Click board™.‎

The header also allows users to connect jumper wires to devices that may not have the mikroBUS™ ‎pin layout to interface with.‎

device_43

A device connected to the mikroBUS™ socket of the RP2040 mikroBUS™ development board with ‎jumper wires

Qwiic Devices

The Qwiic system allows users to effortlessly prototype with a Qwiic compatible I2C device without ‎soldering. Users can attach any Qwiic compatible sensor or board, with just a Qwiic cable. (*The ‎example below, is for demonstration purposes and is not pertinent to the board functionality or this ‎tutorial.)‎

devboard_44

Qwiic devices connected to the RP2040 mikroBUS™ development board

Software Overview

The Raspberry Pi foundation provides excellent documentation for the RP2040 on their website. ‎This includes information for users to program the RP204 with MicroPython and C/C++ through the ‎Pico SDK. Arduino has also announced the release of their Mbed RP2040 Arduino core. The ‎instructions below, are meant to help users setup and utilize the RP2040 mikroBUS™ Development ‎Board with the Arduino IDE.‎

Note: We recommend that users program their RP2040 mikroBUS™ development board through ‎the Arduino IDE. Additionally, we recommend that users select Click boards™ based on available ‎and compatible Arduino libraries.‎

If users wish to use another development platform/environment or utilize a Click board™ without ‎an Arduino library, it is expected that the user is experienced enough port the necessary resources ‎on their own.‎

For utilizing the Pico SDK (C/C++) and MicroPython, users can follow the instructions provided by ‎the Raspberry Pi Foundation documentation:‎

To utilize the mikroSDK™, users can refer to instructions provided by MikroElektronika:‎

Arduino IDE

Note: For first-time users, who have never programmed before and are looking to use the Arduino ‎IDE, we recommend beginning with the SparkFun Inventor's Kit (SIK), which includes a simpler ‎board like the Arduino Uno or SparkFun RedBoard and is designed to help users get started ‎programming with the Arduino IDE.‎

Most users will be familiar with the Arduino IDE and its use. As a point of reference for professional ‎developers who aren't aware, the Arduino IDE is an open-source development environment, written ‎in Java, that makes it easy to write code and upload it to a supported board. For more details, feel ‎free to check out the Arduino website.‎

To get started with the Arduino IDE, check out the following tutorials:‎

  • Installing an Arduino Library: How do I install a custom Arduino library? It's easy! This ‎tutorial will go over how to install an Arduino library using the Arduino Library Manager. For libraries ‎not linked with the Arduino IDE, we will also go over manually installing an Arduino library.‎
  • What is an Arduino? What is this 'Arduino' thing anyway? This tutorial dives into what an ‎Arduino is and along with Arduino projects and widgets.‎
  • Installing Arduino IDE: A step-by-step guide to installing and testing the Arduino software on ‎Windows, Mac, and Linux.‎
  • Installing Board Definitions in the Arduino IDE: How do I install a custom Arduino ‎board/core? It's easy! This tutorial will go over how to install an Arduino board definition using the ‎Arduino Board Manager. We will also go over manually installing third-party cores, such as the ‎board definitions required for many of the SparkFun development boards.‎

Installing the RP2040 Board Definition

Install the latest Arduino Mbed OS RP2040 board definitions in the Arduino IDE. Users unfamiliar ‎with the board definition installation process can reference our tutorial below.‎

install_45

Installing Board Definitions in the Arduino IDE

How do I install a custom Arduino board/core? It's easy! This tutorial will go over how to install an ‎Arduino board definition using the Arduino Board Manager.

We will also go over manually installing ‎third-party cores, such as the board definitions required for many of the SparkFun development ‎boards.‎

Installation Instructions:‎‎

1.‎ Search for RP2040 in the Boards Manager.

mbed_46

Arduino Mbed OS RP2040 listed in the Boards Manager

‎‎2.‎ To complete the installation process, selected the Arduino Mbed OS RP2040 core and click ‎on the INSTALL button that appears in the lower, right-hand corner. The board definition and ‎upload tools will be installed automatically; users will notice that this may take a while.

Note: Users may need to disable their anti-virus software when installing the Arduino Mbed ‎OS RP2040 board definition. We ran into issues, where the installation of the upload tools for ‎the Arduino core were blocked by the anti-virus software. Arduino is already aware of the ‎issue; they are working to get their files white-listed. For more information, users can ‎reference this GitHub issue.‎‎

3.‎ Programming Tip:‎

The board may not show up on a COM port, if users who have already programmed their ‎board through a different method. A simple solution is to:‎‎

1. Download the picoprobe.uf2 file from the Raspberry Pi foundation's Pico board ‎documentation page

CLICK TO DOWNLOAD THE PICOPROBE.UF2 FILE

2. Copy the picoprobe.uf2 firmware file to the board (while it is in BOOTSEL mode)

3. If the board isn't automatically listed on a COM port users should reset (or unplug and ‎re-plug in the board to the computer)‎

Note: If users have the Arduino IDE's Tools drop down menu open looking for a new COM ‎port to be added, the Arduino IDE doesn't automatically repopulate and update the listed COM ‎ports. To update the available COM ports list, users should close and then re-open ‎the Tools drop down menu and navigate to the available COM ports.‎

Note: Users trying to access the SD card slot will need to modify the pins_arduino.h file to ‎reconfigure the SPI bus pins. However, this will make the SPI bus inaccessible through the ‎breakout pins (when utilizing the SPI library).‎

  • On a Windows 10 computer, with the Arduino IDE installed through the App store, the location ‎of the pins_arduino.h file is:‎

C:\Users\<username>\Documents\ArduinoData\packages\arduino\hardware\mbed_rp2040\<pac‎kage_version>\variants\RASPBERRY_PI_PICO

file_47

pins_arduino.h file in the RASPBERRY_PI_PICO folder

  • Users will need to modify lines 45 - 47 of the pins_arduino.h file to the following:‎
Copy Code
// SPI
#define PIN_SPI_MISO (12u) //(4u)
#define PIN_SPI_MOSI (15u) //(3u)
#define PIN_SPI_SCK (14u) //(2u)

line_48

Line modifications to the pins_arduino.h file ‎

Note: GitHub user earlephilhower has ported an unofficial Arduino core for the RP2040, which is ‎based on the Pico SDK. This is useful for customers who want the functionality of the Pico SDK in ‎the Arduino IDE. Installation instructions are available in the GitHub repository.

Arduino Example

Note: The example for this tutorial assumes users have the latest version of the Arduino IDE ‎installed. If this is your first time using Arduino, please review our tutorial on installing the Arduino ‎IDE. If you have not previously installed an Arduino library, please check out our installation guide:‎

library_49

Installing an Arduino Library

How do I install a custom Arduino library? It's easy! This tutorial will go over how to install an ‎Arduino library using the Arduino Library Manager.

For libraries not linked with the Arduino IDE, we ‎will also go over manually installing an Arduino library.‎

For this example, users will need a USB-C cable, a RP2040 mikroBUS development board, ‎a Weather Click, and access to a computer with the Arduino IDE installed.‎

Hardware assembly is straight forward, insert the Click board into the mikroBUS socket and then ‎connect the RP2040 development board to the computer in BOOTSEL mode.‎

mode_50

The Weather Click inserted into the mikroBUS™ socket of the RP2040 development board

On the computer, users should have the MBed OS RP2040 Arduino core installed through ‎the Board Manager. The Weather Click utilizes the BME280 PTH sensor; therefore, users will ‎need to install a compatible Arduino library in the Arduino IDE. We recommend the SparkFun ‎BME280 Arduino Library.‎

manager_51

The SparkFun BME280 Arduino Library in the library manager

Once installed, users will have access to basic examples for the sensor. The examples can be ‎found under the File > Examples > SparkFun BME280 menu options. We recommend trying ‎the Example1_BasicReadings sketch first. Users will need to modify the sketch in the setup() loop ‎for it to function properly:‎

Copy Code
Serial.begin(115200);


while (!Serial){
; // wait for serial port
}

// Set I2C address
mySensor.settings.I2CAddress = 0x76;


Serial.println("Reading basic values from BME280");
  • The while statement allows the RP2040 to sync properly with a terminal emulator
  • The default I2C address of the library is 0x77; however, it must be changed to the address ‎configured on the Weather Click

Once these changes have been made, users can upload the program. After the upload process has ‎completed, users can open the Serial Monitor to see the sensor data:‎

data_52

Uploading the example sketch to the RP2040 mikroBUS™ development board and the Weather ‎Click sensor's data displayed in the Serial Monitor

Resources and Going Further

For more on the RP2040 mikroBUS™ development board, check out the links below:‎

制造商零件编号 DEV-18721
RP2040 MIKROBUS DEV BOARD
SparkFun Electronics
制造商零件编号 CAB-14743
CABLE A PLUG TO C PLUG 3.28'
SparkFun Electronics
制造商零件编号 CAB-17261
FLEXIBLE QWIIC CABLE - FEMALE JU
SparkFun Electronics
制造商零件编号 GPS-15712
GPS BREAKOUT NEO-M9N QWIIC U.FL
SparkFun Electronics
制造商零件编号 KIT-17980
SPARKFUN RASPBERRY PI 4 BASIC KI
SparkFun Electronics
制造商零件编号 GPS-15136
GPS-RTK2 BOARD - ZED-F9P (QWIIC)
SparkFun Electronics
制造商零件编号 WLC100
SOLDERING STATION 40W 1 CH 120V
Apex Tool Group
制造商零件编号 49500WS-454G
SOLDER WIRE WS 3.3% FLUX CORE 0.
MG Chemicals
制造商零件编号 CQ4LF-B-R
LIQUID FLUX NO-CLEAN IN 6ML (0.2
Chip Quik Inc.
制造商零件编号 44012
KNIFE PRECISION WITH #11 BLADE
Aven Tools
制造商零件编号 GPS-14414
GPS BREAKOUT - XA1110 (QWIIC)
SparkFun Electronics
制造商零件编号 DEV-14352
QWIIC SHIELD FOR ARDUINO
SparkFun Electronics
制造商零件编号 DEV-13975
REDBOARD ATMEGA328 EVAL BRD
SparkFun Electronics
制造商零件编号 SEN-14351
QWIIC SPECTRAL SENSOR BRD AS7263
SparkFun Electronics
制造商零件编号 SEN-14347
QWIIC SPECTRAL SENSOR BRD AS7262
SparkFun Electronics
制造商零件编号 KIT-15081
QWIIC CABLE KIT
SparkFun Electronics
制造商零件编号 PRT-17258
FLEXIBLE QWIIC CABLE - 200MM
SparkFun Electronics
制造商零件编号 KIT-15631
ARDUINO UNO INVENTOR KIT V4.1
SparkFun Electronics
制造商零件编号 A000066
ARDUINO UNO R3 ATMEGA328P BOARD
Arduino
制造商零件编号 DEV-15123
REDBOARD QWIIC ATMEGA328 EVAL BD
SparkFun Electronics
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum