Pages

Friday, August 23, 2024

First look at the Raspberry Pi Pico2

For an index to all my stories click this text.

January 2021 the Raspberry Pi Pico was released. Until that time we had Arduino's and ESP series microcontrollers dominating the market and hobbyist landscape. And the Pico took us by surprise. We were used to the linux machines of the Raspberry company and suddenly they were into microcontrollers.

The Pico microcontrollers made an enormous impact as they were made in Europe and have a very low price for what they are offering (about 5 euro / 5 USD)

A year later they presented the Raspberry Pi Pico-W which has Wifi capabilities and was a serious contestant for the ESP8266 and ESP32.

And just 2 weeks ago the successor was announced the Raspberry Pi Pico2 and it is already available over here in the Netherlands. This is the version without Wifi.

No Wifi means you have to look at it like a (very) cheap Arduino with more IO pins, higher clock-rate and loads more storage and memory.

Differences.

A new chip must bring some differences and especially when there is a 3 year time-gap.

Pico   : RP2040 Dual core Arm Cortex M0+ processor at 133Mhz
Pico2 : RP2350 Dual core Arm Cortex M33 processor at 150Mhz
        or RISC-V Hazard3 processor (choosable by software)

Pico   : 264Kb Ram and 2Mb flash memory
Pico2 : 520Kb Ram and 4Mb flash memory

Pico   : 16 PWM channels
Pico2 : 24 PWM channels

Pico   : 8 × Programmable I/O (PIO) state machines
Pico2 : 3 × Programmable IO (PIO) blocks, 12 state machines

A small explanation is needed about the processor. It is not that you have to chose which Pico2 you have to buy. The Pico 2 has standard a Dual core ARM Cortex M33 processor AND a Dual core RISC-V Hazard3 processor on board. They can not work all at the same time but you can chose if you want to work with the M33 or Risc-V processors when the Pico2 boots.

The most eye-catching differences are of course the increased speed (on which later more) and the doubled ram and storage. The increased RAM and storage opens new opportunities for all kinds of projects.

What remains the same:

- USB 1.1 interface for programming
- Micro usb connector
- Low power sleep modes
- 26 multi function GPIO pins
- 2 SPI ports
- 2 I2C ports
- 2 UART ports
- 3 Analog inputs

The form factor is the same and the Pico and Pico2 are pin compatible.
This should mean that you can remove a Pico from your project and just drop in a Pico2 for more performance. I have not tested this yet, but I am confident that this will work in most (if not all) cases.



The Pico can be bought with headers and no doubt that will also become the case for the Pico2. But for now you will have to solder the headers yourself if you want to use the Pico on a breadboard.

Programming Languages.

The most popular programming languages for the Pico are MicroPython and C++ (Arduino IDE). For the Pico2 (at the moment of this writing) of those only an early release of MicroPython is available.

If you want to learn more about installing MicroPython, working with libraries and programming please consider buying one of my books listed at the bottom of this page.

For the Pico and Pico2 is the Raspberry C SDK available through the Raspberry Pi foundation.
For both the Pico and Pico2 Adafruit's Circuitpython is available allbeit in an early release version.

The Arduino IDE (C++) for the Pico2 is in development although the developer could not buy the Pico2 for testing at the moment of this writing.

Flash memory

I took a fresh Raspberry Pi Pico and the new Pico2. On the Pico I flashed the latest release of MicroPython and on the Pico2 the beta release which was the only one available at the time of this writing.

Both Pico's have flash memory for storage. The Pico has 2MB and the Pico2 has 4Mb. This is what Thonny's IDE showed what was available.

This is what the Pico has available: 1.4Mb

And this is what the Pico2 offers: 3Mb

The specs say that there should be more memory (2Mb and 4Mb) and that is correct because part of the memory is taken by the MicroPython language.

This means that with the Pico2 we have more free storage as the total memory of the Pico. This offers loads of possibilities for graphics and audio projects. I have some nice audio projects coming up on this weblog and they could really benefit from this increased storage.


Ram

Now let us have a look at RAM memory. This is the memory in which programs run.



The Pico has 228608 bytes which is about 228k memory free when running MicroPython.



The Pico2 has 482432 bytes free. More then twice the memory of the Pico is free. This means we can make large programs or work with huge amounts of data.

Speed test

I tested the speed differences with MicroPython.
For the Pico2 there are 2 versions of microPython available. The first version runs microPython on the Cortex M33 core and the second version runs on the Risc-V core. I tested both and compared them to the same program running on the Pico.

Just for the record. The original Pico can be overclocked. That means that we can change (increase) the clock frequency of the Pico so it runs faster (there will be a story on this weblog over this feature). At this moment you can not push the clock frequency of the Pico2 over the standard 150mhz as Micropython will not allow it.

For testing I used the following program:

import time
start = 10000
end = 11000

starttim = time.ticks_ms()

print ("Searching the Prime Numbers from ", start, "to ", end)
for number in range (start, end + 1):
    if number > 1:
        for i in range (2, number):
            if (number % i) == 0:
                break
        else:
            #print (number)
            continue

endtim = time.ticks_ms()
print(endtim-starttim)

This program is a combination of two of the tips you can find on my MicroPython tips page:


https://micropython-tips.weebly.com/

The program runs through all numbers between 10000 and 11000 and test for prime numbers. If you remove the # in the line #print (number) the program will actually print the found prime numbers. The test was done without the numbers being printed.



The original Pico needed 12707 microseconds to run this program. That is almost 13 seconds.



The Pico2 running the M33 cores needed 6683 microseconds. Just a bit less then 7 seconds. This means that it runs at almost double the speed of the original Pico.



The Pico2 running the hazard33 core (Risc-V) needed 7017 microseconds which is just a bit over 7 seconds.

So the Pico 2 runs about twice as fast as the original Pico in this test.

The speed difference is not just because the increase of the clock (from 133Mhz to 150Mhz) but mostly because the M33 cores do the job far more efficient as the Pico's original M0 core.

Please be aware that the results are from a beta release of MicroPython. The official releases may even bring better results.

The price.

The Raspberry Pi Pico2 is now available in the Netherlands for 5,95 Euro. An unbelievable low price for such an extensove development board. Compare that to the price of an original Arduino and you can clealy see who the winner is.

Concluding.

For about 1 euro more as the original Pico you will get twice the memory and about twice the speed. And that in a package of the same size which is pin compatible.

For a lot of projects that already are around the extra speed and memory are not needed. However the price difference makes the choice easy. And no doubt a lot of new projects will emerge that will use that extra speed and memory and will bring projects we never though would be possible.

Pico2-W ???

Yes there will be a version with Wifi. The Raspberry Organisation confirmed that it will be available by the end of this year.

Till next time
have function

Luc Volders