earlephilhower / arduino-pico Goto Github PK
View Code? Open in Web Editor NEWRaspberry Pi Pico Arduino core, for all RP2040 boards
License: GNU Lesser General Public License v2.1
Raspberry Pi Pico Arduino core, for all RP2040 boards
License: GNU Lesser General Public License v2.1
Hello,
In some future day is possible to add the free/occupied resources at the end of the compiler console ?
Thank you
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.
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.
The Pi Pico doesn't seem to run at a clock higher than 250 MHz.
Systems used for testing the Arduino IDE 1.8.13 and Pi Pico version 0.9.14
Thank you
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.
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
Maybe im just not trying hard enough but Serial.print("A") with Serial.begin(9600) isn't working. Maybe add an example to show users how.
It looks like a great tool for the pico but there is no support for hid
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
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.
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?
Hello,
It works fine in 1.8.* IDE, but in 2.0.beta the board is not detected in BOOTSEL mode.
Is it possible to set SPI clock speed for SD card usage?
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.
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)
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
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.
Hi,
I want to use pico and mic, does this support I2S now? Or any plan in the future?
Thanks
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
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?
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)
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.
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.
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.
Is there an example of using NeoPixels? The Adafruit library doesn't seem to work.
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.
can you please come up with an update for taking more than one interrupts on the same core.
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?
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.
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
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:
(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?
Hi,
I would appreciate if you'll support Adafruit Feather RP2040 which has 8MB flash.
I've found in the code where it says that the pico has only 2048k flash, but I don't know if changing this to 8096k will make it work.
Thanks
Yoram
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`
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
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;
}
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
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?
well, the title.
$ pwd;ls
~/Arduino/hardware/pico/rp2040/system
placeholder
$ cat placeholder
placeholder
cant find the ./get.py
Sorry for abusing the issue tracker
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
Timer library that allows the management of repeating timers.
Hello,
Is it possible to add WMath.cpp (https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/WMath.cpp) to this Arduino-pico core, so that the random functions are also available to use?
Is it simply an issue of adding the WMath.cpp file in the correct directory, or is there more work involved?
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.....
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?
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
Hello Earle,
your codebase looks really great. Do you have a plan to adjust it for Platformio? i.e. adding board definition and platformio-specific packages/platforms?
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.
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"):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.