Jump to content
 

Raspberry Pi Pico


DavidB-AU
 Share

Recommended Posts

48 minutes ago, KingEdwardII said:

 

Of course, us Windows and Mac users are the poor relations here - there is a throw-away comment on p33 of that getting started document which says it all:

 

"the main supported platform for developing for the RP2040 is the Raspberry Pi"

 

and since the folks making the Pico also make the Pi, I can hardly blame them.

 

If you have a look at the Raspberry Pi blog entry about the sevelopment of the RP2040 chip,

The journey to Raspberry Silicon

it can be seen that the Pi400 was part of the development environment...

 

As a general-purpose computer, the Pi400 makes sense in so many ways!

  • Agree 1
Link to post
Share on other sites

14 hours ago, melmerby said:

OK

Help needed

Pico arrived today, duly connected to PC as USB storage, pasted python package to it and it re-booted. - (as described)

 

In Getting Started With Pico page 35: Accessing the Pico from a Win 10 PC.

5 large programs required for Window use, download, install & set up. (what a fag)

One of said programs is "Git" and it says use Notepad++ from the options during it's setup.

Selected Notebook ++ in the options.and Git refuses to set up, the next staged is greyed out

 

Anyone any suggestions?

 

As you installed the MicroPython UF2 file I assume that you intend to use MicroPython as your development environment.  If so then all you need is a Python IDE such as the suggested "Thonny" which is an easy install on a Windows PC. 

 

The "Getting Started with Pico" document describes the installation of the C/C++ toolchain, which I initially contemplated before deciding to go for the least fussy path...

 

I may yet install the C toolchain but Python ticks all the boxes for what I want to do at present.

 

 

Edited by Hroth
  • Agree 1
  • Informative/Useful 1
Link to post
Share on other sites

  • RMweb Premium

As regards Notepad++, I had realised that it was a text editor but assumed Git would install it as part of the set up.:(

 

I tried Coolterm as recommended by SHMD and at least got started.

 

As regards using a Pi to develop programs for a Pico, I think the developers have not considered what I think will be the main market which is projects like all the Arduino stuff.

After all it is a better specified, similar sort of device of a similar form and a very competitive price.

IMHO most users will be on PCs or Macs

Write a program on the computer and dump it into the Pico - done.

 

I was wondering how close the C++ would be to the Arduino version.

 

 

 

Link to post
Share on other sites

2 minutes ago, melmerby said:

but assumed Git would install it as part of the set up.

Keith,

 

:rofl:

Hmm - the software developer world definitely ain't like that!

 

As far as the Pi folk are concerned, they would not see the Arduino as a competitor, but as complementary technology - I've seen plenty of projects with Pi + Arduino. The Pico takes the Pi ecosystem into a new space that definitely competes more with Arduino, but I can understand the thinking that makes Linux the focus of their work for developers.

 

I switched to Mac from Windows over 10 years ago for software development reasons, but in reality the rise of cloud computing has enhanced the status of Linux immensely - it is the most commonly used platform for cloud computing apps and dominates the newer technologies of VMs and Containers. It is also increasingly common in IoT devices as they incorporate mainstream processors. Software developer tools are generally highly advanced on Linux - and it is also easy to run Linux on Windows and Mac systems using VMs. So, for the Pi ecosystem, doing development on the Pi version of Linux is like falling off a log.

 

Yours,  Mike.

Link to post
Share on other sites

  • RMweb Gold

I got my first program running by following these steps: -

 

image.png.9433158efd3fa123b94a8ed4c14d2d8d.png

 

1/ - Type "Thonny" into google and look for thonny.org (it's first or second in the list).

2/ - Install the Thonny IDE (choices as to which OS you want are at the top of the page).

3/ - Run Thonny.

4/ - Connect to the Pico.

5/ - copy some lines from that video I linked to earlier.

6/ - Click on the little green "RUN" icon and the PICO's LED should (does) toggle each time it is pressed.

 

 

Kev.

 

Link to post
Share on other sites

  • RMweb Gold

You can also run single lines, directly, in the Shell window of the IDE: -

 

image.png.481a16b61c12a994b3fecab52212b017.png

 

However, Micro Python is extremely sensitive to CASE (upper/lower and position) and white space (Space bar/indents/position/etc)

"led.ON" is not the same as "led.on()"!

 

...but it does work.

 

 

Kev.

Link to post
Share on other sites

  • RMweb Premium
2 hours ago, SHMD said:

 

However, Micro Python is extremely sensitive to CASE (upper/lower and position) and white space (Space bar/indents/position/etc)

"led.ON" is not the same as "led.on()"!

 

Kev.

Same as C++ on an Arduino where certain keywords are in either Upper or Lower case and you mistype them and end up having a variable instead. (however whitespace isn't critical).

 

I have installed Tonny and will have a play later today.

Link to post
Share on other sites

  • RMweb Premium
On 09/02/2021 at 23:28, melmerby said:

That's quite a lot of useful add-ons to start you off.

So good in fact that I have just ordered one from Pimoroni!:D

My Pico Explorer arrived today.

Quick service from Pimoroni.

Link to post
Share on other sites

  • RMweb Gold

Today I decided to see how fast the RP2040 was and compare it to my usual PIC processor based projects.

 

The code is simple. Basically an endless loop toggling a pin as fast as it can.

Both the PICO and the PIC code was written in Basic but the PICO runs the Basic in an Interpreter whilst the PIC has its' code compiled before downloading.

 

The PICO ran at the default 48MHz and the PIC has a 20MHz clock.

 

Here is the code: -

image.png.c1655d74ca2b65cf2d82660a59de7e9e.png

 

 

Here are the waveforms: -

 

This shows that the PIC (Blue) 384kHz is running about 7 times faster than the RP2040 (Red) 55.4kHz.

image.png.85bea4047fa6aa0c3058b6a13d52406d.png

 

What isn't shown above, but recorded here, is that every 10th RP2040 cycle an extra 2us is added to half a cycle - very regular.

image.png.a6478c23d7ef1c364e713c0894c69b60.png

(The pause in the PIC Blue trace is my interrupt service routine flashing a "life" LED - I know about it and am in control of it.)

 

Both are comparable in terms of rise and fall rates and overall shape.

image.png.4c402854b8755dee434420d0a6af94f7.png

 

 

So, 

 

RP2040, 48MHz gives 55.4kHz with an extra 2us thrown in every 180us.

PIC, 20MHz gives a rock steady 384kHz.

 

...but my biggest problem is the 3.3v.

 

 

Kev.

Edited to add the correct screen grab.

Edited by SHMD
Link to post
Share on other sites

35 minutes ago, SHMD said:

So, 

 

RP2040, 48MHz gives 55.4kHz with an extra 2us thrown in every 180us.

PIC, 20MHz gives a rock steady 384kHz.

 

...but my biggest problem is the 3.3v.

The Pico code doesn’t look like Basic but Python but anyway. Are you able to compile the Python code? I think that would be a fairer comparison of speed

Link to post
Share on other sites

  • RMweb Gold
2 minutes ago, LimboBrit said:

The Pico code doesn’t look like Basic but Python but anyway. Are you able to compile the Python code? I think that would be a fairer comparison of speed

 

Both are good points.

Yes it was the Python and I will now try to compile it. (Never done that - yet!)

 

 

Kev.

Link to post
Share on other sites

13 minutes ago, SHMD said:

 

Both are good points.

Yes it was the Python and I will now try to compile it. (Never done that - yet!)

 

 

Kev.

I’m not actually sure there is a Python compiler for this uController. If there is you should end up with a .pyc file

Link to post
Share on other sites

  • RMweb Gold
Just now, LimboBrit said:

I’m not actually sure there is a Python compiler for this uController. If there is you should end up with a .pyc file

 

...I am rapidly coming to the same conclusion!

 

 

Kev.

 

Link to post
Share on other sites

17 minutes ago, SHMD said:

 

...I am rapidly coming to the same conclusion!

 

 

Kev.

 

I just found this on the micropython.org website 

 

“a cross-compiler and frozen bytecode, to have pre-compiled scripts that don't take any RAM (except for any dynamic objects they create)”

Link to post
Share on other sites

  • RMweb Premium
3 hours ago, SHMD said:

Today I decided to see how fast the RP2040 was and compare it to my usual PIC processor based projects.

 

So, 

 

RP2040, 48MHz gives 55.4kHz with an extra 2us thrown in every 180us.

 

 

...but my biggest problem is the 3.3v.

 

 

Kev.

Edited to add the correct screen grab.

Just tried it with my Pico (also Picoscope) and it came out at 57.7kHz. Waveform same as yours.

That's about 6% difference, I would have thought they would be more consistent than that.

  • Informative/Useful 1
Link to post
Share on other sites

  • RMweb Premium

It may sound stupid but where does the power supply go for the Pimoroni Pico Explorer?

It's got a motor driver and a RGB display but I can't see where you would connect their power.

 

EDIT

I assume everything's powered by the USB but as there is a motor controller, I thought there might have been a local supply point for that to saving loading the USB too much.

Edited by melmerby
Link to post
Share on other sites

  • RMweb Gold

 

The H-Bridge outputs are connected to the USB 5v.

 

Here I send a PWM train in and monitor the DRV8833 output...

image.png.69f4e4a87dffd0f9db35e124e97e20a7.png

 

..but, so far, I can't get that little LED to light up near the "MOTORS" header!

 

Hmm.. I wonder if these H-Bridge outputs could be used to drive a couple of Servos?

 

 

Kev.

 

Link to post
Share on other sites

  • RMweb Premium
2 hours ago, SHMD said:

 

The H-Bridge outputs are connected to the USB 5v.

 

Here I send a PWM train in and monitor the DRV8833 output...

 

 

Hmm.. I wonder if these H-Bridge outputs could be used to drive a couple of Servos?

 

 

Kev.

 

Why, surely all you need is the 5v DC supply from the USB (or a separate 5v supply) and a logic signal?

3.3v logic might be enough to operate a servo. (I found on the web that servos aren't too fussy)

Link to post
Share on other sites

  • RMweb Gold

I was thinking more in terms of using the H-Bridge outputs as a ready available logic level shifter from 3.3 to 5 volt logic levels.

One way only of course.

 

 

Kev.

 

Link to post
Share on other sites

  • RMweb Premium

How's folk getting on with the Pico?

 

Is there a MicroPython language reference for the Pico? (rather like the one for Arduino's C++ implementation)

e.g. from machine import XXX. precisely what is in the "machine" that can be imported? etc.

Also where/what are these machine routines and where can you get them?

 

EDIT found the help()  routine, so more reading to do!:D

 

Apart from a few very simple typed in programs I couldn't get any examples to work on the Pic using the R Pi microPython build so I have now loaded the Pimoroni build

Now I have the basic demo running

 

Most of the examples for the Pico seem to be C++, so I'm wondering whether to try that instead of Python.

Edited by melmerby
Link to post
Share on other sites

Keith,

 

I assume that you found the Pico Python SDK document here:

 

https://datasheets.raspberrypi.org/pico/raspberry-pi-pico-python-sdk.pdf

 

This then references the general MicroPython docs here:

 

https://docs.micropython.org/en/latest/reference/index.html

 

An import statement references a module that contains a library of functions that you can use in the Python program.

 

The machine module is described here:

 

https://docs.micropython.org/en/latest/library/machine.html

 

The machine module is supposed to be part of the MicroPython implementation.

 

This article might help with first steps:

 

https://magpi.raspberrypi.org/articles/programming-raspberry-pi-pico-with-python-and-micropython

 

Yours,  Mike.

  • Like 1
  • Informative/Useful 1
Link to post
Share on other sites

  • RMweb Premium
1 hour ago, KingEdwardII said:

 

An import statement references a module that contains a library of functions that you can use in the Python program.

 

Yours,  Mike.

Hi Mike

 

I'm showing my total lack of any python language knowledge here.

Perhaps I'm getting it wrong but the 'import' seems to be doing a similar action as the #include in C++ and that is usually a library of functions for add-ons (drivers etc.)

 

The problem seems to be that some programs are trying to import things that don't exist/can't find

e.g. if you use the micropython build for Pico from the Raspberry Pi website, when you run a demo for the Pimoroni Pico Explorer the 'drivers' for the display and motor driver aren't there.

 

Not really a problem if you can add-in the bit that's missing like with C++

But can you/how do you do that with micropython?

 

Like this from Pico Explorer demo.py:

 

import time, random

import picoexplorer as explorer

 

Where do I find picoexplorer? Is it a stand alone module?

It's quite clearly there with the Pimoroni build of micropython but unlike C++, I cannot see it sitting anywhere waiting to be used.:scratchhead:

 

 

 

 

Link to post
Share on other sites

  • RMweb Gold

That's because the demos are running library routines that have already been written - but NOT for microPython or the Pico.

These demos seem to be using the libraries for circuitPython for the Adafruit!

 

Plenty of frustration available here: -

 

https://forums.pimoroni.com/t/pico-micropython-image/15967

 

\quote/

You can run Circuitpython on a RPi Pico. Adafruit tell you how here:
Overview | Getting Started with Raspberry Pi Pico and CircuitPython | Adafruit Learning System 11
I’ll get another Pico and give it a try as there are so many library files already written and tested.
Pico Download (circuitpython.org) 4 This is the UF2 file

\quote/

 

 

...but I couldn't get any of it to work.

 

 

Kev.

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...