jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 32452
Joined: Sat Jul 30, 2011 7:41 pm

FAQ

Thu Jan 21, 2021 7:18 am

Some basic question and answers on the Raspberry pi Pico, please add questions on this thread, I'll try and answer them, and add them to the first post. Occasionally, I will curate the replies on this thread, so some may be deleted if they have been moved to the FAQ, or they are not FAQ related.



Is RP2040 5V tolerant?

No. RP2040 microcontrollers use 3.3V for GPIO.

I've accidentally connected +5V to my Raspberry Pi Pico or other RP2040-based microcontroller. Is the pin dead ?

It depends; often RP2040 will survive, but it is not recommended, and can reduce the life of the microcontroller.

Can I buy the RP2040 chip?

Not yet; we hope to make the RP2040 broadly available in the second quarter of 2021.

Can I solder it myself?

For the RP2040 itself, yes; it’s not easy, and you will need magnification of some sort and a very good soldering iron to go with a very steady hand, but it can be hand soldered. The Raspberry Pi Pico board on the other hand has been designed so that it can be easily soldered down to another PCB, it's why it has castellated contacts on each edge.

What OS does it run?

Like other microcontrollers, it doesn't run an OS by default, but we supply a SDK which provides a rich library of functions for using the hardware/features of the chip, along with higher-level functionality often found in an OS. You can use this to write “bare metal” C/C++ applications easily, or you can use MicroPython, which is even simpler for beginners.

What is the maximum flash size?

16 MiB of flash (2^24 bytes)

Is it open-source?

The Raspberry Pi Pico board design files are open-source, along with all the provided software, examples, and documentation. The internal design of the RP2040 microcontroller itself is not open-source.

Should I buy a Raspberry Pi Pico or a Raspberry Pi Zero?

These are two very different devices, a microcontroller and a microcomputer, intended for different purposes. Pico is a great device for dedicating to a very specific task, whereas Zero is a multipurpose device. Raspberry Pi Zero has HDMI out, a camera interface, etc; Raspberry Pi Pico does not. However, Pico has an on-board ADC as well as other peripherals not present on Raspberry Pi Zero, and consumes considerably less power; it is therefore much more suited to embedded applications than Raspberry Pi Zero.

Can I overclock?

The maximum clk_sys clock speed is 133MHz at normal core voltage (1.1V ±10%), but it can be overclocked. However, this requires more power and a higher core voltage, and may affect the life expectancy of your device. No warranties are given when running outside of the limits specified in the datasheet.

Does it support Arduino/Blockly/other programming

No, but we do expect third parties to port their own development systems to RP2040/Pico over time. For launch, alongside the very comprehensive C/C++ SDK, there is an official port of MicroPython. Adafruit has also ported CircuitPython to RP2040.

What low-power modes are there?

There is no specific low-power mode, but you can do various things to reduce power consumption: slow the system clock, power down some of the memories, gate the clock to peripherals, reduce the core supply voltage, etc.

There are two specific modes for turning off parts of the device when not being used:

SLEEP mode is when processors are in wfi/wfe and DMA is inactive, so you can shut off most system clocks, including things like bus fabric.

DORMANT mode is when you shut down all oscillators, and so is lower power still, but then you have fewer options for waking.


I’m using VSCode. How do I set a breakpoint on the second core?

At the moment you need to use the command window in VSCode to set a gdb breakpoint.

GCC 10.2 is available. Why aren’t you using it by default?

Our development work has been using the more common versions of GCC as supplied with various distributions. We have checked builds using major gcc versions from 6.3.1 to 10.2, so all of those should work.

What is the maximum source impedance required for the ADC inputs to achieve the 9-bit resolution ?

We are currently working on characterising this, and will update the datasheet.

Where do I get technical support?

For help on the Pico C/C++ SDK and RP2040 you can use our forums. For all other things, for example MicroPython, CircuitPython or Arduino, please contact the appropriate vendors.

Adafruit’s launch blog, with references to CircuitPython, can be found here: https://blog.adafruit.com/2021/01/21/ra ... -of-boards
Arduino
https://blog.arduino.cc/2021/01/20/welc ... ntrollers/

Can I run machine learning tools?

Yes. TensorFlow Lite for Microcontrollers has been ported to Raspberry Pi Pico by Google, and is available in our repos. It is an early version so there is lots of optimisation still to do.

I don't want to use C or Python, can I write assembler?

Of course; check out the SDK which has some library functions written in assembler.

The processor (Twin core M0+) implements the ARMv6-M Thumb instruction set, including a number of 32-bit instructions that use
Thumb-2 technology. The ARMv6-M instruction set comprises all of the 16-bit Thumb instructions from ARMv7-M excluding CBZ, CBNZ and IT and the 32-bit Thumb instructions BL, DMB, DSB, ISB, MRS and MSR.

Can I use an RTOS?

Yes, we will be working on porting an RTOS soon.

That MicroPython book looks cool, is there a downloadable version?

Yes!! https://hackspace.raspberrypi.org/books ... ython-pico

What is an UF2 file

It's a file format for flashing microcontrollers, developed by Microsoft. https://github.com/microsoft/uf2

It doesn't support my communications protocol, what can I do?

There are inbuilt HW blocks to support UART, SPI and I2C, but there is also a unique and very specialised HW block call the PIO which can be programmed to implement all sorts of different digital protocol, both input and output. For example you can program it to be a UART, (in fact, with 8 channels, it can implement another 4 TX/RX UARTS, or 8 RX or 8 TX's, or combinations thereof!), RS485, and almost any other protocol you can think of. See the databook for more information on the PIO, and pico-examples for some examples of the PIO in action.

Why use micro-USB instead of USB-C on the Raspberry Pi Pico board?

Cost! USB-C connectors are still more expensive than micro-USB, and when you are making millions of devices, even a few cents more per connector really adds up. We also believe that, especially in the educational arena, that micro-USB is still much more common than USB-C. If you must have it, RP2040 boards with USB-C are available from our partners .

Why is there no reset button? Constantly unplugging and plugging in is a pain!

Cost is the main reason, adding an extra button can make a big difference. But we also expect that if you are making a lot of changes during development, you will have set up the SWD (Single Wire Debug) system, which allows you to download code the board via the debugger. This means you don't need to power off or use the BOOTSEL button at all. There are other options as well.

Can I use my Raspberry Pi to develop for the Pico?

Of course. Although any model of Pi would be able to communicate with the Pico, we recommended more recent models for development, especially if using the VSCode IDE as that requires a strong CPU and at least 2GB of RAM. So the Pi4 and Pi400 are best when using an IDE, but if you are using the command line, the Raspberry Pi3 or even 2B should be OK. Compile times will be a bit longer though, and we do recommend a 16GB card to ensure you have enough space for all the code trees.

How do I completely clear the Flash on my Pico?

If you are moving between MicroPython and C programs, you might find you have problems with certain applications, and need to clear the Flash completely to start again. We provide a special uf2 program that can do this for you called nuke.uf2. It can be found here https://www.raspberrypi.org/documentati ... h_nuke.uf2 and the source code for it can be found here https://github.com/raspberrypi/pico-exa ... uke/nuke.c

How can I find out when SDK or similar releases happen?

Every now and then we will update the SDK or any of the other Pico repositories. You can easily be informed when this happens using github. Login in to you github account, and subscribe to the repro - Watch (top right) -> Custom -> Releases. You can also Star a repository if you like it!

What are GPIO 23,24,25 and 29 used for on the Pico board?

These GPIO's are used on the Pico board for the following purposes.

GPIO23 goes to the PS pin of the voltage regulator, to adjust it between PFM and PWM mode.
GPIO24 is the centre of a 5k6/10k voltage divider off the VBUS from USB, on the USB side of a diode, so it detects if USB is supplying voltage
GPIO 25 is the on board LED
GPIO29/ADC3 is another voltage divider to measure VSYS, but with an extra FET in place so the divider cant leak into the ADC and 3.3v rail, when the 3.3v rail is off

What is the maximum current rating of the GPIO's?

In total (adding up all the individual GPIO demands), the current for the IOVDD must be <=50mA.

Can I use USB serial when debugging using SWD?

No, you need to use a UART based console when debugging using SWD. This is because the USB stack will be paused when the RP2040 cores are stopped during debugging, which will cause any attached devices to disconnect.

What caches does the RP2040 have?

There is just one, an execute in place (XIP) cache on the flash (because flash memory is quite slow). There are otherwise no instruction or data caches.

Can I make my code run from RAM?

Yes, you can. Add the following line to CMakeLists.txt and it will force the program to be loaded in to RAM instead of flash when you download it. This means your program will be gone if you power cycle, but it does reduce the number of rewrite cycles on the flash, so is useful during development.

Code: Select all

pico_set_binary_type(<YourProjectName> no_flash)
Principal Software Engineer at Raspberry Pi Ltd.
Working in the Applications Team.

tannewt
Posts: 75
Joined: Tue Nov 17, 2020 1:14 am

Re: FAQ

Thu Jan 21, 2021 8:09 am

For the blocks question there is existing CircuitPython support in EduBlocks: https://edublocks.org/circuitpy.html The APIs it uses are the same we provide in the CircuitPython RP2040 port. PIO isn't yet supported by it though.

User avatar
scruss
Posts: 5563
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON

Re: FAQ

Thu Jan 21, 2021 8:19 pm

USB HID support, so we can make keyboards, mice and other interesting input devices?
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2921
Joined: Thu Jul 11, 2013 2:37 pm

Re: FAQ

Thu Jan 21, 2021 8:46 pm

scruss wrote:
Thu Jan 21, 2021 8:19 pm
USB HID support, so we can make keyboards, mice and other interesting input devices?
Anything that needs less than 16 endpoints. Which is to say, pretty much anything that makes sense to implement on a full-speed device.
Rockets are loud.
https://astro-pi.org

lb
Posts: 301
Joined: Sat Jan 28, 2012 8:07 pm

Re: FAQ

Mon Jan 25, 2021 8:52 am

Is there really no usable low-power option for timed wakeup?

The DORMANT state stops all clocks, so without an external low-speed oscillator for the RTC (which will consume additional power) it doesn't look like there's any way to implement a timed wakeup. Nonetheless, the DORMANT state still has a pretty hefty power consumption (~180 uA), and you need to take additional quiescent current of the flash chip into account, too.

The lack of good deep-sleep options seems to be the biggest problem of the RP2040. It seems to be mostly unsuitable for battery-powered applications.

User avatar
aallan
Raspberry Pi Employee & Forum Moderator
Raspberry Pi Employee & Forum Moderator
Posts: 358
Joined: Mon Feb 09, 2015 11:30 am
Location: Exeter, UK

Re: FAQ

Mon Jan 25, 2021 10:38 am

lb wrote:
Mon Jan 25, 2021 8:52 am
The DORMANT state stops all clocks, so without an external low-speed oscillator for the RTC (which will consume additional power) it doesn't look like there's any way to implement a timed wakeup. Nonetheless, the DORMANT state still has a pretty hefty power consumption (~180 uA), and you need to take additional quiescent current of the flash chip into account, too.

There is an example in the pico-playground repo, https://github.com/raspberrypi/pico-pla ... ello_sleep
Head of Documentation
Raspberry Pi Ltd
About me, http://alasdairallan.com

lb
Posts: 301
Joined: Sat Jan 28, 2012 8:07 pm

Re: FAQ

Mon Jan 25, 2021 11:11 am

aallan wrote:
Mon Jan 25, 2021 10:38 am
There is an example in the pico-playground repo, https://github.com/raspberrypi/pico-pla ... ello_sleep
Yes, but that uses the SLEEP mode, which uses ~390 uA according to datasheet. That's not low power at all.

cjcj1949
Posts: 9
Joined: Thu Jan 28, 2021 5:44 pm

Re: FAQ

Sun Jan 31, 2021 4:54 pm

5V tolerance is often not understood. Inputs will have protection diodes which will conduct when the input is above the power supply voltage. They will be destroyed when the current exceeds a few milliamps for a given time. So it is not just voltage but the current that the voltage source can supply. So 5V through a 10k resistor should be ok ( 0.1ma) but not directly from the power supply capable of supplying a lot more especially from its decoupling capacitors.

hippy
Posts: 14447
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: FAQ

Tue Feb 02, 2021 9:58 am

cjcj1949 wrote:
Sun Jan 31, 2021 4:54 pm
5V tolerance is often not understood. Inputs will have protection diodes which will conduct when the input is above the power supply voltage.
According to a note on the schematic in the Pico Datasheet PDF; "ADC GPIO pins have diode to AVDDD (other GPIO do not)".

If one is going to over-volt an input it is probably best to add external clamping diodes.

While I agree that over-volting is usually safe for many microcontrollers when the current is kept low enough; RPT consider any over-volting to be "out of spec" on their Pi SBC's and should not be done. I would expect to see the same perspective carried over to the RP2040.

bgolab
Posts: 452
Joined: Sat Jan 30, 2021 12:59 pm
Location: Krakow, PL

Re: FAQ

Mon Feb 15, 2021 7:34 pm

I would add to this FAQ some info about how to enable CMake to generate the RAM only builds ('no_flash' option).

I use RAM only builds all the time to avoid unnecessary flashing during the development phase.

I think it's a great feature of the UF2 RPI implementation - not seen in other implementation (at least I am not aware of).

Other Cortex MCU allows to upload the code to SRAM in more complicated way - either through SWD or UART/I2C bootrom extension (see STM32).
The PICO approach is perfect.

bgolab
Posts: 452
Joined: Sat Jan 30, 2021 12:59 pm
Location: Krakow, PL

Re: FAQ

Tue Feb 16, 2021 8:47 am

Not sure if it is not too early as we have initial API releases (and new libraries will be improved) but I would add some code size optimization technic here.
I know I know is more about compiler / linker stuff and not the PICO itself but the code size of the builds generated for PICO is rather less then optimal.

This might be interesting for people running PICO from SRAM...

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 32452
Joined: Sat Jul 30, 2011 7:41 pm

Re: FAQ

Tue Feb 16, 2021 9:27 am

bgolab wrote:
Tue Feb 16, 2021 8:47 am
Not sure if it is not too early as we have initial API releases (and new libraries will be improved) but I would add some code size optimization technic here.
I know I know is more about compiler / linker stuff and not the PICO itself but the code size of the builds generated for PICO is rather less then optimal.

This might be interesting for people running PICO from SRAM...
I think that is too big a subject for a FAQ. Once we have a document in place we can link to it from here.
Principal Software Engineer at Raspberry Pi Ltd.
Working in the Applications Team.

bgolab
Posts: 452
Joined: Sat Jan 30, 2021 12:59 pm
Location: Krakow, PL

Re: FAQ

Tue Feb 16, 2021 9:35 am

Thanks a lot!.

Side note: I use Keil uVision mostly for my STM32 development. They are very good at code size optimization. I mean Keil MicroLib.

cjcj1949
Posts: 9
Joined: Thu Jan 28, 2021 5:44 pm

Re: FAQ

Fri Mar 26, 2021 5:26 pm

hippy wrote:
Tue Feb 02, 2021 9:58 am
cjcj1949 wrote:
Sun Jan 31, 2021 4:54 pm
5V tolerance is often not understood. Inputs will have protection diodes which will conduct when the input is above the power supply voltage.
According to a note on the schematic in the Pico Datasheet PDF; "ADC GPIO pins have diode to AVDDD (other GPIO do not)".

If one is going to over-volt an input it is probably best to add external clamping diodes.

While I agree that over-volting is usually safe for many microcontrollers when the current is kept low enough; RPT consider any over-volting to be "out of spec" on their Pi SBC's and should not be done. I would expect to see the same perspective carried over to the RP2040.
I did not mean to imply that it would be a good idea. To be more accurate I should have said should appear to work. There is a lot of difference between something that works in a one off and something that works reliably in a noisy environment.

The GPOIs seem to have an enhanced electrostatic protection according to the data sheet. I did not find any figure for the maximum input current.

I haven't seen any mention of electrostatic precautions in the documentation. Touching something that's earthed after sitting down, before touching the pico might be an idea, especially as we are expected to pick it up and hold the reset button before connecting the usb.

Static damage can reduce reliability even if not fatal.

SteveM84
Posts: 1
Joined: Sun May 16, 2021 7:15 pm

Re: FAQ

Sun May 16, 2021 7:24 pm

You say that development can be carried out on just about any Rpi model but you do not mention RPiZeros. I am trying to use a Zero but keep hitting problems the latest of which is that cmake is version 3.6 when 3.12 is needed yet apt upgrade says cmake 3.6 is the latest version. Is it not possible to use an RPi Zero to run cmdline compilations using cmake? Is there another way I can do this without having to buy an RPi4?

Return to “General”