Schlagwort: Raspberry Pi RP2040

  • How to add LoRaWAN to Raspberry Pi Pico

    How to add LoRaWAN to Raspberry Pi Pico

    Reading Time: 9 minutes

    Arguably the winner of the standards war around wide area networking protocols for the Internet of Things, LoRaWAN is a low-powered, low-bandwidth, and long-range protocol. Intended to connect battery-powered remote sensors back to the internet via a gateway, on a good day, with a reasonable antenna, you might well get 15km of range from an off-the-shelf LoRa radio. The downside is that the available bandwidth will be measured in bytes, not megabytes, or even kilobytes.

    Support for LoRa connectivity for Raspberry Pi Pico was put together by Sandeep Mistry, the author of the Arduino LoRa library, who more recently also gave us Ethernet support for Pico. His library adds LoRa support for Pico and other RP2040-based boards using the Semtech SX1276 radio module. That means that breakouts like Adafruit’s RFM95W board, as well as their LoRa FeatherWing, are fully supported.

    LoRaWAN coverage?

    To make use of a LoraWAN-enabled Pico you’re going to need to be in range of a LoRa gateway. Fortunately there is The Things Network, an open-source community LoRaWAN network that has global coverage.

    [youtube https://www.youtube.com/watch?v=U4UrXl-SGEo?feature=oembed&w=500&h=281]

    About The Things Network

    Depending on where you are located, it’s quite possible that you’re already in coverage. However, if you aren’t, then you needn’t worry too much.

    The days when the cost of a LoRaWAN base station was of the order of several thousand dollars are long gone. You can now pick up a LoRa gateway for around £75. However I built my own gateway a couple of years ago. Unsurprisingly, perhaps, it was based around a Raspberry Pi.

    Getting the source

    If you already have the Raspberry Pi Pico toolchain set up and working, make sure your pico-sdk checkout is up to date, including submodules. If not, you should first set up the C/C++ SDK and then afterwards you need to grab the project from GitHub.

    $ git clone --recurse-submodules https://github.com/sandeepmistry/pico-lorawan.git
    $ cd pico_lorawan

    Make sure you have your PICO_SDK_PATH set before before proceeding. For instance, if you’re building things on a Raspberry Pi and you’ve run the pico_setup.sh script, or followed the instructions in our Getting Started guide, you’d point the PICO_SDK_PATH to

    $ export PICO_SDK_PATH = /home/pi/pico/pico-sdk

    Afterwards you are ready to build both the library and the example applications. But before you do that we need to do two other things: configure the cloud infrastructure where our data is going to go, and wire up our LoRa radio board to our Raspberry Pi Pico.

    Set up an application

    The Things Network is currently migrating from the V2 to V3 stack. Since my home gateway was set up a couple of years ago, I’m still using the V2 software and haven’t migrated yet. I’m therefore going to build a V2-style application. However, if you’re using a public gateway, or building your own gateway, you probably should build a V3-style application. The instructions are similar, and you should be able to make your way through based on what’s written below. Just be aware that there is a separate Network Console for the new V3 stack and things might look a little different.

    Migration from TTN V2 to V3

    While any LoRa device in range of your new gateway will have its packets received and sent upstream to The Things Network, the data packets will be dropped on the ground unless they have somewhere to go. In other words, The Things Network needs to know where to route the packets your gateway is receiving.

    In order to give it this information, we first need to create an application inside The Things Network Console. To do this all you’ll need to do is type in a unique Application ID string — this can be anything — and the console will generate an Application EUI and a default Access Key which we’ll use to register our devices to our application.

    Adding an application

    Once we’ve registered an application, all we have to do then is register our individual device — or later perhaps many devices — to that application, so that the backend knows where to route packets from that device.

    Registering a device

    Registering our device can be done from the application’s page in the console.

    Registering a device to an application

    The Device ID is a human-readable string to identify our remote device. Since RFM9W breakout board from Adafruit ships with a sticker in the same bag as the radio with a unique identifier written on it we can use that to postpend a string to uniquely identify our Pico board, so we end up with something like pico-xy-xy-xy-xy-xy-xy as our Device ID.

    We’ll also need to generate a Device EUI2. This is a 64-bit unique identifier. Here again we can use the unique identifier from the sticker, except this time we can just pad it with two leading zeros, 0000XYXYXYXYXYXY, to generate our Device EUI. You could also use pico_get_unique_board_id( ) to generate the Device EUI.

    If you take a look at your Device page after registration you’ll need the Application EUI2 and Application Key2 to let your board talk to the LoRa network, or more precisely to let the network correctly route packets from your board to your application.

    2 Make a note of your Device EUI, Application EUI, and Application Key.

    Wiring things up on a breadboard

    Now we’ve got our cloud backend set up, the next thing we need to do is connect our Pico to the LoRa breakout board. Unfortunately the RFM95W breakout isn’t really that breadboard-friendly. At least it’s not breadboard-friendly if you need access to the radio’s pins on both sides of the board like we do for this project — in this case the breakout is just a little bit too wide for a standard breadboard.

    Fortunately it’s not really that much of a problem, but you will probably need to grab a bunch of male-to-female jumper wires along with your breadboard. Go ahead and wire up the RFM95W module to your Raspberry Pi Pico. The mapping between the pins on the breakout board and your Pico should be as follows:

    Pico RP20401 SX1276 Module RFM95W Breakout
    3V3 (OUT) VCC VIN
    GND GND GND GND
    Pin 10 GP7 DIO0 G0
    Pin 11 GP8 NSS CS
    Pin 12 GP9 RESET RST
    Pin 14 GP10 DIO1 G1
    Pin 21 GP16 (SPI0 RX) MISO MISO
    Pin 24 GP18 (SPI0 SCK) SCK SCK
    Pin 25 GP19 (SPI0 TX) MOSI MOSI
    Mapping between physical pins, RP2040 pins, SX1276 module, and RFM95W breakout

    These pins are the library default and can be changed in software.

    Building and deploying software

    Now we have our backend in the cloud set up, and we’ve physically “built” our radio, we can build and deploy our LoRaWAN application. One of the example applications provided by the library will read the temperature from the on-chip sensor on the RP2040 microcontroller and send it periodically to your Things Network application over the LoRaWAN radio.

    void internal_temperature_init() { adc_init(); adc_select_input(4); adc_set_temp_sensor_enabled(true);
    } float internal_temperature_get() { float adc_voltage = adc_read() * 3.3f / 4096; float adc_temperature = 27 - (adc_voltage - 0.706f) / 0.001721f; return adc_temperature;
    }

    Go ahead and change directory to the otaa_temperature_led example application in your checkout. This example uses OTAA, so we’ll need the Device EUI, Application EUI, and Application Key we created.

    $ cd examples/otaa_temperature_led/

    Open the config.h file in your favourite editor and change the REGION, DEVICE_EUI, APP_EUI, and APP_KEY to the values shown in the Network Console. The code is expecting the (default) string format, without spaces between the hexadecimal digits, rather than the byte array representation.

    #define LORAWAN_REGION LORAMAC_REGION_EU868
    #define LORAWAN_DEVICE_EUI "Insert your Device EUI"
    #define LORAWAN_APP_EUI "Insert your Application EUI"
    #define LORAWAN_APP_KEY "Insert your App Key"
    #define LORAWAN_CHANNEL_MASK NULL

    I’m located in the United Kingdom, with my LoRa radio broadcasting at 868MHz, so I’m going to set my region to LORAMAC_REGION_EU868. If you’re in the United States you’re using 915MHz, so need to set your region to LORAMAC_REGION_US915.

    Then after you’ve edited the config.h file you can go ahead and build the example applications.

    $ cd ../..
    $ mkdir build
    $ cd build
    $ cmake ..
    $ make

    If everything goes well you should have a UF2 file in build/examples/otaa_temperature_led/ called pico_lorawan_otaa_temperature_led.uf2. You can now load this UF2 file onto your Pico in the normal way.

    Grab your Raspberry Pi Pico board and a micro USB cable. Plug the cable into your Raspberry Pi or laptop, then press and hold the BOOTSEL button on your Pico while you plug the other end of the micro USB cable into the board. Then release the button after the board is plugged in.

    A disk volume called RPI-RP2 should pop up on your desktop. Double-click to open it, and then drag and drop the UF2 file into it. If you’re having problems, see Chapter 4 of our Getting Started guide for more information.

    Your Pico is now running your LoRaWAN application, and if you want to you should be able to see some debugging information by opening a USB Serial connection to your Pico. Open a Terminal window and start minicom.

    $ minicom -D /dev/ttyACM0

    Sending data

    However, you’ll need to turn to the Network console to see the real information. You should see an initial join message, followed by a number of frames. Each frame represents a temperature measurement sent by your Pico via LoRaWAN and the Gateway to The Things Network application.

    Data coming via LoRaWAN to the Things Network
    Data coming via LoRaWAN to The Things Network

    The payload value is the temperature measured by the Raspberry Pi Pico’s internal temperature sensor in hexadecimal. It’s a bit outside the scope of this article, but you can now add a decoder and integrations that allow you decode the data from hexadecimal into human-readable data and then, amongst various other options, save it to a database. To illustrate the power of what you can do here, go to the “Payload Formats” tab of your application and enter the following Javascript in the “decoder” box,

    function Decoder(bytes, port) { var decoded = {}; decoded.temp = bytes[0]; return decoded;
    }

    then scroll down and hit the green “save payload functions” button.

    Returning to the “Data” tab you should see that the payload, in hexidecimal, is now post-pended with the temperature in Celcius. Our simple decoder has taken our payload and translated it back into a Javascript object.

    Sending commands

    As well as sending temperature data, the example application will also let you toggle the LED on your Raspberry Pi Pico directly from The Things Network console.

    Sending data back to your Raspberry Pi Pico via LoRaWAN

    Go to the Device page in the Network Console and type “01” into the Downlink Payload box, and hit the “Send” button. Then flip to the Data tab. You should see a “Download scheduled” line, and if you continue to watch you should see the byte downlinked. When that happens the on-board LED on your Raspberry Pi Pico should turn on! Returning to the Network Console and typing “00” into the Payload box will (eventually) turn the Pico’s LED off.

    Remember that LoRaWAN is long-range, but low-bandwidth. You shouldn’t expect an instant response to a downlinked command.

    Where now?

    The OTAA example application is a really nice skeleton for you to build on that will let you take data and send it to the cloud over LoRa, as well as send commands back from the cloud to your LoRa-enabled Pico.

    [youtube https://www.youtube.com/watch?v=HiVEFmhJD7g?feature=oembed&w=500&h=281]

    Arm Innovation Coffee – The Things Network

    There will be more discussion around the Things Network and a live demo of LoRaWAN from a Raspberry Pi Pico during this week’s Arm Innovation Coffee at 10:00 PDT (18:00 BST) this Thursday (29 April).

    Wrapping up

    Support for developing for Pico can be found on the Raspberry Pi forums. There is also an (unofficial) Discord server where a lot of people active in the community seem to be hanging out. Feedback on the documentation should be posted as an Issue to the pico-feedback repository on GitHub, or directly to the relevant repository it concerns.

    All of the documentation, along with lots of other help and links, can be found on the Getting Started page. If you lose track of where that is in the future, you can always find it from your Pico: to access the page, just press and hold the BOOTSEL button on your Pico, plug it into your laptop or Raspberry Pi, then release the button. Go ahead and open the RPI-RP2 volume, and then click on the INDEX.HTM file.

    That will always take you to the Getting Started page.

    Website: LINK

  • Drag-n-drop coding for Raspberry Pi Pico

    Drag-n-drop coding for Raspberry Pi Pico

    Reading Time: 3 minutes

    Introducing Piper Make: a Raspberry Pi Pico-friendly drag-n-drop coding tool that’s free for anyone to use.

    piper make screenshot
    The ‘Digital View’ option displays a dynamic view of Raspberry Pi Pico showing GPIO states

    Edtech startup Piper, Inc. launched this brand new browser-based coding tool on #PiDay. If you already have a Raspberry Pi Pico, head to make.playpiper.com and start playing with the coding tool for free.

    Pico in front of Piper Make screen
    If you already have a Raspberry Pi Pico, you can get started right away

    Complete coding challenges with Pico

    The block coding environment invites you to try a series of challenges. When you succeed in blinking an LED, the next challenge is opened up to you. New challenges are released every month, and it’s a great way to guide your learning and give you a sense of achievement as you check off each task.

    But I don’t have a Pico or the components I need!

    You’re going to need some kit to complete these challenges. The components you’ll need are easy to get hold of, and they’re things you probably already have lying around if you like to tinker, but if you’re a coding newbie and don’t have a workshop full of trinkets, Piper makes it easy for you. You can join their Makers Club and receive a one-off Starter Kit containing a Raspberry Pi Pico, LEDs, resistors, switches, and wires.

    Piper Make starter kit
    The Starter Kit contains everything you need to complete the first challenges

    If you sign up to Piper’s Monthly Makers Club you’ll receive the Starter Kit, plus new hardware each month to help you complete the latest challenge. Each Raspberry Pi Pico board ships with Piper Make firmware already loaded, so you can plug and play.

    Piper Make starter kit in action
    Trying out the traffic light challenge with the Starter Kit

    If you already have things like a breadboard, LEDs, and so on, then you don’t need to sign up at all. Dive straight in and get started on the challenges.

    I have a Raspberry Pi Pico. How do I play?

    A quick tip before we go: when you hit the Piper Make landing page for the first time, don’t click ‘Getting Started’ just yet. You need to set up your Pico first of all, so scroll down and select ‘Setup my Pico’. Once you’ve done that, you’re good to go.

    Scroll down on the landing page to set up your Pico before hitting ‘Getting Started’

    Website: LINK

  • Graphic routines for Raspberry Pi Pico screens

    Graphic routines for Raspberry Pi Pico screens

    Reading Time: 7 minutes

    Pimoroni has brought out two add‑ons with screens: Pico Display and Pico Explorer. A very basic set of methods is provided in the Pimoroni UF2 file. In this article, we aim to explain how the screens are controlled with these low-level instructions, and provide a library of extra routines and example code to help you produce stunning displays.

    You don't have to get creative with your text placement, but you can
    You don’t have to get creative with your text placement, but you can

    You will need to install the Pimoroni MicroPython UF2 file on your Pico and Thonny on your computer.

    All graphical programs need the following ‘boilerplate’ code at the beginning to initialise the display and create the essential buffer. (We’re using a Pico Explorer – just change the first line for a Pico Display board.)

    import picoexplorer as display
    # import picodisplay as display
    #Screen essentials
    width = display.get_width()
    height = display.get_height()
    display_buffer = bytearray(width * height * 2)
    display.init(display_buffer)

    The four buttons give you a way of getting data back from the user as well as displaying information
    The four buttons give you a way of getting data back from the user as well as displaying information

    This creates a buffer with a 16-bit colour element for each pixel of the 240×240 pixel screen. The code invisibly stores colour values in the buffer which are then revealed with a display.update() instruction.

    The top-left corner of the screen is the origin (0,0) and the bottom-right pixel is (239,239).

    Supplied methods

    display.set_pen(r, g, b)

    Sets the current colour (red, green, blue) with values in the range 0 to 255.

    grey = display.create_pen(100,100,100)

    Allows naming of a colour for later use.

    display.clear()

    Fills all elements in the buffer with the current colour.

    display.update()

    Makes the current values stored in the buffer visible. (Shows what has been written.)

    display.pixel(x, y)

    Draws a single pixel with the current colour at
    point(x, y).

    display.rectangle(x, y ,w ,h) 

    Draws a filled rectangle from point(x, y), w pixels wide and h pixels high.

    display.circle(x, y, r)

    Draws a filled circle with centre (x, y) and radius r.

    display.character(78, 112, 5 ,2)

    Draws character number 78 (ASCII = ‘N’) at point (112,5) in size 2. Size 1 is very small, while 6 is rather blocky.

    display.text("Pixels", 63, 25, 200, 4)

    Draws the text on the screen from (63,25) in size 4 with text wrapping to next line at a ‘space’ if the text is longer than 200 pixels. (Complicated but very useful.)

    display.pixel_span(30,190,180)

    Draws a horizontal line 180 pixels long from point (30,190).

    display.set_clip(20, 135, 200, 100)

    While the screens are quite small in size, they have plenty of pixels for display
    While the screens are quite small in size, they have plenty of pixels for display

    After this instruction, which sets a rectangular area from (20,135), 200 pixels wide and 100 pixels high, only pixels drawn within the set area are put into the buffer. Drawing outside the area is ignored. So only those parts of a large circle intersecting with the clip are effective. We used this method to create the red segment.

    display.remove_clip()

    This removes the clip.

    display.update()

    This makes the current state of the buffer visible on the screen. Often forgotten.

    if display.is_pressed(3): # Y button is pressed ?

    Read a button, numbered 0 to 3.

    You can get more creative with the colours if you wish
    You can get more creative with the colours if you wish

    This code demonstrates the built-in methods and can be downloaded here.

    # Pico Explorer - Basics
    # Tony Goodhew - 20th Feb 2021
    import picoexplorer as display
    import utime, random
    #Screen essentials
    width = display.get_width()
    height = display.get_height()
    display_buffer = bytearray(width * height * 2)
    display.init(display_buffer)

    def blk():
        display.set_pen(0,0,0)
        display.clear()
        display.update()

    def show(tt):
        display.update()
        utime.sleep(tt)
       
    def title(msg,r,g,b):
        blk()
        display.set_pen(r,g,b)
        display.text(msg, 20, 70, 200, 4)
        show(2)
        blk()

    # Named pen colour
    grey = display.create_pen(100,100,100)
    # ==== Main ======
    blk()
    title(„Pico Explorer Graphics“,200,200,0)
    display.set_pen(255,0,0)
    display.clear()
    display.set_pen(0,0,0)
    display.rectangle(2,2,235,235)
    show(1)
    # Blue rectangles
    display.set_pen(0,0,255)
    display.rectangle(3,107,20,20)
    display.rectangle(216,107,20,20)
    display.rectangle(107,3,20,20)
    display.rectangle(107,216,20,20)
    display.set_pen(200,200,200)
    #Compass  points
    display.character(78,112,5,2)   # N
    display.character(83,113,218,2) # S
    display.character(87,7,110,2)   # W
    display.character(69,222,110,2) # E
    show(1)
    # Pixels
    display.set_pen(255,255,0)
    display.text(„Pixels“, 63, 25, 200, 4)
    display.set_pen(0,200,0)
    display.rectangle(58,58,124,124)
    display.set_pen(30,30,30)
    display.rectangle(60,60,120,120)
    display.update()
    display.set_pen(0,255,0)
    for i in range(500):
        xp = random.randint(0,119) + 60
        yp = random.randint(0,119) + 60
        display.pixel(xp,yp)
        display.update()
    show(1)
    # Horizontal line
    display.set_pen(0,180,0)
    display.pixel_span(30,190,180)
    show(1)
    # Circle
    display.circle(119,119,50)
    show(1.5)
    display.set_clip(20,135, 200, 100)
    display.set_pen(200,0,0)
    display.circle(119,119,50)
    display.remove_clip()

    display.set_pen(0,0,0)
    display.text(„Circle“, 76, 110, 194, 3)
    display.text(„Clipped“, 85, 138, 194, 2)
    display.set_pen(grey) # Previously saved colour
    # Button Y
    display.text(„Press button y“, 47, 195, 208, 2)
    show(0)
    running = True
    while running:
        if display.is_pressed(3): # Y button is pressed ?
            running = False
    blk()

    # Tidy up
    title(„Done“,200,0,0)
    show(2)
    blk()

    Straight lines can give the appearance of curves
    Straight lines can give the appearance of curves

    We’ve included three short procedures to help reduce code repetition:

    def blk() 

    This clears the screen to black – the normal background colour.

    def show(tt)

    This updates the screen, making the buffer visible and then waits tt seconds.

    def title(msg,r,g,b)

    This is used to display the msg string in size 4 text in the specified colour for two seconds, and then clears the display.

    As you can see from the demonstration, we can accomplish a great deal using just these built-in methods. However, it would be useful to be able to draw vertical lines, lines from point A to point B, hollow circles, and rectangles. If these are written as procedures, we can easily copy and paste them into new projects to save time and effort.

    You don't need much to create interesting graphics
    You don’t need much to create interesting graphics

    In our second demonstration, we’ve included these ‘helper’ procedures. They use the parameters (t, l, r, b) to represent the (top, left) and the (right, bottom) corners of rectangles or lines.

    def horiz(l,t,r):    # left, top, right

    Draws a horizontal line.

    def vert(l,t,b):   # left, top, bottom

    Draws a vertical line.

    def box(l,t,r,b):  # left, top, right, bottom

    Draws an outline rectangular box.

    def line(x,y,xx,yy): 

    Draws a line from (x,y) to (xx,yy).

    def ring(cx,cy,rr,rim): # Centre, radius, thickness

    Draws a circle, centred on (cx,cy), of outer radius rr and pixel thickness of rim. This is easy and fast but has the disadvantage that it wipes out anything inside ring

    def ring2(cx,cy,r):   # Centre (x,y), radius

    Draw a circle centred on (cx,cy), of radius rr with a single-pixel width. Can be used to flash a ring around something already drawn on the screen. You need to import math as it uses trigonometry.

    def align(n, max_chars):

    This returns a string version of int(n), right aligned in a string of max_chars length. Unfortunately, the font supplied by Pimoroni in its UF2 is not monospaced.

    What will you create with your Pico display?
    What will you create with your Pico display?

    The second demonstration is too long to print, but can be downloaded here.

    It illustrates the character set, drawing of lines, circles and boxes; plotting graphs, writing text at an angle or following a curved path, scrolling text along a sine curve, controlling an interactive bar graph with the buttons, updating a numeric value, changing the size and brightness of disks, and the colour of a rectangle.  

    The program is fully commented, so it should be quite easy to follow.

    The most common coding mistake is to forget the display.update() instruction after drawing something. The second is putting it in the wrong place.

    When overwriting text on the screen to update a changing value, you should first overwrite the value with a small rectangle in the background colour. Notice that the percentage value is right-aligned to lock the ‘units’ position. 

    It’s probably not a good idea to leave your display brightly lit for hours at a time. Several people have reported the appearance of ‘burn’ on a dark background, or ‘ghost’ marks after very bright items against a dark background have been displayed for some time. We’ve seen them on our display, but no long-term harm is evident. Blanking the screen in the ‘tidy-up’ sequence at the end of your program may help.

    We hope you have found this tutorial useful and that it encourages you to start sending your output to a display. This is so much more rewarding than just printing to the REPL.

    If you have a Pimoroni Pico Display, (240×135 pixels), all of these routines will work on your board.

    Issue 41 of HackSpace magazine is on sale NOW!

    Each month, HackSpace magazine brings you the best projects, tips, tricks and tutorials from the makersphere. You can get it from the Raspberry Pi Press online store or your local newsagents. As always, every issue is free to download from the HackSpace magazine website.

    Website: LINK

  • How to add Ethernet to Raspberry Pi Pico

    How to add Ethernet to Raspberry Pi Pico

    Reading Time: 6 minutes

    Raspberry Pi Pico has a lot of interesting and unique features, but it doesn’t have networking. Of course this was only ever going to be a temporary inconvenience, and sure enough, over Pi Day weekend we saw both USB Ethernet and Ethernet PHY support released for Pico and RP2040.

    Raspberry Pi Pico and RMII Ethernet PHY
    Raspberry Pi Pico and RMII Ethernet PHY

    The PHY support was put together by Sandeep Mistry, well known as the author of the noble and bleno Node.js libraries, as well as the Arduino LoRa library, amongst others. Built around the lwIP stack, it leverages the PIO, DMA, and dual-core capabilities of RP2040 to create an Ethernet MAC stack in software. The project currently supports RMII-based Ethernet PHY modules like the Microchip LAN8720.

    Breakout boards for the LAN8720 can be found on AliExpress for around $1.50. If you want to pick one up next day on Amazon you should be prepared to pay somewhat more, especially if you want Amazon Prime delivery, although they can still be found fairly cheaply if you’re prepared to wait a while.

    What this means is that you can now connect your $4 microcontroller to an Ethernet breakout costing less than $2 and connect it to the internet.

    Building from source

    If you don’t already have the Raspberry Pi Pico toolchain set up and working, you should first set up the C/C++ SDK. Afterwards you need grab the the project from GitHub, along with the lwIP stack.

    $ git clone git@github.com:sandeepmistry/pico-rmii-ethernet.git
    $ cd pico-rmii-ethernet
    $ git submodule update --init

    Make sure you have your PICO_SDK_PATH set before before proceeding. For instance, if you’re building things on a Raspberry Pi and you’ve run the pico_setup.sh script, or followed the instructions in our Getting Started guide, you’d point the PICO_SDK_PATH to

    $ export PICO_SDK_PATH = /home/pi/pico/pico-sdk

    then after that you can go ahead and build both the library and the example application.

    $ mkdir build
    $ cd build
    $ cmake ..
    $ make

    If everything goes well you should have a UF2 file in build/examples/httpd called pico_rmii_ethernet_httpd.uf2. You can now load this UF2 file onto your Pico in the normal way.

    Go grab your Raspberry Pi Pico board and a micro USB cable. Plug the cable into your Raspberry Pi or laptop, then press and hold the BOOTSEL button on your Pico while you plug the other end of the micro USB cable into the board. Then release the button after the board is plugged in.

    A disk volume called RPI-RP2 should pop up on your desktop. Double-click to open it, and then drag and drop the UF2 file into it. Your Pico is now running a webserver. Unfortunately it’s not going to be much use until we wire it up to our Ethernet breakout board.

    Wiring things up on the breadboard

    Unfortunately the most common (and cheapest) breakout for the LAN8720 isn’t breadboard-friendly, although you can find some boards that are, so you’ll probably need to grab a bunch of male-to-female jumper wires along with your breadboard.

    LAN8720 breakout wired to a Raspberry Pi Pico on a breadboard.
    LAN8720 breakout wired to a Raspberry Pi Pico on a breadboard (with reset button)

    Then wire up the breakout board to your Raspberry Pi Pico. Most of these boards seem to be well labelled, with the left-hand labels corresponding to the top row of breakout pins. The mapping between the pins on the RMII-based LAN8720 breakout board and your Pico should be as follows:

    Pico RP20401 LAN8720 Breakout
    Pin 9 GP6 RX0
    Pin 10 GP7 RX1 (RX0 + 1 )
    Pin 11 GP8 CRS (RX0 + 2)
    Pin 14 GP10 TX0
    Pin 15 GP11 TX1 (TX0 + 1)
    Pin 16 GP12 TX-EN (TX0 + 2)
    Pin 19 GP14 MDIO
    Pin 20 GP15 MDC
    Pin 26 GP20 nINT / RETCLK
    3V3 (OUT) VCC
    Pin 38 GND GND
    Mapping between physical pin number, RP2040 pin, and LAN8720 breakout

    1 These pins are the library default and can be changed in software.

    Once you’ve wired things up, plug your Pico into Ethernet and also via USB into your Raspberry Pi or laptop. As well as powering your Pico you’ll be able to see some debugging information via USB Serial. Open a Terminal window and start minicom.

    $ minicom -D /dev/ttyACM0

    If you’re having problems, see Chapter 4 of our Getting Started guide for more information.

    Hopefully, so long as your router is handing out IP addresses, you should see something like this in the minicom window, showing that your Pico has grabbed an IP address using DHCP:

    pico rmii ethernet - httpd netif status changed 0.0.0.0 netif link status changed up netif status changed 192.168.1.110

    If you open up a browser window and type the IP address that your router has assigned to your Pico into the address bar, if everything goes well you should see the default lwIP index page:

    Viewing the web page served from our Raspberry Pi Pico.

    Congratulations. Your Pico is now a web server.

    Changing the web pages

    It turns out to be pretty easy to change the web pages served by Pico. You can find the “file system” with the default lwIP pages inside the HTTP application in the lwIP Git submodule.

    $ cd pico-rmii-ethernet/lib/lwip/src/apps/http/fs
    $ ls 404.html img/ index.html
    $ 

    You should modify the index.html file in situ here with your favourite editor. Afterwards we’ll need to move the file system directory into place, and then we can repackage it up using the associated makefsdata script.

    $ cd ..
    $ mv fs makefsdata $ cd makefsdata
    $ perl makefsdata

    Running this script will create an fsdata.c file in the current directory. You need to move this file up to the parent directory and then rebuild the UF2 file.

    $ mv fsdata.c ..
    $ cd ../../../../../..
    $ rm -rf build
    $ mkdir build
    $ cd build
    $ cmake ..
    $ make

    If everything goes well you should have a new UF2 file in build/examples/httpd called pico_rmii_ethernet_httpd.uf2 , and you can again load this UF2 file onto your Pico as before.

    The updated web page served from our Raspberry Pi Pico.
    The updated web page served from our Raspberry Pi Pico

    On restart, wait till your Pico grabs an IP address again and then, opening up a browser window again and typing the IP address assigned to your Pico into the address bar, you should now see an updated web page.

    You can go back and edit the page served from your Pico, and build an entire site. Remember that you’ll need to rebuild the fsdata.c file each time before your rebuild your UF2.

    Current limitations

    There are a couple of limitations on the current implementation. The RP2040 is running underclocked to just 50MHz using the RMII modules’ reference clock, while the lwIP stack is compiled with NO_SYS so neither the Netcon API nor the Socket API is enabled. Finally, link speed is set to 10 Mbps as there is currently an issue with TX at 100 Mbps.

    Where next?

    While the example Sandeep put together used the lwIP web server, there are a number of other library application examples we can grab and twist to our own ends, including TFTP and MQTT example applications. Beyond that, lwIP is a TCP/IP stack. Anything you can do over TCP you can now do from your Pico.

    Wrapping up

    Support for developing for Pico can be found on the Raspberry Pi forums. There is also an (unofficial) Discord server where a lot of people active in the new community seem to be hanging out. Feedback on the documentation should be posted as an Issue to the pico-feedback repository on GitHub, or directly to the relevant repository it concerns.

    All of the documentation, along with lots of other help and links, can be found on the Getting Started page. If you lose track of where that is in the future, you can always find it from your Pico: to access the page, just press and hold the BOOTSEL button on your Pico, plug it into your laptop or Raspberry Pi, then release the button. Go ahead and open the RPI-RP2 volume, and then click on the INDEX.HTM file.

    That will always take you to the Getting Started page.

    Website: LINK

  • Raspberry Pi Pico – Vertical innovation

    Raspberry Pi Pico – Vertical innovation

    Reading Time: 4 minutes

    Our Chief Operating Officer and Hardware Lead James Adams talked to The MagPi Magazine about building Raspberry Pi’s first microcontroller platform.

    On 21 January we launched the $4 Raspberry Pi Pico. As I write, we’ve taken orders for nearly a million units, and are working hard to ramp production of both the Pico board itself and the chip that powers it, the Raspberry Pi RP2040.

    Close up of R P 20 40 chip embedded in a Pico board
    RP2040 at the heart of Raspberry Pi Pico

    Microcontrollers are a huge yet largely unseen part of our modern lives. They are the hidden computers running most home appliances, gadgets, and toys. Pico and RP2040 were born of our desire to do for microcontrollers what we had done for computing with the larger Raspberry Pi boards. We wanted to create an innovative yet radically low-cost platform that was easy to use, powerful, yet flexible.

    It became obvious that to stand out from the crowd of existing products in this space and to hit our cost and performance goals, we would need to build our own chip.

    [youtube https://www.youtube.com/watch?v=o-tRJPCv0GA?start=2&feature=oembed&w=500&h=281]

    I and many of the Raspberry Pi engineering team have been involved in chip design in past lives, yet it took a long time to build a functional chip team from scratch. As well as requiring specialist skills, you need a lot of expensive tools and IP; and before you can buy these things, there is a lot of work required to evaluate and decide exactly which expensive goodies you’ll need. After a slow start, for the past couple of years we’ve had a small team working on it full-time, with many others pulled in to help as needed.

    Low-cost and flexible

    The Pico board was designed alongside RP2040 – in fact we designed the RP2040 pinout to work well on Pico, so we could use an inexpensive two-layer PCB, without compromising on the layout. A lot of thought has gone into making it as low-cost and flexible as possible – from the power circuitry to packaging the units on to Tape and Reel (which is cost-effective and has good packing density, reducing shipping costs).

    “This ‘full stack’ design approach has allowed optimisation across the different parts”

    With Pico we’ve hit the ‘pocket money’ price point, yet in RP2040 we’ve managed to pack in enough CPU performance and RAM to run more heavyweight applications such as MicroPython, and AI workloads like TinyML. We’ve also added genuinely new and innovative features such as the Programmable I/O (PIO), which can be programmed to ‘bit-bang’ almost any digital interface without using valuable CPU cycles. Finally, we have released a polished C/C++ SDK, comprehensive documentation and some very cool demos!

    A reel of Raspberry Pi Pico boards

    For me, this project has been particularly special as I began my career at a small chip-design startup. This was a chance to start from a clean sheet and design silicon the way we wanted to, and to talk about how and why we’ve done it, and how it works.

    Pico is also our most vertically integrated product; meaning we control everything from the chip through to finished boards. This ‘full stack’ design approach has allowed optimisation across the different parts, creating a more cost-effective and coherent whole (it’s no wonder we’re not the only fruit company doing this).

    And of course, it is designed here in Cambridge, birthplace of so many chip companies and computing pioneers. We’re very pleased to be continuing the Silicon Fen tradition.

    A banner with the words "Be a Pi Day donor today"

    Get The MagPi 103 now

    You can grab the brand-new issue right now online from the Raspberry Pi Press store, or via our app on Android or iOS. You can also pick it up from supermarkets and newsagents, but make sure you do so safely while following all your local guidelines.

    magpi magazine cover issue 103

    Finally, there’s also a free PDF you can download. Good luck during the #MonthOfMaking, folks! I’ll see y’all online.

    Website: LINK

  • How to get started with FUZIX on Raspberry Pi Pico

    How to get started with FUZIX on Raspberry Pi Pico

    Reading Time: 9 minutes

    FUZIX is an old-school Unix clone that was initially written for the 8-bit Zilog Z80 processor and released by Alan Cox in 2014. At one time one of the most active Linux developers, Cox stepped back from kernel development in 2013. While the initial announcement has been lost in the mists because he made it on the now defunct Google+, Cox jokingly recommended the system for those longing for the good old days when all the source code still fitted on a single floppy disk.

    FUZIX running on Raspberry Pi Pico
    FUZIX running on Raspberry Pi Pico.

    Since then FUZIX has been ported to other architectures such as 6502, 68000, and the MSP430. Earlier in the week David Given — who wrote both the MSP430 and ESP8266 ports — went ahead and ported it to Raspberry Pi Pico and RP2040.

    So you can now run Unix on a $4 microcontroller.

    Building FUZIX from source

    FUZIX is a “proper” Unix with a serial console on Pico’s UART0 and SD card support, using the card both for the filesystem and for swap space. While there is a binary image available, it’s easy enough to build from source.

    If you don’t already have the Raspberry Pi Pico toolchain set up and working you should go ahead and set up the C/C++ SDK.

    Afterwards you need grab the the Pico port from GitHub.

    $ git clone https://github.com/davidgiven/FUZIX.git
    $ cd FUZIX
    $ git checkout rpipico

    Then change directory to the platform port

    $ cd Kernel/platform-rpipico/

    and edit the first line of the Makefile to set the path to your pico-sdk.

    So for instance if you’re building things on a Raspberry Pi and you’ve run the pico_setup.sh script, or followed the instructions in our Getting Started guide, you’d point the PICO_SDK_PATH to

    export PICO_SDK_PATH = /home/pi/pico/pico-sdk

    After that you can go ahead and build both the FUZIX UF2 file and the root filesystem.

    $ make world -j
    $ ./update-flash.sh

    If everything goes well you should have a UF2 file in build/fuzix.uf2 and a filesystem.img image file in your current working directory.

    You can now load the UF2 file onto your Pico in the normal way.

    Go grab your Raspberry Pi Pico board and a micro USB cable. Plug the cable into your Raspberry Pi or laptop, then press and hold the BOOTSEL button on your Pico while you plug the other end of the micro USB cable into the board. Then release the button after the board is plugged in.

    A disk volume called RPI-RP2 should pop up on your desktop. Double-click to open it, and then drag and drop the UF2 file into it.

    The volume will automatically unmount, and your Pico is now running Unix. Unfortunately it won’t be much use without a filesystem.

    Building a bootable SD card

    The filesystem.img image file we built earlier isn’t a bootable image. Unlike the Raspberry Pi OS images you might be used to, you can’t just use something like Raspberry Pi Imager to write it to an SD card. We’re going to have to get our hands a bit dirtier than that.

    The following instructions are for building your file system on a Raspberry Pi, or another similar Linux platform. Comparable tools are available on both MS Windows and Apple macOS, but the exact details will differ.

    Go grab a microSD card. As the partitions we’re going to put onto it are only going to take up 34MB it doesn’t really matter what size you’ve got to hand. I was using a 4GB card, as that was the smallest I could find, but it’s not that important.

    Now plug the card into a USB card reader and then into your Raspberry Pi or laptop computer. We’re going to have to build the partition table that FUZIX is expecting, which consists of two partitions: the first a 2MB swap partition, and the second a 32MB root partition into which we can copy the root filesystem, our filesystem.img file.

    Raspberry Pi 4 with USB card reader
    Raspberry Pi 4 with USB card reader.

    After plugging your card into the reader you can find it from the command line using the lsblk command. If you’ve have a blank unformatted card it will be visible as /dev/sda.

    $ lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 1 3.7G 0 disk 
    mmcblk0 179:0 0 14.9G 0 disk ├─mmcblk0p1 179:1 0 256M 0 part /boot
    └─mmcblk0p2 179:2 0 14.6G 0 part /
    $

    But if the card is already formatted you might instead see something like this

    $ lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 1 3.7G 0 disk └─sda1 8:1 1 3.7G 0 part /media/pi/USB
    mmcblk0 179:0 0 14.9G 0 disk ├─mmcblk0p1 179:1 0 256M 0 part /boot
    └─mmcblk0p2 179:2 0 14.6G 0 part /
    $

    which is a FAT-formatted card with a MBR named “USB”, which your Raspberry Pi has automatically mounted under /media/pi/USB.

    If your card has mounted, just go ahead and unmount it as follows:

    $ umount /dev/sda1

    Then looking using lsblk you should see

    $ lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 1 3.7G 0 disk └─sda1 8:1 1 3.7G 0 part mmcblk0 179:0 0 14.9G 0 disk ├─mmcblk0p1 179:1 0 256M 0 part /boot
    └─mmcblk0p2 179:2 0 14.6G 0 part /
    $

    at which point we can delete the current partition table by zeroing out the first part of the card and deleting the “start of disk” structures.

    $ sudo dd if=/dev/zero of=/dev/sda bs=512 count=1

    If you run lsblk again afterwards you’ll see that the sda1 partition has been deleted.

    Next we’ll use fdisk to create a new partition table. Type the following

    $ sudo fdisk /dev/sda

    to put you at the fdisk prompt. Then type “o” to create a new DOS disklabel

    Command (m for help): o
    Created a new DOS disklabel with disk identifier 0x6e8481a2.

    followed by “n” to create a new partition:

    Command (m for help): n
    Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions)
    Select (default p): p
    Partition number (1-4, default 1): 1
    First sector (2048-7744511, default 2048): 2048
    Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-7744511, default 7744511): +2M Created a new partition 1 of type 'Linux' and of size 2 MiB.

    Depending on the initial state of your disk you may be prompted that the partition “contains a vfat signature” and asked whether you want to remove the signature. If asked, just type “Y” to confirm.

    Next, we’ll set the type for this partition to “7F

    Command (m for help): t
    Selected partition 1
    Hex code (type L to list all codes): 7F
    Changed type of partition 'Linux' to 'unknown'.

    to create the 2MB swap partition that FUZIX is expecting. From here we need to create a second 32MB partition to hold our root file system:

    Command (m for help): n
    Partition type p primary (1 primary, 0 extended, 3 free) e extended (container for logical partitions)
    Select (default p): p
    Partition number (2-4, default 2): 2
    First sector (6144-7744511, default 6144): 6144
    Last sector, +/-sectors or +/-size{K,M,G,T,P} (6144-7744511, default 7744511): +32M Created a new partition 2 of type 'Linux' and of size 32 MiB.

    Afterwards if you type “p” at the fdisk prompt you should see something like this:

    Command (m for help): p
    Disk /dev/sda: 3.7 GiB, 3965190144 bytes, 7744512 sectors
    Disk model: STORAGE DEVICE Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0xe121b9a3 Device Boot Start End Sectors Size Id Type
    /dev/sda1 2048 6143 4096 2M 7f unknown
    /dev/sda2 6144 71679 65536 32M 83 Linux

    If you do, you can type “w” to write and save the partition table.

    Finally, we can copy our root file system into our second 32MB partition:

    $ sudo dd if=filesystem.img of=/dev/sda2
    65535+0 records in
    65535+0 records out
    33553920 bytes (34 MB, 32 MiB) copied, 14.1064 s, 2.4 MB/s
    $

    You can now eject the SD card from the USB card reader, because it’s time to wire up our breadboard.

    Wiring things up on the breadboard

    If you’re developing on a Raspberry Pi, and you haven’t previously used UART serial — which is different from the “normal” USB serial — you should go read Section 4.5 of our Getting Started guide.

    FUZIX wiring diagram
    Connecting a Raspberry Pi to a Pico and SD card.

    Here I’m using Adafruit’s MicroSD Card Breakout, and wiring the UART serial connection directly to to the Raspberry Pi’s serial port using the GPIO headers.

    However, if you’re developing on a laptop you can use something like the SparkFun FTDI Basic Breakout to connect the serial UART to your computer. Again, see our Getting Started guide for details: Section 9.1.4 if you’re on Apple macOS, or Section 9.2.5 if you’re on MS Windows.

    Connecting a laptop to a Pico and SD card.

    Either way, the mapping between the pins on your Raspberry Pi Pico and the SD card breakout is the same, and should be as follows:

    Pico RP2040 SD Card
    3V3 (OUT) +3.3V
    Pin 16 GP12 (SPI1 RX) DO (MISO)
    Pin 17 GP13 (SPI1 CSn) CS
    Pin 18 GND GND
    Pin 19 GP14 (SPI1 SCK) SCK
    Pin 20 GP15 (SPI1 TX) DI (MOSI)
    Mapping between physical pin number, RP2040 pin, and SD Card breakout.

    Once you’ve wired things up, pop your formatted microSD card into the breadboarded SD card breakout, and plug your Raspberry Pi Pico into USB power. FUZIX will boot automatically.

    Connecting to FUZIX

    If you’re connecting using a Raspberry Pi, the first thing you’ll need to do is enable UART serial communications using raspi-config.

    $ sudo raspi-config

    Go to Interfacing Options → Serial. Select “No” when asked “Would you like a login shell to be accessible over serial?” and “Yes” when asked “Would you like the serial port hardware to be enabled?”

    Enabling a serial UART using raspi-config on the Raspberry Pi.
    Enabling a serial UART using raspi-config on Raspberry Pi.

    Leaving raspi-config you should choose “Yes” and reboot your Raspberry Pi to enable the serial port. More information about connecting via UART can be found in Section 4.5 of our Getting Started guide.

    You can then connect to FUZIX using minicom:

    $ sudo apt install minicom
    $ minicom -b 115200 -o -D /dev/serial0

    Alternatively, if you are working on a laptop from macOS or MS Windows you can use minicom, screen, or your usual Terminal program. If you’re unsure what to use, there are a number of options: for instance, a good option is CoolTerm, which is cross-platform and works on Linux, macOS, and Windows.

    After connecting to the serial port you should see something like this:

    FUZIX in Serial
    Connected to FUZIX using Serial on Apple macOS.

    If you don’t see anything, just unplug and replug your Pico to reset it and start FUZIX running again.

    Finally, go ahead and enter the correct date and time, and when you get to the login prompt you can login as “root” with no password.

    Welcome to FUZIX!

    Wrapping up

    While there are still a few problems, the port of FUZIX to Pico has been merged to the upstream repository, which means it’s now an official part of the operating system.

    Support for developing for Pico can be found on the Raspberry Pi forums. There is also an (unofficial) Discord server where a lot of people active in the new community seem to be hanging out. Feedback on the documentation should be posted as an Issue to the pico-feedback repository on GitHub, or directly to the relevant repository it concerns.

    All of the documentation, along with lots of other help and links, can be found on the Getting Started page. If you lose track of where that is in the future, you can always find it from your Pico: to access the page, just press and hold the BOOTSEL button on your Pico, plug it into your laptop or Raspberry Pi, then release the button. Go ahead and open the RPI-RP2 volume, and then click on the INDEX.HTM file.

    That will always take you to the Getting Started page.

    Website: LINK

  • Keeping secrets and writing about Raspberry silicon

    Keeping secrets and writing about Raspberry silicon

    Reading Time: 3 minutes

    In the latest issue of The MagPi Magazine, Alasdair Allan shares the secrets he had to keep while working behind the scenes to get Raspberry Pi’s RP2040 chip out into the world.

    Alasdair Allen holding a Pico board
    BEST friends

    There is a new thing in the world, and I had a ringside seat for its creation. 

    For me, it started just over a year ago with a phone call from Eben Upton. One week later I was sitting in a meeting room at Raspberry Pi Towers in Cambridge, my head tilted to one side while Eben scribbled on a whiteboard and waved his hands around. 

    Eben had just told me that Raspberry Pi was designing its own silicon, and he was talking about the chip that would eventually be known as RP2040. Eben started out by drawing the bus fabric, which isn’t where you normally start when you talk about a new chip, but it turned out RP2040 was a rather unusual chip.

    “I gradually drifted sideways into playing with the toys.”

    I get bored easily. I started my career doing research into the high-energy physics of collision shocks in the accretion discs surrounding white dwarf stars, but I gradually drifted sideways into playing with the toys.

    After spending some time working with agent-based systems to solve scheduling problems for robotic telescopes, I became interested in machine learning and what later became known as ‘big data’.

    [youtube https://www.youtube.com/watch?v=o-tRJPCv0GA?start=1&feature=oembed&w=500&h=281]

    Meet Raspberry Pi Pico

    From there, I spent time investigating the ‘data exhaust’ and data living outside the cloud in embedded and distributed devices, and as a consequence did a lot of work on mobile systems. Which led me to do some of the thinking, and work, on what’s now known as the Internet of Things. Which meant I had recently spent a lot of time writing and talking about embedded hardware. 

    Eben was looking for someone to make sure the documentation around Raspberry Pi Pico, and RP2040 silicon itself, was going to measure up. I took the job.

    Rumour mill

    I had spent the previous six months benchmarking Machine Learning (ML) inferencing on embedded hardware, and a lot of time writing and talking about the trendy new world of Tiny ML.

    [youtube https://www.youtube.com/watch?v=ZY-HrRGCQ4w?start=31&feature=oembed&w=500&h=281]

    What is a microcontroller?

    The rumours of what I was going to be doing for Raspberry Pi started flying on social media almost immediately. The somewhat pervasive idea that I was there to help support putting a Coral Edge TPU onto Raspberry Pi 5 was a particularly good wheeze. 

    Instead, I was going to spend the next year metaphorically locked in a room building a documentation toolchain around – and of course writing about – a totally secret product.

    Screenshot of our Getting Started with Raspberry Pi Pico landing page
    Alasdair’s work turned into this

    I couldn’t talk about it in public, and I talk about things in public a lot. Only the fact that almost everyone else spent the next year locked indoors as well kept too many questions from being asked. I didn’t have to tell conference organisers that I couldn’t talk about what I was doing, because there weren’t any conferences to organise.

    I’m rather pleased with what I’ve done with my first year at Raspberry Pi, and of course with how my work on RP2040 and Raspberry Pi Pico turned out.

    Much like a Raspberry Pi is an accessible computer that gives you everything you need to learn to write a program, RP2040 is an accessible chip with everything you need to learn to build a product. It’s going to bring a big change to the microcontroller market, and I’m really rather pleased I got a ringside seat to its creation.

    Website: LINK

  • The journey to Raspberry Silicon

    The journey to Raspberry Silicon

    Reading Time: 6 minutes

    When I first joined Raspberry Pi as a software engineer four and a half years ago, I didn’t know anything about chip design. I thought it was magic. This blog post looks at the journey to Raspberry Silicon and the design process of RP2040.

    RP2040 on a Raspberry Pi Pico
    RP2040 – the heart of Raspberry Pi Pico

    RP2040 has been in development since summer 2017. Chips are extremely complicated to design. In particular, the first chip you design requires you to design several fundamental components, which you can then reuse on future chips. The engineering effort was also diverted at some points in the project (for example to focus on the Raspberry Pi 4 launch).

    Once the chip architecture is specified, the next stage of the project is the design and implementation, where hardware is described using a hardware description language such as Verilog. Verilog has been around since 1984 and, along with VHDL, has been used to design most chips in existence today. So what does Verilog look like, and how does it compare to writing software?

    Suppose we have a C program that implements two wrapping counters:

    void count_forever(void) { uint8_t i = 0; uint8_t j = 0; while (1) { i += 1; j += 1; }
    }

    This C program will execute sequentially line by line, and the processor won’t be able to do anything else (unless it is interrupted) while running this code. Let’s compare this with a Verilog implementation of the same counter:

    module counter ( input wire clk, input wire rst_n, output reg [7:0] i, output reg [7:0] j
    ); always @ (posedge clk or negedge rst_n) begin if (~rst_n) begin // Counter is in reset so hold counter at 0 i <= 8’d0; j <= 8’d0; end else begin i <= i + 8’d1; j <= j + 8’d1; end
    end endmodule

    Verilog statements are executed in parallel on every clock cycle, so both i and j are updated at exactly the same time, whereas the C program increments i first, followed by j. Expanding on this idea, you can think of a chip as thousands of small Verilog modules like this, all executing in parallel.

    A chip designer has several tools available to them to test the design. Testing/verification is the most important part of a chip design project: if a feature hasn’t been tested, then it probably doesn’t work. Two methods of testing used on RP2040 are simulators and FPGAs. 

    A simulator lets you simulate the entire chip design, and also some additional components. In RP2040’s case, we simulated RP2040 and an external flash chip, allowing us to run code from SPI flash in the simulator. That is the beauty of hardware design: you can design some hardware, then write some C code to test it, and then watch it all run cycle by cycle in the simulator.

    “ell” from the phrase “Hello World” from core0 of RP2040 in a simulator

    The downside to simulators is that they are very slow. It can take several hours to simulate just one second of a chip. Simulation time can be reduced by testing blocks of hardware in isolation from the rest of the chip, but even then it is still slow. This is where FPGAs come in…

    FPGAs (Field Programmable Gate Arrays) are chips that have reconfigurable logic, and can emulate the digital parts of a chip, allowing most of the logic in the chip to be tested. 

    FPGAs can’t emulate the analogue parts of a design, such as the resistors that are built into RP2040’s USB PHY. However, this can be approximated by using external hardware to provide analogue functionality. FPGAs often can’t run a design at full speed. In RP2040’s case, the FPGA was able to run at 48MHz (compared to 133MHz for the fully fledged chip). This is still fast enough to test everything we wanted and also develop software on.

    FPGAs also have debug logic built into them. This allows the hardware designer to probe signals in the FPGA, and view them in a waveform viewer similar to the simulator above, although visibility is limited compared to the simulator.

    Graham’s tidy FPGA
    Graham’s less tidy FPGA
    Oh dear

    The RP2040 bootrom was developed on FPGA, allowing us to test the USB boot mode, as well executing code from SPI flash. In the image above, the SD card slot on the FPGA is wired up to SPI flash using an SD card-shaped flash board designed by Luke Wren.

    USB testing on FPGA

    In parallel to Verilog development, the implementation team is busy making sure that the Verilog we write can actually be made into a real chip. Synthesis takes a Verilog description of the chip and converts the logic described into logic cells defined by your library choice. RP2040 is manufactured by TSMC, and we used their standard cell library.

    RP2040 silicon in a DIL package!

    Chip manufacturing isn’t perfect. So design for test (DFT) logic is inserted, allowing the logic in RP2040 to be tested during production to make sure there are no manufacturing defects (short or open circuit connections, for example). Chips that fail this production test are thrown away (this is a tiny percentage – the yield for RP2040 is particularly high due to the small die size).

    After synthesis, the resulting netlist goes through a layout phase where the standard cells are physically placed and interconnect wires are routed. This is a synchronous design so clock trees are inserted, and timing is checked and fixed to make sure the design meets the clock speeds that we want. Once several design rules are checked, the layout can be exported to GDSII format, suitable for export to TSMC for manufacture.

    RP2040 chips ready for a bring up board

    (In reality, the process of synthesis, layout, and DFT insertion is extremely complicated and takes several months to get right, so the description here is just a highly abbreviated overview of the entire process.)

    Once silicon wafers are manufactured at TSMC they need to be put into a package. After that, the first chips are sent to Pi Towers for bring-up!

    The RP2040 bring-up board

    A bring-up board typically has a socket (in the centre) so you can test several chips in a single board. It also separates each power supply on the chip, so you can limit the current on first power-up to check there are no shorts. You don’t want the magic smoke to escape!

    The USB boot mode working straight out of the box on a bring-up board!

    Once the initial bring-up was done, RP2040 was put through its paces in the lab. Characterising behaviour, seeing how it performs at temperature and voltage extremes.

    Once the initial batch of RP2040s are signed off we give the signal for mass production, ready for them to be put onto Pico boards that you have in your hands today.

    82K RP2040s ready for shipment to Sony

    A chip is useless without detailed documentation. While RP2040 was making its way to mass production, we spent several months writing the SDK and excellent documentation you have available to you today.

    Website: LINK

  • How to add a reset button to your Raspberry Pi Pico

    How to add a reset button to your Raspberry Pi Pico

    Reading Time: 4 minutes

    We’ve tried to make it as easy as possible for you to load your code onto your new Raspberry Pi Pico: press and hold the BOOTSEL button, plug your Pico into your computer, and it’ll mount as a mass storage volume. Then just drag and drop a UF2 file onto the board.

    However, not everybody is keen to keep unplugging their micro USB cable every time they want to upload a UF2 onto the board. Don’t worry — there’s more than one way around that problem.

    Raspberry Pi Pico with a reset button wired to the GND and RUN pins

    Firstly, if you’re developing in MicroPython there isn’t any real need to unplug and replug Pico to write code. The only time you’ll need to do it is the initial upload of the MicroPython firmware, which comes as a UF2. From there on in, you’re talking to the board via the REPL and a serial connection, either in Thonny or some other editor.

    However, if you’re developing using our C SDK, then to upload new code to your Pico you have to upload a new UF2. This means you’ll need to unplug and replug the board to put Pico into BOOTSEL mode each time you make a change in your code and want to test it.

    No more unplugging with SWD?

    The best way around this is to use SWD mode (see Chapter 5 of our C/C++ Getting Started book) to upload code using the debug port, instead of using mass storage (BOOTSEL) mode.

    A Raspberry Pi 4 and Raspberry Pi Pico with UART and SWD ports connected together

    This gets you debugger support, which is invaluable while developing, and involves adding just three more wires. Afterwards, you’ll never have to unplug your Pico again.

    Keep on dragging and dropping

    But if you want to stick with uploading by drag-and-drop, adding a reset button to your Raspberry Pi Pico is pretty easy.

    Raspberry Pi Pico with a reset button wired to the GND and RUN pins

    All you need to do is to wire the GND and RUN pins together and add an extra momentary contact button to your breadboard. Pushing the button will reset the board.

    Then, instead of unplugging and replugging the USB cable when you want to load code onto Pico, you push and hold the RESET button, push the BOOTSEL button, release the RESET button, then release the BOOTSEL button.

    Entering BOOTSEL mode without unplugging your Pico

    If your board is in BOOTSEL mode and you want to start code you’ve already loaded running again, all you have to do now is briefly push the RESET button.

    Leaving BOOTSEL mode without unplugging your Pico.

    We’ve see some people use the 3V3_EN pin instead of the RUN pin. While it’ll work in a pinch, the problem with disabling 3.3V is that GPIOs that are driven from powered external devices will leak like crazy while 3.3V is disabled. There is even the possibility of damage to the chip. So it’s much better to use the RUN pin to make a reset button than the 3V3_EN pin.

    What about the other button?

    As an aside, if you want to break out the BOOTSEL button as well — perhaps you’re intending to bury your Pico inside an enclosure — you can use TP6 (that is, Test Point 6) on the rear of the board to do so. See Chapter 2 of the Pico Datasheet for details.

    Where to find more help and information

    Support for developing for Pico can be found on the Raspberry Pi forums. There is also an (unofficial) Discord server where a lot of people active in the new community seem to be hanging out. Feedback on the documentation should be posted as an issue to the pico-feedback repository on GitHub, or directly to the relevant repository it concerns.

    All of the documentation, along with lots of other help and links, can be found on the same Getting Started page. If you lose track of where that is in the future, you can always find it from your Pico: to access the page, just press and hold the BOOTSEL button on your Pico, plug it into your laptop or Raspberry Pi, then release the button. Go ahead and open the RPI-RP2 volume, and then click on the INDEX.HTM file.

    That will always take you to the Getting Started page.

    Website: LINK

  • How to blink an LED with Raspberry Pi Pico in C

    How to blink an LED with Raspberry Pi Pico in C

    Reading Time: 8 minutes

    The new Raspberry Pi Pico is very different from a traditional Raspberry Pi. Pico is a microcontroller, rather than a microcomputer. Unlike a Raspberry Pi it’s a platform you develop for, not a platform you develop on.

    Blinking the on-board LED
    Blinking the onboard LED

    But you still have choices if you want to develop for Pico, because there is both a C/C++ SDK and an official MicroPython port. Beyond that there are other options opening up, with a port of CircuitPython from Adafruit and the prospect of Arduino support, or even a Rust port.

    Here I’m going to talk about how to get started with the C/C++ SDK, which lets you develop for Raspberry Pi Pico from your laptop or Raspberry Pi.

    I’m going to assume you’re using a Raspberry Pi; after all, why wouldn’t you want to do that? But if you want to develop for Pico from your Windows or Mac laptop, you’ll find full instructions on how to do that in our Getting Started guide.

    Blinking your first LED

    When you’re writing software for hardware, the first program that gets run in a new programming environment is typically turning an LED on, off, and then on again. Learning how to blink an LED gets you halfway to anywhere. We’re going to go ahead and blink the onboard LED on Pico, which is connected to pin 25 of the RP2040 chip.

    We’ve tried to make getting started with Raspberry Pi Pico as easy as possible. In fact, we’ve provided some pre-built binaries that you can just drag and drop onto your Raspberry Pi Pico to make sure everything is working even before you start writing your own code.

    Go to the Getting Started page and click on the “Getting started with C/C++” tab, then the “Download UF2 file” button in the “Blink an LED” box.

    A file called blink.uf2 will be downloaded to your computer. Go grab your Raspberry Pi Pico board and a micro USB cable. Plug the cable into your Raspberry Pi or laptop, then press and hold the BOOTSEL button on your Pico while you plug the other end of the micro USB cable into the board. Then release the button after the board is plugged in.

    A disk volume called RPI-RP2 should pop up on your desktop. Double-click to open it, and then drag and drop the UF2 file into it. The volume will automatically unmount and the light on your board should start blinking.

    Blinking an LED

    Congratulations! You’ve just put code onto your Raspberry Pi Pico for the first time. Now we’ve made sure that we can successfully get a program onto the board, let’s take a step back and look at how we’d write that program in the first place.

    Getting the SDK

    Somewhat unsurprisingly, we’ve gone to a lot of trouble to make installing the tools you’ll need to develop for Pico as easy as possible on a Raspberry Pi. We’re hoping to make things easier still in the future, but you should be able to install everything you need by running a setup script.

    However, before we do anything, the first thing you’ll need to do is make sure your operating system is up to date.

    $ sudo apt update
    $ sudo apt full-upgrade

    Once that’s complete you can grab the setup script directly from Github, and run it at the command line.

    $ wget -O pico_setup.sh https://rptl.io/pico-setup-script
    $ chmod +x pico_setup.sh
    $ ./pico_setup.sh

    The script will do a lot of things behind the scenes to configure your Raspberry Pi for development, including installing the C/C++ command line toolchain and Visual Studio Code. Once it has run, you will need to reboot your Raspberry Pi.

    $ sudo reboot

    The script has been tested and is known to work from a clean, up-to-date installation of Raspberry Pi OS. However, full instructions, along with instructions for manual installation of the toolchain if you prefer to do that, can be found in the “Getting Started” guide.

    Once your Raspberry Pi has rebooted we can get started writing code.

    Writing code for your Pico

    There is a large amount of example code for Pico, and one of the things that the setup script will have done is to download the examples and build both the Blink and “Hello World” examples to verify that your toolchain is working.

    But we’re going to go ahead and write our own.

    We’re going to be working in the ~/pico directory created by the setup script, and the first thing we need to do is to create a directory to house our project.

    $ cd pico
    $ ls -la
    total 59284
    drwxr-xr-x 9 pi pi 4096 Jan 28 10:26 .
    drwxr-xr-x 19 pi pi 4096 Jan 28 10:29 ..
    drwxr-xr-x 12 pi pi 4096 Jan 28 10:24 openocd
    drwxr-xr-x 28 pi pi 4096 Jan 28 10:20 pico-examples
    drwxr-xr-x 7 pi pi 4096 Jan 28 10:20 pico-extras
    drwxr-xr-x 10 pi pi 4096 Jan 28 10:20 pico-playground
    drwxr-xr-x 5 pi pi 4096 Jan 28 10:21 picoprobe
    drwxr-xr-x 10 pi pi 4096 Jan 28 10:19 pico-sdk
    drwxr-xr-x 7 pi pi 4096 Jan 28 10:22 picotool
    -rw-r--r-- 1 pi pi 60667760 Dec 16 16:36 vscode.deb
    $ mkdir blink
    $ cd blink

    Now open up your favourite editor and create a file called blink.c in the blink directory.

    #include "pico/stdlib.h"
    #include "pico/binary_info.h" const uint LED_PIN = 25; int main() { bi_decl(bi_program_description("First Blink")); bi_decl(bi_1pin_with_name(LED_PIN, "On-board LED")); gpio_init(LED_PIN); gpio_set_dir(LED_PIN, GPIO_OUT); while (1) { gpio_put(LED_PIN, 0); sleep_ms(250); gpio_put(LED_PIN, 1); sleep_ms(1000); }
    }

    Create a CMakeLists.txt file too.

    cmake_minimum_required(VERSION 3.12) include(pico_sdk_import.cmake) project(blink) pico_sdk_init() add_executable(blink blink.c
    ) pico_add_extra_outputs(blink) target_link_libraries(blink pico_stdlib)

    Then copy the pico_sdk_import.cmake file from the external folder in your pico-sdk installation to your test project folder.

    $ cp ../pico-sdk/external/pico_sdk_import.cmake .

    You should now have something that looks like this:

    $ ls -la
    total 20
    drwxr-xr-x 2 pi pi 4096 Jan 28 11:32 .
    drwxr-xr-x 10 pi pi 4096 Jan 28 11:01 ..
    -rw-r--r-- 1 pi pi 398 Jan 28 11:06 blink.c
    -rw-r--r-- 1 pi pi 211 Jan 28 11:32 CMakeLists.txt
    -rw-r--r-- 1 pi pi 2721 Jan 28 11:32 pico_sdk_import.cmake
    $

    We are ready to build our project using CMake.

    $ mkdir build
    $ cd build
    $ export PICO_SDK_PATH=../../pico-sdk
    $ cmake ..
    $ make

    If all goes well you should see a whole bunch of messages flash past in your Terminal window and a number of files will be generated in the build/ directory, including one called blink.uf2.

    Just as we did before with the UF2 file we downloaded from the Getting Started page, we can now drag and drop this file on to our Pico.

    Unplug the cable from your Pico, then press and hold the BOOTSEL button on your Pico and plug it back in. Then release the button after the board is plugged in.

    The new Blink binary
    The new blink.uf2 binary can be dragged and dropped on to our Pico

    The RPI-RP2 disk volume should pop up on your desktop again. Double-click to open it, then open a file viewer in the pico/blink/build/ directory and drag and drop the UF2 file you’ll find there on to the RPI-RP2 volume. It will automatically unmount, and the light on your board should start blinking. But this time it will blink a little bit differently from before.

    Try playing around with the sleep_ms( ) lines in our code to vary how much time there is between blinks. You could even take a peek at one of the examples, which shows you how to blink the onboard LED in Morse code.

    Using Picotool

    One way to convince yourself that the program running on your Pico is the one we just built is to use something called picotool. Picotool is a command line utility installed by the setup script that is a Swiss Army knife for all things Pico.

    Go ahead and unplug your Pico from your Raspberry Pi, press and hold the BOOTSEL button, and plug it back in. Then run picotool.

    $ sudo picotool info -a Program Information name: blink description: First Blink binary start: 0x10000000 binary end: 0x10003344 Fixed Pin Information 25: On-board LED Build Information sdk version: 1.0.0 pico_board: pico build date: Jan 28 2021 build attributes: Release Device Information flash size: 2048K ROM version: 1
    $

    You’ll see lots of information about the program currently on your Pico. Then if you want to start it blinking again, just unplug and replug Pico to leave BOOTSEL mode and start your program running once more.

    Picotool can do a lot more than this, and you’ll find more information about it in Appendix B of the “Getting Started” guide.

    Using Visual Studio Code

    So far we’ve been building our Pico projects from the command line, but the setup script also installed and configured Visual Studio Code, and we can build the exact same CMake-based project in the Visual Studio Code environment. You can open it as below:

    $ cd ~/pico
    $ export PICO_SDK_PATH=/home/pi/pico/pico-sdk
    $ code

    Chapter 6 of the Getting Started guide has full details of how to load and compile a Pico project inside Visual Studio Code. If you’re used to Visual Studio Code, you might be able to make your way from here without much extra help, as the setup script has done most of the heavy lifting for you in configuring the IDE.

    What’s left is to open the pico/blink folder and allow the CMake Tools extension to configure the project. After selecting arm-none-eabi as your compiler, just hit the “Build’ button in the blue bottom bar.

    Building our blink project inside Visual Studio Code

    While we recommend and support Visual Studio Code as the development environment of choice for developing for Pico — it works cross-platform under Linux, Windows, and macOS and has good plugin support for debugging — you can also take a look at Chapter 9 of the Getting Started guide. There we talk about how to use both Eclipse and CLion to develop for Pico, and if you’re more used to those environments you should be able to get up and running in either without much trouble.

    Where now?

    If you’ve got this far, you’ve built and deployed your very first C program to your Raspberry Pi Pico. Well done! The next step is probably going to be saying “Hello World!” over serial back to your Raspberry Pi.

    From here, you probably want to sit down and read the Getting Started guide I’ve mentioned throughout the article, especially if you want to make use of SWD debugging, which is discussed at length in the guide. Beyond that I’d point you to the book on the C/C++ SDK which has the API-level documentation, as well as a high-level discussion of the design of the SDK.

    Support for developing for Pico can be found on the Raspberry Pi forums. There is also an (unofficial) Discord server where a lot of people active in the new community seem to be hanging out. Feedback on the documentation should be posted as an Issue to the pico-feedback repository on Github, or directly to the relevant repository it concerns.

    All of the documentation, along with lots of other help and links, can be found on the same Getting Started page from which we grabbed our original UF2 file.

    If you lose track of where that is in the future, you can always find it from your Pico: to access the page, just press and hold the BOOTSEL button on your Pico, plug it into your laptop or Raspberry Pi, then release the button. Go ahead and open the RPI-RP2 volume, and then click on the INDEX.HTM file.

    That will always take you to the Getting Started page.

    Website: LINK

  • Raspberry Pi engineers on the making of Raspberry Pi Pico | The MagPi 102

    Raspberry Pi engineers on the making of Raspberry Pi Pico | The MagPi 102

    Reading Time: 4 minutes

    In the latest issue of The MagPi Magazine, on sale now, Gareth Halfacree asks what goes into making Raspberry Pi’s first in-house microcontroller and development board.

    [youtube https://www.youtube.com/watch?v=o-tRJPCv0GA?feature=oembed&w=500&h=281]

    “It’s a flexible product and platform,” says Nick Francis, Senior Engineering Manager at Raspberry Pi, when discussing the work the Application-Specific Integrated Circuit (ASIC) team put into designing RP2040, the microcontroller at the heart of Raspberry Pi Pico

    It would have been easy to have said, well, let’s do a purely educational microcontroller “quite low-level, quite limited performance,” he tells us. “But we’ve done the high-performance thing without forgetting about making it easy to use for beginners. To do that at this price point is really good.”

    “I think we’ve done a pretty good job,” agrees James Adams, Chief Operating Officer at Raspberry Pi. “We’ve obviously tossed around a lot of different ideas about what we could include along the way, and we’ve iterated quite a lot and got down to a good set of features.”

    A board and chip

    “The idea is it’s [Pico] a component in itself,” says James. “The intent was to expose as many of the I/O (input/output) pins for users as possible, and expose them in the DIP-like (Dual Inline Package) form factor, so you can use Raspberry Pi Pico as you might use an old 40-pin DIP chip. Now, Pico is 2.54 millimetres or 0.1 inch pitch wider than a ‘standard’ 40-pin DIP, so not exactly the same, but still very similar.

    “After the first prototype, I changed the pins to be castellated so you can solder it down as a module, without needing to put any headers in. Which is, yes, another nod to using it as a component.”

    Getting the price right

    “One of the things that we’re very excited about is the price,” says James. “We’re able to make these available cheap as chips – for less than the price of a cup of coffee.”

    “It’s extremely low-cost,” Nick agrees. “One of the driving requirements right at the start was to build a very low-cost chip, but which also had good performance. Typically, you’d expect a microcontroller with this specification to be more expensive, or one at this price to have a lower specification. We tried to push the performance and keep the cost down.”

    “We’re able to make these available cheap as chips.”

    James Adams

    Raspberry Pi Pico also fits nicely into the Raspberry Pi ecosystem: “Most people are doing a lot of the software development for this, the SDK (software development kit) and all the rest of it, on Raspberry Pi 4 or Raspberry Pi 400,” James explains. “That’s our primary platform of choice. Of course, we’ll make it work on everything else as well. I would hope that it will be as easy to use as any other microcontroller platform out there.”

    Eben Upton on RP2040

    “RP2040 is an exciting development for Raspberry Pi because it’s Raspberry Pi people making silicon,” says Eben Upton, CEO and co-founder of Raspberry Pi. “I don’t think other people bring their A-game to making microcontrollers; this team really brought its A-game. I think it’s just beautiful.

    Is Pico really that small, or is Eben a giant?

    “What does Raspberry Pi do? Well, we make products which are high performance, which are cost-effective, and which are implemented with insanely high levels of engineering attention to detail – and this is that. This is that ethos, in the microcontroller space. And that couldn’t have been done with anyone else’s silicon.”

    Issue #102 of The MagPi Magazine is out NOW

    MagPi 102 cover

    Never want to miss an issue? Subscribe to The MagPi and we’ll deliver every issue straight to your door. Also, if you’re a new subscriber and get the 12-month subscription, you’ll get a completely free Raspberry Pi Zero bundle with a Raspberry Pi Zero W and accessories.

    Website: LINK

  • Raspberry fish & RP2040 chip

    Raspberry fish & RP2040 chip

    Reading Time: 2 minutes

    Look at our lovely friends over at This is not Rocket Science (TiNRS) – they’ve wasted no time at all in jumping in with our new chips. In this guest post, Stijn of TiNRS shares their fishily musical application of our new toy.

    The new RP2040 chip by Raspberry Pi is amazing. When we got our hands on this beautiful little thing, we did what we always do with new chips and slapped on a Goldfish, our favourite acid bassline synthesiser (we make fish and chips, hahahaha).

    TiNRS took to Instagram to explain more about the 18 year old fish synthesiser project

    While benchmarking the performance by copy/pasting instances of our entire Goldfish in search of the chip’s limits, we suddenly found ourselves with a polyphonic synth. We have since rewritten these multiple instances into a 16-voice Poly-Goldfish with 4 oscillators per voice. To celebrate we designed a PCB and brightly coloured frontpanel to give this new Goldfish some dedicated controls.

    Bring-up was trivial due to the amazing documentation and the extremely flexible PIO-blocks. RP2040 is a dream to work with. Childlike giddiness ensued while lying on the carpet and programming in VSCode on a Raspberry Pi 400 talking directly to the RP2040. This is the way to release a chip into the world: with fantastic documentation, an open toolchain and plenty of examples of how to use everything.

    PCB and brightly coloured front panel

    Once these chips hit general availability we will probably share some designs on our Github. This chip is now part of our go-to set of tools to make cool stuff and will very bloody likely be inside our next three modules.

    It fits perfectly in our Open Source attitude. Because of the easy, high quality, multi-platform, free and even beginner-friendly toolchain they have built around this chip, we can expand the accessibility to the insides of our designs. With these chips it is way easier for us to have you do things like adding your own algorithms, building extra modes or creating personal effects. We can lean on the quality of the Raspberry Pi platform and this amazing chip.

    TiNRS approves.

    Keep an eye on the TiNR blog for more adventures in technology. You can also find them on Twitter @rocket_not and on Instagram.

    Website: LINK

  • New book: Get Started with MicroPython on Raspberry Pi Pico

    New book: Get Started with MicroPython on Raspberry Pi Pico

    Reading Time: 3 minutes

    So, you’ve got a brand new Raspberry Pi Pico and want to know how to get started with this tiny but powerful microcontroller? We’ve got just the book for you.

    Get Started with Raspberry Pi Pico book

    Beginner-friendly

    In Get Started with MicroPython on Raspberry Pi Pico, you’ll learn how to use the beginner-friendly language MicroPython to write programs and connect hardware to make your Raspberry Pi Pico interact with the world around it. Using these skills, you can create your own electro-mechanical projects, whether for fun or to make your life easier.

    Inside the pages of the Raspberry Pi Pico book

    After taking you on a guided tour of Pico, the books shows you how to get it up and running with a step-by-step illustrated guide to soldering pin headers to the board and installing the MicroPython firmware via a computer.

    Programming basics

    Inside the pages of the Raspberry Pi Pico book 02

    Next, we take you through the basics of programming in MicroPython, a Python-based programming language developed specifically for microcontrollers such as Pico. From there, we explore the wonderful world of physical computing and connect a variety of electronic components to Pico using a breadboard. Controlling LEDs and reading input from push buttons, you’ll start by creating a pedestrian crossing simulation, before moving on to projects such as a reaction game, burglar alarm, temperature gauge, and data logger.

    Inside the pages of the Raspberry Pi Pico book

    Raspberry Pi Pico also supports the I2C and SPI protocols for communicating with devices, which we explore by connecting it up to an LCD display. You can even use MicroPython to take advantage of one of Pico’s most powerful features, Programmable I/O (PIO), which we explore by controlling NeoPixel LED strips.

    Get your copy today!

    You can buy Get Started with MicroPython on Raspberry Pi Pico now from the Raspberry Pi Press online store. If you don’t need the lovely new book, with its new-book smell, in your hands in real life, you can download a PDF version for free (or a small voluntary contribution).

    STOP PRESS: we’ve spotted an error in the first print run of the book, affecting the code examples in Chapters 4 to 7. We’re sorry! Fortunately it’s easy for readers to correct in their own code; see here for everything you need to know. We’ve already corrected this in the PDF version.

    Website: LINK

  • Raspberry Pi Pico – what did you think?

    Raspberry Pi Pico – what did you think?

    Reading Time: 3 minutes

    The best part of launching a new product is seeing the reaction of the Raspberry Pi community. When we released Raspberry Pi Pico into the world last Thursday, it didn’t take long for our curious, creative crew of hackers and tinkerers to share some brilliant videos, blogs and photos.

    If you’ve spotted other cool stuff people have done with Raspberry Pi Pico, do comment with a link at the end of this post so we can check it out.

    Graham Sanderson’s BBC Micro emulation

    [youtube https://www.youtube.com/watch?v=WaPJmCgseQw?feature=oembed&w=500&h=281]

    YouTube went wild for this Raspberry Pi Pico-powered BBC Micro and BBC Master emulation. Graham Sanderson‘s little bit of fun with our latest creation emulates the fine detail of the hardware required to get the best games and graphics demos to run.

    He’s put together an entire playlist showing off the power of Raspberry Pi Pico, and it’s a retro gamer’s dream.

    Alex Glow

    [youtube https://www.youtube.com/watch?v=qHT9UR8MTrE?feature=oembed&w=500&h=281]

    Alex Glow went live for almost an hour unboxing our teeny tiny microcontroller, deep-diving into our getting started materials as well.

    She has a good look around our launch blog post on camera too, unpacking some of the technical aspects of how Raspberry Pi Pico is powered, and also explaining why it’s so exciting that we’ve built this ourselves.

    Jeff Geerling

    [youtube https://www.youtube.com/watch?v=dUCgYXF01Do?feature=oembed&w=500&h=281]

    Jeff Geerling has used his Pico for good, creating a baby-safe temperature monitor for his little one’s bedroom. In his video, he shows you around some of Raspberry Pi Pico’s “party tricks”, and includes the all-important build montage sequence.

    If you prefer words to videos, Jeff has also put together a big ole blog post about our new microcontroller board.

    Brian Corteil

    Brian Corteil took to Twitter to share his eleven-year-old’s pro soldering skills, proving that Raspberry Pi is for everyone, no matter how young, old, or inexperienced, or expert.

    Extreme close-up!

    Look at the finish on those pins!

    16MB Pico modification

    Daniel Green did what you were all thinking – desoldered the onboard 2MB QSPI flash chip and replaced it with a 16MB version. Say hello to the first Pico in the world with this special modification. 

    Eben himself!

    [youtube https://www.youtube.com/watch?v=Hd6ekoQRkaY?feature=oembed&w=500&h=281]

    On top of all the brilliant comments, projects, and guidance our community has already shared, Raspberry Pi CEO Eben Upton will be joining the Digital Making at Home crew on Wednesday to show young coders around Raspberry Pi Pico.

    Set a reminder for yourself (or your kids) to watch live on YouTube, or join in on Facebook, Twitter or Twitch at 7pm UK time.

    Website: LINK

  • NeoPixel dithering with Pico

    NeoPixel dithering with Pico

    Reading Time: 10 minutes

    In the extra special Raspberry Pi Pico launch issue of HackSpace magazine, editor Ben Everard shows you how to get extra levels of brightness out of your LEDs with our new board.

    WS2812B LEDs, commonly known as NeoPixels, are cheap and widely available LEDs. They have red, green, and blue LEDs in a single package with a microcontroller that lets you control a whole string of them using just one pin on your microcontroller.

    The three connections may be in a different order on your LED strip, so check the labels to make sure they’re connected correctly
    The three connections may be in a different order on your LED strip, so check the labels to make sure they’re connected correctly

    However, they do have a couple of disadvantages:

    1) The protocol needed to control them is timing-dependent and often has to be bit-banged.

    2) Each colour has 8 bits, so has 255 levels of brightness. However, these aren’t gamma-corrected, so the low levels of brightness have large steps between them. For small projects, we often find ourselves only using the lower levels of brightness, so often only have 10 or 20 usable levels of brightness.

    There will usually be wires already connected to your strip, but if you cut it, you’ll need to solder new wires on
    There will usually be wires already connected to your strip, but if you cut it, you’ll need to solder new wires on

    We’re going to look at how two features of Pico help solve these problems. Firstly, Programmable I/O (PIO) lets us implement the control protocol on a state machine rather than the main processing cores. This means that we don’t have to dedicate any processor time to sending the data out. Secondly, having two cores means we can use one of the processing cores to dither the NeoPixels. This means shift them rapidly between different brightness levels to make pseudo-levels of brightness.

    For example, if we wanted a brightness level halfway between levels 3 and 4, we’d flick the brightness back and forth between 3 and 4. If we can do this fast enough, our eyes blur this into a single brightness level and we don’t see the flicker. By varying the amount of time at levels 3 and 4, we can make many virtual levels of brightness. While one core is doing this, we still have a processing core completely free to manipulate the data we want to display.

    First, we’ll need a PIO program to communicate with the WS2812B LEDs. The Pico development team have provided an example PIO program to work with – you can see the full details here, but we’ll cover the essentials here. The PIO code is:

    .program ws2812
    .side_set 1
    .define public T1 2
    .define public T2 5
    .define public T3 3
    bitloop: out x, 1 side 0 [T3 - 1] jmp !x do_zero side 1 [T1 - 1] do_one: jmp bitloop side 1 [T2 - 1] do_zero: nop side 0 [T2 - 1]

    We looked at the PIO syntax in the main cover feature, but it’s basically an assembly language for the PIO state machine. The WS2812B protocol uses pulses at a rate of 800kHz, but the length of the pulse determines if a 1 or a 0 is being sent. This code uses jumps to move through the loop to set the timings depending on whether the bit (stored in the register x) is 0 or 1. The T1, T2, and T3 variables hold the timings, so are used to calculate the delays (with 1 taken off as the instruction itself takes one clock cycle). There’s also a section in the pio file that links the PIO code and the C code:

    % c-sdk {
    #include "hardware/clocks.h"
    static inline void ws2812_program_init(PIO pio,
    uint sm, uint offset, uint pin, float freq, bool
    rgbw) { pio_gpio_select(pio, pin); pio_sm_set_consecutive_pindirs(pio, sm, pin, 1,
    true); pio_sm_config c = ws2812_program_get_default_
    config(offset); sm_config_set_sideset_pins(&c, pin); sm_config_set_out_shift(&c, false, true, rgbw ?
    32 : 24); sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX); int cycles_per_bit = ws2812_T1 + ws2812_T2 +
    ws2812_T3; float div = clock_get_hz(clk_sys) / (freq *
    cycles_per_bit); sm_config_set_clkdiv(&c, div); pio_sm_init(pio, sm, offset, &c); pio_sm_set_enable(pio, sm, true);
    }
    %}

    Most of this is setting the various PIO options – the full range is detailed in the Raspberry Pi Pico C/C++ SDK document.

     sm_config_set_out_shift(&c, false, true, rgbw ? 32
    : 24);

    This line sets up the output shift register which holds each 32 bits of data before it’s moved bit by bit into the PIO state machine. The parameters are the config (that we’re setting up and will use to initialise the state machine); a Boolean value for shifting right or left (false being left); and a Boolean value for autopull which we have set to true. This means that whenever the output shift register falls below a certain threshold (set in the next parameter), the PIO will automatically pull in the next 32 bits of data.

    Using a text editor with programmer’s features such as syntax highlighting will make the job a lot easier
    Using a text editor with programmer’s features such as syntax highlighting will make the job a lot easier

    The final parameter is set using the expression rgbw ? 32 : 24. This means that if the variable rgbw is true, the value 32 is passed, otherwise 24 is passed. The rbgw variable is passed into this function when we create the PIO program from our C program and is used to specify whether we’re using an LED strip with four LEDs in each (using one red, one green, one blue, and one white) or three (red, green, and blue).

    The PIO hardware works on 32-bit words, so each chunk of data we write with the values we want to send to the LEDs has to be 32 bits long. However, if we’re using RGB LED strips, we actually want to work in 24-bit lengths. By setting autopull to 24, we still pull in 32 bits each time, but once 24 bits have been read, another 32 bits are pulled in which overwrite the remaining 8 bits.

    sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX);

    Each state machine has two four-word FIFOs attached to it. These can be used for one going in and one coming out. However, as we only have data going into our state machine, we can join them together to form a single eight-word FIFO using the above line. This gives us a small buffer of time to write data to in order to avoid the state machine running out of data and execution stalling. The following three lines are used to set the speed the state machine runs at:

    int cycles_per_bit = ws2812_T1 + ws2812_T2 +
    ws2812_T3; float div = clock_get_hz(clk_sys) / (freq *
    cycles_per_bit); sm_config_clkdiv(&c, div);

    The WS2812B protocol demands that data is sent out at a rate of 800kHz. However, each bit of data requires a number of state machine cycles. In this case, they’re defined in the variables T1, T2, and T3. If you look back at the original PIO program, you’ll see that these are used in the delays (always with 1 taken off the value because the initial instruction takes one cycle before the delay kicks in). Every loop of the PIO program will take T1 + T2 + T3 cycles. We use these values to calculate the speed we want the state machine to run at, and from there we can work out the divider we need to slow the system clock down to the right speed for the state machine. The final two lines just initialise and enable the state machine.

    The main processor

    That’s the code that’s running on the state machine, so let’s now look at the code that’s running on our main processor cores. The full code is on github. Let’s first look at the code running on the second core (we’ll look at how to start this code running shortly), as this controls the light levels of the LEDs.

    static inline void put_pixel(uint32_t pixel_grb) { pio_sm_put_blocking(pio0, 0, pixel_grb << 8u);
    }
    static inline uint32_t urgb_u32(uint8_t r, uint8_t
    g, uint8_t b) { return ((uint32_t) (r) << 8) | ((uint32_t) (g) << 16) | (uint32_t) (b);
    }
    void ws2812b_core() {
    int valuer, valueg, valueb;
    int shift = bit_depth-8; while (1){ for(int i=0; i<STRING_LEN; i++) {
    valueb=(pixelsb[i] + errorsb[i]) >> shift;
    valuer=(pixelsr[i] + errorsr[i]) >> shift;
    valueg=(pixelsg[i] + errorsg[i]) >> shift;
    put_pixel(urgb_u32(valuer, valueg, valueb));
    errorsb[i] = (pixelsb[i] + errorsb[i]) -
    (valueb << shift);
    errorsr[i] = (pixelsr[i] + errorsr[i]) -
    (valuer << shift);
    errorsg[i] = (pixelsg[i] + errorsg[i]) -
    (valueg << shift); }
    sleep_us(400);
    }
    }

    We start by defining a virtual bit depth. This is how many bits per pixel you can use. Our code will then attempt to create the necessary additional brightness levels. It will run as fast as it can drive the LED strip, but if you try to do too many brightness levels, you’ll start to notice flickering.

    We found twelve to be about the best with strings up to around 100 LEDs, but you can experiment with others. Our code works with two arrays – pixels which holds the values that we want to display, and errors which holds the error in what we’ve displayed so far (there are three of each for the different colour channels).

    If you just want to see this in action, you can download the UF2 file from hsmag.cc/orfgBD and flash it straight to your Pico
    If you just want to see this in action, you can download the UF2 file from hsmag.cc/orfgBD and flash it straight to your Pico

    To explain that latter point, let’s take a look at the algorithm for determining how to light the LED. We borrowed this from the source code of Fadecandy by Micah Scott, but it’s a well-used algorithm for calculating error rates. We have an outer while loop that just keeps pushing out data to the LEDs as fast as possible. We don’t care about precise timings and just want as much speed as possible. We then go through each pixel.

    The corresponding item in the errors array holds the cumulative amount our LED has been underlit so far compared to what we want it to be. Initially, this will be zero, but with each loop (if there’s a difference between what we want to light the LED and what we can light the LED) this error value will increase. These two numbers (the closest light level and the error) added together give the brightness at the pseudo-level, so we need to bit-shift this by the difference between our virtual level and the 8-bit brightness levels that are available.

    This gives us the value for this pixel which we write out. We then need to calculate the new error level. Let’s take a look at what this means in practice. Suppose we want a brightness level halfway between 1 and 2 in the 8-bit levels. To simplify things, we’ll use nine virtual bits. 1 and 2 in 8-bit is 2 and 4 in 9 bits (adding an extra 0 to the end multiplies everything by a power of 2), so halfway between these two is a 9-bit value of 3 (or 11 in binary, which we’ll use from now on).

    In the first iteration of our loop, pixels is 11, errors is 0, and shift is 1.

    value = 11 >> 1 = 1
    errors = 11 – 10 = 1

    So this time, the brightness level of 1 is written out. The second iteration, we have:

    value = 100 >> 1 = 10
    errors = 100 – 100 = 0

    So this time, the brightness level of 10 (in binary, or 2 in base 10) is written out. This time, the errors go back to 0, so we’re in the same position as at the start of the first loop. In this case, the LED will flick between the two brightness levels each loop so you’ll have a brightness half way between the two.

    Using this simple algorithm, we can experiment with different virtual bit-depths. The algorithm will always handle the calculations for us, but we just have to see what creates the most pleasing visual effect for the eye. The larger the virtual bit depth, the more potential iterations you have to go through before the error accumulates enough to create a correction, so the more likely you are to see flicker. The biggest blocker to increasing the virtual bit depth is the sleep_us(400). This is needed to reset the LED strip.

    NeoPixels come in many different shapes and sizes

    Essentially, we throw out bits at 800kHz, and each block of 24 bits is sent, in turn, to the next LED. However, once there’s a long enough pause, everything resets and it goes back to the first LED. How big that pause is can vary. The truth is that a huge proportion of WS2812B LEDs are clones rather than official parts – and even for official parts, the length of the pause needed to reset has changed over the years.

    400 microseconds is conservative and should work, but you may be able to get away with less (possibly even as low as 50 microseconds for some LEDs). The urgb_u32 method simply amalgamates the red, blue, and green values into a single 32-bit string (well, a 24-bit string that’s held inside a 32-bit string), and put_pixel sends this to the state machine. The bit shift there is to make sure the data is in the right place so the state machine reads the correct 24 bits from the output shift register.

    Getting it running

    We’ve now dealt with all the mechanics of the code. The only bit left is to stitch it all together.

    int main() { PIO pio = pio0; int sm = 0; uint offset = pio_add_program(pio, &ws2812_
    program); ws2812_program_init(pio, sm, offset, PIN_TX,
    1000000, false); multicore_launch_core1(ws2812b_core); while (1) { for (int i = 0; i < 30; ++i) {
    pixels[i] = i; for (int j=0;j<30;++j){ pixels[0] = j; if(j%8 == 0) { pixels[1] = j; } sleep_ms(50); } for (int j=30;j>0;--j){ pixels[0] = j; if(j%8 == 0) { pixels[1] = j; } sleep_ms(50); } } } }

    The method ws2812_program_init calls the method created in the PIO program to set everything up. To launch the algorithm creating the virtual bit-depth, we just have to use multicore_launch_core1 to set a function running on the other core. Once that’s done, whatever we put in the pixels array will be reflected as accurately as possible in the WS2812B LEDs. In this case, we simply fade it in and out, but you could do any animation you like.

    Get a free Raspberry Pi Pico

    Would you like a free Raspberry Pi Pico? Subscribe to HackSpace magazine via your preferred option here, and you’ll receive your new microcontroller in the mail before the next issue arrives.

    Website: LINK

  • Meet Raspberry Silicon: Raspberry Pi Pico now on sale at $4

    Meet Raspberry Silicon: Raspberry Pi Pico now on sale at $4

    Reading Time: 9 minutes

    Today, we’re launching our first microcontroller-class product: Raspberry Pi Pico. Priced at just $4, it is built on RP2040, a brand-new chip developed right here at Raspberry Pi. Whether you’re looking for a standalone board for deep-embedded development or a companion to your Raspberry Pi computer, or you’re taking your first steps with a microcontroller, this is the board for you.

    [youtube https://www.youtube.com/watch?v=o-tRJPCv0GA?feature=oembed&w=500&h=281]

    You can buy your Raspberry Pi Pico today online from one of our Approved Resellers. Or head to your local newsagent, where every copy of this month’s HackSpace magazine comes with a free Pico, as well as plenty of guides and tutorials to help you get started with it. If coronavirus restrictions mean that you can’t get to your newsagent right now, you can grab a subscription and get Pico delivered to your door.

    Oops!… We Did It Again

    Microcomputers and microcontrollers

    Many of our favourite projects, from cucumber sorters to high altitude balloons, connect Raspberry Pi to the physical world: software running on the Raspberry Pi reads sensors, performs computations, talks to the network, and drives actuators. This ability to bridge the worlds of software and hardware has contributed to the enduring popularity of Raspberry Pi computers, with over 37 million units sold to date.

    But there are limits: even in its lowest power mode a Raspberry Pi Zero will consume on the order of 100 milliwatts; Raspberry Pi on its own does not support analogue input; and while it is possible to run “bare metal” software on a Raspberry Pi, software running under a general-purpose operating system like Linux is not well suited to low-latency control of individual I/O pins.

    Many hobbyist and industrial applications pair a Raspberry Pi with a microcontroller. The Raspberry Pi takes care of heavyweight computation, network access, and storage, while the microcontroller handles analogue input and low-latency I/O and, sometimes, provides a very low-power standby mode.

    Until now, we’ve not been able to figure out a way to make a compelling microcontroller-class product of our own. To make the product we really wanted to make, first we had to learn to make our own chips.

    Raspberry Si

    It seems like every fruit company is making its own silicon these days, and we’re no exception. RP2040 builds on the lessons we’ve learned from using other microcontrollers in our products, from the Sense HAT to Raspberry Pi 400. It’s the result of many years of hard work by our in-house chip team.

    RP2040 on a Raspberry Pi Pico

    We had three principal design goals for RP2040: high performance, particularly for integer workloads; flexible I/O, to allow us to talk to almost any external device; and of course, low cost, to eliminate barriers to entry. We ended up with an incredibly powerful little chip, cramming all this into a 7 × 7 mm QFN-56 package containing just two square millimetres of 40 nm silicon. RP2040 has:

    • Dual-core Arm Cortex-M0+ @ 133MHz
    • 264KB (remember kilobytes?) of on-chip RAM
    • Support for up to 16MB of off-chip Flash memory via dedicated QSPI bus
    • DMA controller
    • Interpolator and integer divider peripherals
    • 30 GPIO pins, 4 of which can be used as analogue inputs
    • 2 × UARTs, 2 × SPI controllers, and 2 × I2C controllers
    • 16 × PWM channels
    • 1 × USB 1.1 controller and PHY, with host and device support
    • 8 × Raspberry Pi Programmable I/O (PIO) state machines
    • USB mass-storage boot mode with UF2 support, for drag-and-drop programming

    And this isn’t just a powerful chip: it’s designed to help you bring every last drop of that power to bear. With six independent banks of RAM, and a fully connected switch at the heart of its bus fabric, you can easily arrange for the cores and DMA engines to run in parallel without contention.

    For power users, we provide a complete C SDK, a GCC-based toolchain, and Visual Studio Code integration.

    As Cortex-M0+ lacks a floating-point unit, we have commissioned optimised floating-point functions from Mark Owen, author of the popular Qfplib libraries; these are substantially faster than their GCC library equivalents, and are licensed for use on any RP2040-based product.

    With two fast cores and and a large amount of on-chip RAM, RP2040 is a great platform for machine learning applications. You can find Pete Warden’s port of Google’s TensorFlow Lite framework here. Look out for more machine learning content over the coming months.

    For beginners, and other users who prefer high-level languages, we’ve worked with Damien George, creator of MicroPython, to build a polished port for RP2040; it exposes all of the chip’s hardware features, including our innovative PIO subsystem. And our friend Aivar Annamaa has added RP2040 MicroPython support to the popular Thonny IDE.

    Raspberry Pi Pico

    Raspberry Pi Pico is designed as our low-cost breakout board for RP2040. It pairs RP2040 with 2MB of Flash memory, and a power supply chip supporting input voltages from 1.8-5.5V. This allows you to power your Pico from a wide variety of sources, including two or three AA cells in series, or a single lithium-ion cell.

    Pico provides a single push button, which can be used to enter USB mass-storage mode at boot time and also as a general input, and a single LED. It exposes 26 of the 30 GPIO pins on RP2040, including three of the four analogue inputs, to 0.1”-pitch pads; you can solder headers to these pads or take advantage of their castellated edges to solder Pico directly to a carrier board. Volume customers will be able to buy pre-reeled Pico units: in fact we already supply Pico to our Approved Resellers in this format.

    The Pico PCB layout was co-designed with the RP2040 silicon and package, and we’re really pleased with how it turned out: a two-layer PCB with a solid ground plane and a GPIO breakout that “just works”.

    A reel of Raspberry Pi Pico boards
    Reely good

    Whether Raspberry Pi Pico is your first microcontroller or your fifty-first, we can’t wait to see what you do with it.

    Raspberry Pi Pico documentation

    Our ambition with RP2040 wasn’t just to produce the best chip, but to support that chip with the best documentation. Alasdair Allan, who joined us a year ago, has overseen a colossal effort on the part of the whole engineering team to document every aspect of the design, with simple, easy-to-understand examples to help you get the most out of your Raspberry Pi Pico.

    You can find complete documentation for Raspberry Pi Pico, and for RP2040, its SDK and toolchain, here.

    Get Started with Raspberry Pi Pico book

    To help you get the most of your Pico, why not grab a copy of Get Started with MicroPython on Raspberry Pi Pico by Gareth Halfacree and our very own Ben Everard. It’s ideal for beginners who are new (or new-ish) to making with microcontrollers.

    Our colleagues at the Raspberry Pi Foundation have also produced an educational project to help you get started with Raspberry Pi Pico. You can find it here.

    Partners

    Over the last couple of months, we’ve been working with our friends at Adafruit, Arduino, Pimoroni, and Sparkfun to create accessories for Raspberry Pi Pico, and a variety of other boards built on the RP2040 silicon platform. Here are just a few of the products that are available to buy or pre-order today.

    Adafruit Feather RP 2040

    RP2040 joins the hundreds of boards in the Feather ecosystem with the fully featured Feather RP 2040 board. The 2″ × 0.9″ dev board has USB C, Lipoly battery charging, 4MB of QSPI flash memory, a STEMMA QT I2C connector, and an optional SWD debug port. With plenty of GPIO for use with any FeatherWing, and hundreds of Qwiic/QT/Grove sensors that can plug and play, it’s the fast way to get started.

    Feathery goodness

    Adafruit ItsyBitsy RP 2040

    Need a petite dev board for RP2040? The Itsy Bitsy RP 2040 is positively tiny, but it still has lots of GPIO, 4MB of QSPI flash, boot and reset buttons, a built-in RGB NeoPixel, and even a 5V output logic pin, so it’s perfect for NeoPixel projects!

    Small is beautiful

    Arduino Nano RP2040 Connect

    Arduino joins the RP2040 family with one of its most popular formats: the Arduino Nano. The Arduino Nano RP2040 Connect combines the power of RP2040 with high-quality MEMS sensors (a 9-axis IMU and microphone), a highly efficient power section, a powerful WiFi/Bluetooth module, and the ECC608 crypto chip, enabling anybody to create secure IoT applications with this new microcontroller. The Arduino Nano RP2040 Connect will be available for pre-order in the next few weeks.

    Get connected!

    Pimoroni PicoSystem

    PicoSystem is a tiny and delightful handheld game-making experience based on RP2040. It comes with a simple and fast software library, plus examples to make your mini-gaming dreams happen. Or just plug it into USB and drop the best creations from the Raspberry Pi-verse straight onto the flash drive.

    Pixel-pushing pocket-sized playtime

    Pimoroni Pico Explorer Base

    Pico Explorer offers an embedded electronics environment for educators, engineers, and software people who want to learn hardware with less of the “hard” bit. It offers easy expansion and breakout along with a whole bunch of useful bits.

    Go explore!

    SparkFun Thing Plus – RP2040

    The Thing Plus – RP2040 is a low-cost, high-performance board with flexible digital interfaces featuring Raspberry Pi’s RP2040 microcontroller. Within the Feather-compatible Thing Plus form factor with 18 GPIO pins, the board offers an SD card slot, 16MB (128Mbit) flash memory, a JST single-cell battery connector (with a charging circuit and fuel gauge sensor), an addressable WS2812 RGB LED, JTAG PTH pins, mounting holes, and a Qwiic connector to add devices from SparkFun’s quick-connect I2C ecosystem.

    Thing One, or Thing Two?

    SparkFun MicroMod RP2040 Processor

    The MicroMod RP2040 Processor Board is part of SparkFun’s MicroMod modular interface system. The MicroMod M.2 connector makes it easy to connect your RP2040 Processor Board with the MicroMod carrier board that gives you the inputs and outputs you need for your project.

    The Mighty Micro

    SparkFun Pro Micro – RP2040

    The Pro Micro RP2040 harnesses the capability of RP2040 on a compact development board with the USB functionality that is the hallmark of all SparkFun’s Pro Micro boards. It has a WS2812B addressable LED, boot button, reset button, Qwiic connector, USB-C, and castellated pads.

    Go Pro

    Credits

    It’s fair to say we’ve taken the long road to creating Raspberry Pi Pico. Chip development is a complicated business, drawing on the talents of many different people. Here’s an incomplete list of those who have contributed to the RP2040 and Raspberry Pi Pico projects:

    Dave Akerman, Sam Alder, Alasdair Allan, Aivar Annamaa, Jonathan Bell, Mike Buffham, Dom Cobley, Steve Cook, Phil Daniell, Russell Davis, Phil Elwell, Ben Everard, Andras Ferencz, Nick Francis, Liam Fraser, Damien George, Richard Gordon, F Trevor Gowen, Gareth Halfacree, David Henly, Kevin Hill, Nick Hollinghurst, Gordon Hollingworth, James Hughes, Tammy Julyan, Jason Julyan, Phil King, Stijn Kuipers, Lestin Liu, Simon Long, Roy Longbottom, Ian Macaulay, Terry Mackown, Jon Matthews, Nellie McKesson, Rod Oldfield, Mark Owen, Mike Parker, David Plowman, Dominic Plunkett, Graham Sanderson, Andrew Scheller, Serge Schneider, Nathan Seidle, Vinaya Puthur Sekar, Mark Sherlock, Martin Sperl, Mike Stimson, Ha Thach, Roger Thornton, Jonathan Welch, Simon West, Jack Willis, Luke Wren, David Wright.

    We’d also like to thank our friends at Sony Pencoed and Sony Inazawa, Microtest, and IMEC for their help in bringing these projects to fruition.

    Buy your Raspberry Pi Pico from one of our Approved Resellers today, and let us know what you think!

    FAQs

    Are you planning to make RP2040 available to customers?

    We hope to make RP2040 broadly available in the second quarter of 2021.

    Website: LINK