Coder Social home page Coder Social logo

earlephilhower / arduino-pico Goto Github PK

View Code? Open in Web Editor NEW
1.8K 55.0 370.0 47.79 MB

Raspberry Pi Pico Arduino core, for all RP2040 boards

License: GNU Lesser General Public License v2.1

Assembly 0.24% C++ 54.36% C 43.14% Python 1.20% CMake 0.14% Shell 0.39% Makefile 0.01% HTML 0.52% Tcl 0.01%
raspberry pi pico arduino arduino-pico rp2040 freertos smp raspberry-pi picow

arduino-pico's Introduction

Arduino-Pico

Release Gitter

Raspberry Pi Pico Arduino core, for all RP2040 boards

This is a port of the RP2040 (Raspberry Pi Pico processor) to the Arduino ecosystem. It uses the bare Raspberry Pi Pico SDK and a custom GCC 12.3/Newlib 4.0 toolchain.

Documentation

See https://arduino-pico.readthedocs.io/en/latest/ along with the examples for more detailed usage information.

Contributing

Read the Contributing Guide for more information on submitting pull requests and porting libraries or sketches to this core.

Supported Boards

  • Raspberry Pi Pico
  • Raspberry Pi Pico W
  • 0xCB Helios
  • Adafruit Feather RP2040
  • Adafruit Feather RP2040 SCORPIO
  • Adafruit ItsyBitsy RP2040
  • Adafruit KB2040
  • Adafruit Macropad RP2040
  • Adafruit Metro RP2040
  • Adafruit QTPy RP2040
  • Adafruit STEMMA Friend RP2040
  • Adafruit Trinkey RP2040 QT
  • Arduino Nano RP2040 Connect
  • ArtronShop RP2 Nano
  • BridgeTek IDM2040-7A
  • Cytron Maker Pi RP2040
  • Cytron Maker Nano RP2040
  • Cytron Maker Uno RP2040
  • DatanoiseTV PicoADK+
  • Degz Suibo RP2040
  • DeRuiLab FlyBoard2040 Core
  • DFRobot Beetle RP2040
  • ElectronicCats Hunter Cat NFC
  • ExtremeElectronics RC2040
  • Invector Labs Challenger RP2040 WiFi
  • Invector Labs Challenger RP2040 WiFi/BLE
  • Invector Labs Challenger RP2040 WiFi6/BLE
  • Invector Labs Challenger NB RP2040 WiFi
  • Invector Labs Challenger RP2040 LTE
  • Invector Labs Challenger RP2040 LoRa
  • Invector Labs Challenger RP2040 SubGHz
  • Invector Labs Challenger RP2040 SD/RTC
  • Invector Labs Challenger RP2040 UWB
  • Invector Labs RPICO32
  • Melopero Cookie RP2040
  • Melopero Shake RP2040
  • Neko Systems BL2040 Mini
  • Olimex RP2040-Pico30
  • nullbits Bit-C PRO
  • Pimoroni PGA2040
  • Pimoroni Plasma2040
  • Pimoroni Tiny2040
  • RAKwireless RAK11300
  • Redscorp RP2040-Eins
  • Redscorp RP2040-ProMini
  • Sea-Picro
  • Seeed Indicator RP2040
  • Seeed XIAO RP2040
  • Silicognition RP2040-Shim
  • Solder Party RP2040 Stamp
  • SparkFun MicroMod RP2040
  • SparkFun ProMicro RP2040
  • SparkFun Thing Plus RP2040
  • uPesy RP2040 DevKit
  • VCC-GND YD-RP2040
  • Viyalab Mizu RP2040
  • Waveshare RP2040 Zero
  • Waveshare RP2040 One
  • Waveshare RP2040 Plus
  • Waveshare RP2040 LCD 0.96
  • Waveshare RP2040 LCD 1.28
  • Waveshare RP2040 Matrix
  • Waveshare RP2040 PiZero
  • WIZnet W5100S-EVB-Pico
  • WIZnet W5500-EVB-Pico
  • WIZnet WizFi360-EVB-Pico
  • Generic (configurable flash, I/O pins)

Features

  • Adafruit TinyUSB Arduino (USB mouse, keyboard, flash drive, generic HID, CDC Serial, MIDI, WebUSB, others)
  • Bluetooth on the PicoW (Classic and BLE) with Keyboard, Mouse, Joystick, and Virtual Serial
  • Generic Arduino USB Serial, Keyboard, Joystick, and Mouse emulation
  • WiFi (Pico W, ESP32-based ESPHost, Atmel WINC1500)
  • Ethernet (Wired W5500, W5100, ENC28J60)
  • HTTP client and server (WebServer)
  • SSL/TLS/HTTPS
  • Over-the-Air (OTA) upgrades
  • Filesystems (LittleFS and SD/SDFS)
  • Multicore support (setup1() and loop1())
  • FreeRTOS SMP support
  • Overclocking and underclocking from the menus
  • digitalWrite/Read, shiftIn/Out, tone, analogWrite(PWM)/Read, temperature
  • Analog stereo audio in using DMA and the built-in ADC
  • Analog stereo audio out using PWM hardware
  • USB drive mode for data loggers (SingleFileDrive)
  • Peripherals: SPI master/slave, Wire(I2C) master/slave, dual UART, emulated EEPROM, I2S audio input/output, Servo
  • printf (i.e. debug) output over USB serial

The RP2040 PIO state machines (SMs) are used to generate jitter-free:

  • Servos
  • Tones
  • I2S Input
  • I2S Output
  • Software UARTs (Serial ports)

Installing via Arduino Boards Manager

Windows-specific Notes

Please do not use the Windows Store version of the actual Arduino application because it has issues detecting attached Pico boards. Use the "Windows ZIP" or plain "Windows" executable (EXE) download direct from https://arduino.cc. and allow it to install any device drivers it suggests. Otherwise the Pico board may not be detected. Also, if trying out the 2.0 beta Arduino please install the release 1.8 version beforehand to ensure needed device drivers are present. (See #20 for more details.)

Linux-specific Notes

Installing Arduino using flatpak (often used by "App Stores" in various Linux distributions) will mean it has restricted access to the host. This might cause uploads to fail with error messages such as the following:

Scanning for RP2040 devices
...
No drive to deploy.

If you encounter this, you will need to either install Arduino in a different manner, or override the flatpak sandboxing feature using the following command, then restarting Arduino.

flatpak override --user --filesystem=host:ro cc.arduino.IDE2

Installation

Open up the Arduino IDE and go to File->Preferences.

In the dialog that pops up, enter the following URL in the "Additional Boards Manager URLs" field:

https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json

image

Hit OK to close the dialog.

Go to Tools->Boards->Board Manager in the IDE

Type "pico" in the search box and select "Add":

image

Installing via GIT

Windows Users: Before installing via git on Windows, please read and follow the directions in this link. If Win32 long paths are not enabled, and git not configured to use them then there may be errors when attempting to clone the submodules.

To install via GIT (for latest and greatest versions):

mkdir -p ~/Arduino/hardware/pico
git clone https://github.com/earlephilhower/arduino-pico.git ~/Arduino/hardware/pico/rp2040
cd ~/Arduino/hardware/pico/rp2040
git submodule update --init
cd pico-sdk
git submodule update --init
cd ../tools
python3 ./get.py

Installing both Arduino and CMake

Tom's Hardware presented a very nice writeup on installing arduino-pico on both Windows and Linux, available at https://www.tomshardware.com/how-to/program-raspberry-pi-pico-with-arduino-ide

If you follow Les' step-by-step you will also have a fully functional CMake-based environment to build Pico apps on if you outgrow the Arduino ecosystem.

Uploading Sketches

To upload your first sketch, you will need to hold the BOOTSEL button down while plugging in the Pico to your computer. Then hit the upload button and the sketch should be transferred and start to run.

After the first upload, this should not be necessary as the arduino-pico core has auto-reset support. Select the appropriate serial port shown in the Arduino Tools->Port->Serial Port menu once (this setting will stick and does not need to be touched for multiple uploads). This selection allows the auto-reset tool to identify the proper device to reset. Them hit the upload button and your sketch should upload and run.

In some cases the Pico will encounter a hard hang and its USB port will not respond to the auto-reset request. Should this happen, just follow the initial procedure of holding the BOOTSEL button down while plugging in the Pico to enter the ROM bootloader.

Uploading Filesystem Images

The onboard flash filesystem for the Pico, LittleFS, lets you upload a filesystem image from the sketch directory for your sketch to use. Download the needed plugin from

To install, follow the directions in

For detailed usage information, please check the ESP8266 repo documentation (ignore SPIFFS related notes) available at

Uploading Sketches with Picoprobe

If you have built a Raspberry Pi Picoprobe, you can use OpenOCD to handle your sketch uploads and for debugging with GDB.

Under Windows a local admin user should be able to access the Picoprobe port automatically, but under Linux udev must be told about the device and to allow normal users access.

To set up user-level access to Picoprobes on Ubuntu (and other OSes which use udev):

echo 'SUBSYSTEMS=="usb", ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="0004", MODE="0666"' | sudo tee -a /etc/udev/rules.d/98-PicoProbe.rules
sudo udevadm control --reload
sudo udevadm trigger -w -s usb

The first line creates a device file in /dev matching the USB vendor and product ID of the Picoprobe, and it enables global read+write permissions. The second line causes udev to load this new rule. The third line requests the kernel generate "device change" events that will cause our new udev rule to run.

If for some reason the device file does not appear, manually unplug and re-plug the USB connection and check again. The output from dmesg can reveal useful diagnostics if the device file remains absent.

Once Picoprobe permissions are set up properly, then select the board "Raspberry Pi Pico (Picoprobe)" in the Tools menu and upload as normal.

Uploading Sketches with pico-debug

pico-debug differs from Picoprobe in that pico-debug is a virtual debug pod that runs side-by-side on the same RP2040 that you run your code on; so, you only need one RP2040 board instead of two. pico-debug also differs from Picoprobe in that pico-debug is standards-based; it uses the CMSIS-DAP protocol, which means even software not specially written for the Raspberry Pi Pico can support it. pico-debug uses OpenOCD to handle your sketch uploads, and debugging can be accomplished with CMSIS-DAP capable debuggers including GDB.

Under Windows and macOS, any user should be able to access pico-debug automatically, but under Linux udev must be told about the device and to allow normal users access.

To set up group-level access to all CMSIS-DAP adapters on Ubuntu (and other OSes which use udev):

echo 'ATTRS{product}=="*CMSIS-DAP*", MODE="664", GROUP="plugdev"' | sudo tee -a /etc/udev/rules.d/98-CMSIS-DAP.rules
sudo udevadm control --reload
sudo udevadm trigger -w -s usb

The first line creates a device file in /dev that matches all CMSIS-DAP adapters, and it enables read+write permissions for members of the plugdev group. The second line causes udev to load this new rule. The third line requests the kernel generate "device change" events that will cause our new udev rule to run.

If for some reason the device file does not appear, manually unplug and re-plug the USB connection and check again. The output from dmesg can reveal useful diagnostics if the device file remains absent.

Once CMSIS-DAP permissions are set up properly, then select the board "Raspberry Pi Pico (pico-debug)" in the Tools menu.

When first connecting the USB port to your PC, you must copy pico-debug-gimmecache.uf2 to the Pi Pico to load pico-debug into RAM; after this, upload as normal.

Debugging with Picoprobe/pico-debug, OpenOCD, and GDB

The installed tools include a version of OpenOCD (in the pqt-openocd directory) and GDB (in the pqt-gcc directory). These may be used to run GDB in an interactive window as documented in the Pico Getting Started manuals from the Raspberry Pi Foundation. For pico-debug, replace the raspberrypi-swd and picoprobe example OpenOCD arguments of "-f interface/raspberrypi-swd.cfg -f target/rp2040.cfg" or "-f interface/picoprobe.cfg -f target/rp2040.cfg" respectively in the Pico Getting Started manual with "-f board/pico-debug.cfg".

Licensing and Credits

  • The Arduino IDE and ArduinoCore-API are developed and maintained by the Arduino team. The IDE is licensed under GPL.
  • The RP2040 GCC-based toolchain is licensed under under the GPL.
  • The Pico-SDK is by Raspberry Pi (Trading) Ltd and licensed under the BSD 3-Clause license.
  • Arduino-Pico core files are licensed under the LGPL.
  • LittleFS library written by ARM Limited and released under the BSD 3-clause license.
  • UF2CONV.PY is by Microsoft Corporation and licensed under the MIT license.
  • Networking and filesystem code taken from the ESP8266 Arduino Core and licensed under the LGPL.
  • DHCP server for AP host mode from the Micropython Project, distributed under the MIT License.
  • FreeRTOS is copyright Amazon.com, Inc. or its affiliates, and distributed under the MIT license.
  • lwIP is (c) the Swedish Institute of Computer Science and licenced under the BSD license.
  • BearSSL library written by Thomas Pornin, is distributed under the MIT License.
  • UZLib is copyright (c) 2003 Joergen Ibsen and distributed under the zlib license.
  • LEAmDNS is copyright multiple authors and distributed under the MIT license.
  • http-parser is copyright Joyent, Inc. and other Node contributors.
  • WebServer code modified from the ESP32 WebServer and is copyright (c) 2015 Ivan Grokhotkov and others.
  • Xoshiro-cpp is copyright (c) 2020 Ryo Suzuki and distributed under the MIT license.
  • FatFS low-level filesystem code is Copyright (C) 2024, ChaN, all rights reserved.

-Earle F. Philhower, III
[email protected]

arduino-pico's People

Contributors

arya11111 avatar benjaminaigner avatar blurfl avatar djpearman avatar earlephilhower avatar flyrainning avatar guvwaf avatar hathach avatar hreintke avatar ing-dom avatar jandrassy avatar jlbirccyn avatar kattni avatar keever50 avatar khoih-prog avatar kholk avatar ladyada avatar leoli51 avatar linusheu avatar maxgerhardt avatar me-no-dev avatar noqman avatar nuclearphoenixx avatar paintyourdragon avatar palmerr23 avatar per1234 avatar pontuso avatar rlcamp avatar sabas1080 avatar upesy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-pico's Issues

List of Pico-Specific Functions?

This may be a silly question, since I am a novice with both arduino and pico. I can't seem to find the documentation on the functions and syntax used to control the pins on the pico.

Please could you direct me to the right place?

String(float) not implemented

Hi again,

my tft code has this line:

tft.print(String(mips));

which result in a linker error:

C:\Users\marcel\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\0.9.3\cores\rp2040\api/String.cpp:134: undefined reference to `dtostrf'

So apparently dtostrf.c.impl is not linked in. No urgency, I have coded around it.

Thanks again for your fantastic package!

Marcel

Auto mount turn off in Linux, can't flash - Fixed

Hello,
In my dev Linux Laptop I have the auto mounter disabled, so after the pico reset, I was unable to flash the pico.

I fixed my self that in uf2conv.py file in line: 361

From:

        else:
            drives = get_drives()

        if args.output:
            write_file(args.output, outbuf)

To:

        else:
            drives = get_drives()
            #automount turned off fix
            if len(drives) == 0:
                if sys.platform == "linux":
                    os.system('udisksctl mount --block-device /dev/$(ls -n /dev/disk/by-id/usb-RPI_RP2_*-part1 | tail -c 5)')
                    drives = get_drives()

        if args.output:
            write_file(args.output, outbuf)

Just a share a Improvement.

Thanks

Won't Install on Raspberry Pi

Trying to install using Board Manager (Arduino IDE 1.8.13) on a Raspberry Pi 4 4Gb using Raspberry Pi OS 32-bit, and get error "Tool pqt-gcc is not available for your operating system."

It installed, and so far works, with no problems in Linux Mint on another machine.

Windows 7 sometimes does not recognize the device as serial port

Windows 7 sometimes does not recognize the device as serial port, even after fresh reinstalling using BOOTSEL button. You still can upload sketch using BOOTSEL mode manually, but it requires disconnecting device each time. Simply, the issue disable easy upload and auto-restart feature.

There is "ArduinoPico" unrecognized device in the device manager list with ID: USB\VID_2E8A&PID_000A&REV_0100 or similar. I am using Arduino IDE 1.8.13. Using different USB port didn't help. Restarting the IDE didn't help. On Windows 10 the same board works without any problems.

I found solution to make it work also on Windows 7:
image
(from https://www.onetransistor.eu/2021/02/set-up-raspberry-pi-pico-for-microphyton.html , btw: I used "Install driver")

Tested on Windows 7 that had previously this issue. Maybe you can add it to README or somewhere?

For help The compilation project could not find the dma.h file

Arduino:1.8.10 (Windows 10), board:"Raspberry Pi Pico, 2MB (no FS), 125 MHz, Disabled, None"

sketch_apr13a:2:10: error: hardware/dma.h: No such file or directory
    2 | #include <hardware/dma.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.

exit status 1
hardware/dma.h: No such file or directory

Does not work with Arduino IDE 2.0

There is an issue woth Arduino IDE 2.0.
Versions would not go higher as 0.9.9

So I installed newest versions with the old Arduino IDE
installed version 0.9.18 works ok there but now the Pico
does not show up in the boards manager at all anymore in 2.0.

Do not know if it is a problem on your side or on the arduino side.....

CPU hangs when using pgm_read_word with an odd address

when running this code the CPU freezes after writing "word@1" to the serial port.

const PROGMEM unsigned char Config[] = { 0,1,2,3,4,5,6,7,8};
const unsigned char* ptr;


void setup() {
  Serial.begin(115200);
}

void loop() {
  delay(2500);
  ptr = &Config[0];
  Serial.print("word@0:");
  Serial.println(pgm_read_word(ptr));
  ptr = &Config[1];
  Serial.print("word@1:");
  Serial.println(pgm_read_word(ptr));
}

when changing
#define pgm_read_word(addr) (*(const unsigned short *)(addr))
to
#define pgm_read_word(addr) (pgm_read_byte(addr)+(pgm_read_byte(addr+1)<<8))

program works fine.

Maybe this is also an issue with

#define pgm_read_dword(addr)
#define pgm_read_float(addr)
#define pgm_read_ptr(addr) 

Board not being detected by the IDE

Hey, I've been pressing down the BOOTSEL button on boot and its still not recognizing my device

I've tried with multiple picos.

Yes, i have installed the module. I am on windows if that helps.

Sketch upload to serial port fails on Mac

Sketch upload to serial port fails on macos because the Arduino IDE uses the callout device "/dev/cu". Adding recognition of "/dev/cu" to uf2conv.py makes the sketch upload work.

        if str(args.serial).startswith("/dev/tty") or str(args.serial).startswith("COM")or str(args.serial).startswith("/dev/cu"):

Building with arduino-cli

Hello,

Thank you for taking the time to create this library! I am not sure if this is a bug or not, but I am attempting to build the standard blink sketch using Arduino-cli. I have added the board to the YAML configuration file, and inside Arduino IDE I can compile and upload the sketch just fine.

However, using the latest version of Arduino-cli I am getting the following error, which I am not sure how to fix.

`joachimhaagenskeie@Joachims-MacBook-Pro b989c882d2b % arduino-cli compile -e -b rp2040:rp2040:rpipico /Users/joachimhaagenskeie/src/arduinocli/b989c882d2b/b989c882d2b.ino
/Users/joachimhaagenskeie/Library/Arduino15/packages/rp2040/hardware/rp2040/0.9.5/cores/rp2040/main.cpp: In function 'int main()':
/Users/joachimhaagenskeie/Library/Arduino15/packages/rp2040/hardware/rp2040/0.9.5/cores/rp2040/main.cpp:27:5: error: 'DEBUG_RP2040_PORT' was not declared in this scope
27 | DEBUG_RP2040_PORT.begin();
| ^~~~~~~~~~~~~~~~~
/Users/joachimhaagenskeie/Library/Arduino15/packages/rp2040/hardware/rp2040/0.9.5/cores/rp2040/main.cpp: In function 'ssize_t _write(int, const void*, size_t)':
/Users/joachimhaagenskeie/Library/Arduino15/packages/rp2040/hardware/rp2040/0.9.5/cores/rp2040/main.cpp:62:12: error: 'DEBUG_RP2040_PORT' was not declared in this scope
62 | return DEBUG_RP2040_PORT.write((const char *)buf, count);
| ^~~~~~~~~~~~~~~~~

Error during build: exit status 1`

Adafruit_ILI9341 does not compile

Hi,

I use Adafruit_ILI9341 to drive a 9341 LCD display in my Data General Nova simulator.

https://github.com/marcelvanherk/nova1200-restoration
(folder teensy_nova)

I have successfully compiled this for the pico with your platform (with a few changes) but:

#include "Adafruit_ILI9341.h"

(latest version as well as dependencies) reports:

C:\Users\marcel\Documents\Arduino\libraries\Adafruit_ILI9341\Adafruit_ILI9341.cpp:53:10: fatal error: wiring_private.h: No such file or directory
53 | #include "wiring_private.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.

could this be made to work on the pico?

Marcel

User with space not working

On windows I was dumb and have a user with a space in the name and now the file is going to the wrong place. Im sure the package is there
image

No /media mount point

It would appear the mount point for the pico is hardcoded to be "/media". In Manjaro(Arch) usb mount points are in "/run/media". The simple solution is to create a link "/run/media -> /media", works but should be fixed.

Anyway thanks for doing this.

Error uploading: No drive to deploy

My application compiles successfully, apart from five warnings:

/Users/david/Library/Arduino15/packages/rp2040/tools/pqt-gcc/1.0.1-base-3a57aed/bin/../lib/gcc/arm-none-eabi/
10.2.0/../../../../arm-none-eabi/bin/ld: warning: changing start of section .bss by 4 bytes

But then the upload fails with:

Converting to uf2, output size: 516096, start address: 0x2000
No drive to deploy.
An error occurred while uploading the sketch

I was able to successfully upload your Fade example. Any suggestions?

EEPROM does not work

Hi,

I managed to compile my Data General Nova simulator with your platform (without tft support). Impressive work! However, EEPROM does not work. I then compiled you eeprom write test, which reports a "failed to commit".

Marcel

Opening a console window on the port does not reset

If I open a console window on the serial port for the pico, it does not reset the pico like it does for Arduino boards. Is this the expected behavior? Is there any way to make it auto reset when the port is opened?

Also, you might note in your readme file that if the first sketch you upload does NOT contain a Serial.begin call, the pico port will not show up.

Thanks.

U2conv.py on Win fails if volume names have non-ASCII chars

Hi
No problem with Ubuntu, works great !! Thanks !!

On Windows10 I got u2conv.py error when i try to flash Pico Py board
Windows 10 French
Arduino IDE 1.8.13
Raspberry Pi Pico core version 1.0.1
Same error with Fade or any other example code
Error message :

Resetting COM8
Traceback (most recent call last):
Une erreur est survenue lors du transfert du croquis
  File "C:\Users\Lenovo\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\1.0.1/tools/uf2conv.py", line 368, in <module>
Converting to uf2, output size: 439296, start address: 0x2000
    main()
  File "C:\Users\Lenovo\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\1.0.1/tools/uf2conv.py", line 355, in main
    drives = get_drives()
  File "C:\Users\Lenovo\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\1.0.1/tools/uf2conv.py", line 233, in get_drives
    for line in to_str(r).split('\n'):
  File "C:\Users\Lenovo\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\1.0.1/tools/uf2conv.py", line 225, in to_str
    return b.decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe6 in position 225: invalid continuation `byte`

Best Regards

headfile include fail

When I try to use the third-part library, it shows errors as below:

In file included from /Users/mac/Documents/Arduino/pico_main/pico_main.ino:6:
/Users/mac/Documents/Arduino/libraries/WiFiEsp/src/WiFiEsp.h:23:10: fatal error: Stream.h: No such file or directory
   23 | #include <Stream.h>
      |          ^~~~~~~~~~
compilation terminated.
exit status 1

zero-byte writes in arduino Wire must be handled by bitbanging

a common thing done in arduino libraries is performing a zero-byte-write, like this
https://github.com/arduino-libraries/ArduinoECCX08/blob/master/src/ECCX08.cpp#L440
or in address scanning/checking

the RP2040 I2C peripheral does not permit that, so for writes of 0 bytes, it must be bitbanged, we've done so in CircuitPython and MicroPython does the same

right now, because of this bug, a lot of libraries (including a lot of Adafruit ones) will not work, they will fail on the address detection step!

(cc @sandeepmistry in case Arduino's core needs it too)

Compile problem with pico

Hi,
I follow the step and meet a compile bug:

c:/users/30477/documents/arduinodata/packages/rp2040/tools/pqt-gcc/1.0.1-base-3a57aed/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld.exe: warning: changing start of section .rodata by 4 bytes

I only test a gpio demo. How to solve this issue?

Change CPU clock don't work

Hello,
using the function set_sys_clock_khz() without the include of "pico/stdlib.h", report missing function...
But the include is set in platform.txt: "-I{runtime.platform.path}/pico-sdk/src/common/pico_stdlib/include"
if I add the include "pico/stdlib.h", I get multiples errors in linking: multiple definition of _write && multiple definition of _read from stdio.c:(.text._write+0x0):

As I can fix that?

Thanks

ISO C++ forbids converting a string constant to 'char*'

I don't know if this is a bug, or if you have done it by the book when no one else does, but I get a warning when using string arrays.

This is the example sketch from https://www.arduino.cc/reference/en/language/variables/data-types/string/ :

char *myStrings[] = {"This is string 1", "This is string 2", "This is string 3",
"This is string 4", "This is string 5", "This is string 6"
};

void setup() {
Serial.begin(9600);
}

void loop() {
for (int i = 0; i < 6; i++) {
Serial.println(myStrings[i]);
delay(500);
}
}

Compiling it produces a list of warnings like this:
/home/pi/Arduino/sketch_apr05a/sketch_apr05a.ino:1:22: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings]
1 | char myStrings[] = {"This is string 1", "This is string 2", "This is string 3",
| ^~~~~~~~~~~~~~~~~~

It does upload and run though. I've tried compiling it for Arduino, ESP-32 and Seeeduino SAMD boards, and none of them produce a warning.

LittleFS format() hangs with flash size > 2MB

Trying out LittleFS/SpeedTest on a Feather, the program never returns from format(). Changing the board type to "Generic RP2040 Flash Size 2MB with Boot Stage 2: W25X10CL QSPI /4" works as expected, but upping to Flash Size 4MB fails.

Add I2S input (microphones, etc.)

Good to see the I2S output happening...

FYI

The Microcenter Stores cleared out the original Google Voice Kits for $2.99, if you know anyone with one, the I2S mic. (SPH0645LM4H-B) pair connector is:

Blk Gnd
Grn I2S DIN
Wht I2S BCLK
Blu I2S LRCLK
Red 3.3V

How to use multicore_launch_core1();

Hello @earlephilhower

Great work you are doing here, really appreciated.
I am just starting with the Pico and I guess I make a stupid mistake.
In the Pico Examples is some code how to use the multicore functions.
But when I try to #include "pico/multicore.h" compilation fails with file not found. Am I missing something?

If it is not yet implemented here, that is ok, I can wait (or try to implement and do a PR). Just wanted to know before I put time into it.

Still required to set a serial port?

There is automated discovery of boards in bootloader mode, so they show up in the IDE, and the upload command works using the Microsoft UF2 tool (included).

I was still required to set a serial port before uploading code to the board? Upload proceeded by copying a UF2s expected after I'd done that (it works!), but having to set a serial port is going to be pretty confusing, and some users may not have any serial port options offered to them so will be unable to proceed?

overflow in call to pwm_config_set_clkdiv in analogWrite

I believe you have a bug in setting the clock divider for the PWM. I think you meant to divide the clock hz by the product of the analogFreq and analogScale, but instead it is multiplying it and it is overflowing:

extern "C" void analogWrite(pin_size_t pin, int val) {
    if (!pwmInitted) {
        pwm_config c = pwm_get_default_config();
        pwm_config_set_clkdiv( &c, clock_get_hz(clk_sys) / 1.0 * (analogScale * analogFreq));
        pwm_config_set_wrap( &c, analogScale );
        for (int i=0; i<30; i++) {
            pwm_init(pwm_gpio_to_slice_num(i), &c, true);
        }
        pwmInitted = true;
    }

Adafruit OLED/TFT libraries don't compile

Adafruit_SSD1306 and Adafruit_ST7735 (the included TFT library) to be exact.

hi, I'm trying to experiment around with some displays on the Pico, but i'm just hitting a brickwall. here is the code for both programs: OLED, TFT

using the Adafruit_SSD1306 Library i'm getting this error:

C:\Users\x\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp: In member function 'bool Adafruit_SSD1306::begin(uint8_t, uint8_t, bool, bool)':
C:\Users\x\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:495:44: error: 'digitalPinToPort' was not declared in this scope; did you mean 'digitalPinToInterrupt'?
  495 |     dcPort = (PortReg *)portOutputRegister(digitalPinToPort(dcPin));
      |                                            ^~~~~~~~~~~~~~~~
      |                                            digitalPinToInterrupt
C:\Users\x\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:495:25: error: 'portOutputRegister' was not declared in this scope
  495 |     dcPort = (PortReg *)portOutputRegister(digitalPinToPort(dcPin));
      |                         ^~~~~~~~~~~~~~~~~~
C:\Users\x\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:496:17: error: 'digitalPinToBitMask' was not declared in this scope
  496 |     dcPinMask = digitalPinToBitMask(dcPin);
      |                 ^~~~~~~~~~~~~~~~~~~
exit status 1
Error compiling for board Raspberry Pi Pico.

with the other Library it was a bit more complicated.

at first i was getting this error:

In file included from C:\Users\oskar\Documents\Arduino\libraries\TFT\src/TFT.h:37,
                 from C:\Users\oskar\Documents\Arduino\Programs\TFT_Testing\TFT_Testing.ino:1:
C:\Users\x\Documents\Arduino\libraries\TFT\src/utility/Adafruit_ST7735.h:30:10: fatal error: avr\pgmspace.h: No such file or directory
   30 | #include <avr\pgmspace.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Raspberry Pi Pico.

after a bit of googling i found some dummy header files in an AVR folder that i was able to just throw into cores\RP2040 and that seem to have worked. Link to SO thread
so the next error i got after that was:

C:\Users\x\Documents\Arduino\libraries\TFT\src\utility\glcdfont.c:3:10: fatal error: avr/io.h: No such file or directory
    3 | #include <avr/io.h>
      |          ^~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Raspberry Pi Pico.

which was caused by this piece of code:

#if !defined(ARDUINO_ARCH_SAM) && !defined(__ARDUINO_ARC__) && \
    !defined(ARDUINO_ARCH_STM32)
#include <avr/io.h>
#endif

it seems to only include avr/io.h if the MCU used is not a 32 bit ARM one... so i just commented the whole thing out and hope it won't cause an issue later on.
now the current error i'm getting is pretty much the same as for the OLED Library.

C:\Users\x\Documents\Arduino\libraries\TFT\src\utility\Adafruit_ST7735.cpp: In member function 'void Adafruit_ST7735::commonInit(const uint8_t*)':
C:\Users\x\Documents\Arduino\libraries\TFT\src\utility\Adafruit_ST7735.cpp:349:34: error: 'digitalPinToPort' was not declared in this scope; did you mean 'digitalPinToInterrupt'?
  349 |   csport    = portOutputRegister(digitalPinToPort(_cs));
      |                                  ^~~~~~~~~~~~~~~~
      |                                  digitalPinToInterrupt
C:\Users\x\Documents\Arduino\libraries\TFT\src\utility\Adafruit_ST7735.cpp:349:15: error: 'portOutputRegister' was not declared in this scope
  349 |   csport    = portOutputRegister(digitalPinToPort(_cs));
      |               ^~~~~~~~~~~~~~~~~~
C:\Users\x\Documents\Arduino\libraries\TFT\src\utility\Adafruit_ST7735.cpp:350:15: error: 'digitalPinToBitMask' was not declared in this scope
  350 |   cspinmask = digitalPinToBitMask(_cs);
      |               ^~~~~~~~~~~~~~~~~~~
exit status 1
Error compiling for board Raspberry Pi Pico.

i think i documented everything i did, but in case i missed something i can hopefully provide more detail.

NOT_AN_INTERRUPT not #defined

I have a 3rd party library that checks whether digitalPinToInterrupt() returns NOT_AN_INTERRUPT, which isn't defined in this core.

Clearly, all Pico pins are interrupt-capable, but it would still be useful to have this #defined. The AVR core #defines it in Arduino.h as (-1).

I have hacked the library as a workaround so there is no rush for a solution.

If this is an unsurmountable problem, I can ask the library author to handle the Pico as a special case.

Thanks.

Default pins for Serial/SPI/I2C not set properly

I was having issues getting any i2c sensor to work so after a lot of testing and searching i came across this issue witch is unrelated but did help me https://github.com/earlephilhower/arduino-pico/issues/38#issuecomment-808835731 the tester that was pointed out also did not work.

no i saw that PICO_DEFAULT_I2C_SCL_PIN and PICO_DEFAULT_I2C_SDA_PIN ar defined but when correctly connected it does not work.

i fixed this by setting the pins at the beginring of my program
Wire.setSCL(PICO_DEFAULT_I2C_SCL_PIN);//gp5 Wire.setSDA(PICO_DEFAULT_I2C_SDA_PIN);//gp4

now i don't know if this is an issue but seeing that they are defined you would expect it to use them if not explicitly told to use different pins right? I figured i would let you know.

Does this work on MacOS?

Running Arduino 1.8.13 on MacOS Catalina 10.15.7 I search for pico in the Library Manager and it does not find anything to install.

Upload of a substantial program crashes the Arduino IDE

I've now successfully uploaded small programs, such as Blink, and a Serial test. But when I upload a more substantial program of about 80Kbytes when compiled (my uLisp Lisp interpreter) it seems to crash the Arduino IDE on my Mac in a way that even a Force-Quit doesn't fix, and I have to restart my Mac to continue. So this is making further progress a bit slow.

Any suggestions?

Compile Error for attachinterrupt()

I assume the attachInterrupt() function has not yet been added, it would be great if you add it, as interrupts using micro python are really slow and thanks a lot for this repo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.