Arduino framework not having analogWriteFreq function

Hi there,

I don’t know if it is the right topic but I need help. I am working with the raspberry pi pico and wanted to use the function analogWriteFreq() but it seems it isn’t defined in the Arduino.h despite the arduino ide having that built-in function.

I tried to use the rp2040_pwm but it didn’t change the frequency of PWM.

Are we talking GitHub - arduino/ArduinoCore-mbed or GitHub - earlephilhower/arduino-pico: Raspberry Pi Pico Arduino core, for all RP2040 boards?

With PlatformIO, you by-default get the ArduinoCore-mbed core for Raspberry Pi Pico. If you are using Arduino-Pico in the Arduino, you are totally mis-matching it with what PlatformIO uses.

You can use this PR to also make PlatformIO use Arduino-Pico. E.g., overwrite your platformio.ini with

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico
framework = arduino
board_build.core = earlephilhower
board_build.filesystem_size = 0.5m

and retry.

I couldn’t do that: the last error that appears is the following:

Error: VCS: Could not process command ['git', 'clone', '--recursive', 'https://github.com/earlephilhower/arduino-pico.git', 'C:\\Users\\Tiago\\.platformio\\.cache\\tmp\\pkg-installing-3c7bun1m']

I was using (previously) this configuration for platformio.ini:

[env]
platform = raspberrypi
framework = arduino

[env:pico]
board = pico
board_build.mcu = rp2040
board_build.f_cpu = 133000000L
monitor_echo = yes
monitor_filters = send_on_enter
lib_deps = 
	khoih-prog/RP2040_PWM@^1.7.0
	ricaun/ArduinoUniqueID@^1.3.0

Do you have git installed? Git - Downloads

If yes, you might have the same problem with Win32 long paths and git long paths as this person

I have GIT installed, I followed the steps in the link but I have the same problem, it fails on the last 3 libs.

fatal: unable to access 'https://github.com/hathach/tinyusb.git/': Could not resolve host: github.com
fatal: clone of 'https://github.com/hathach/tinyusb.git' into submodule path 'C:/Users/Tiago/.platformio/.cache/tmp/pkg-installing-y1ba5ryt/pico-sdk/lib/tinyusb' failed
Failed to clone 'lib/tinyusb'. Retry scheduled

Cloning into 'C:/Users/Tiago/.platformio/.cache/tmp/pkg-installing-y1ba5ryt/pico-sdk/lib/tinyusb'...
fatal: unable to access 'https://github.com/hathach/tinyusb.git/': Could not resolve host: github.com
fatal: clone of 'https://github.com/hathach/tinyusb.git' into submodule path 'C:/Users/Tiago/.platformio/.cache/tmp/pkg-installing-y1ba5ryt/pico-sdk/lib/tinyusb' failed
Failed to clone 'lib/tinyusb' a second time, aborting

Submodule path 'tools/libbearssl/bearssl': checked out 'f294aa022f82833941ffdf3b0f306c2072e3a26c'
Submodule path 'tools/pyserial': checked out '0e7634747568547b8a7f9fd0c48ed74f16af4b23'
fatal: Failed to recurse into submodule path 'pico-sdk'
Error: VCS: Could not process command ['git', 'clone', '--recursive', 'https://github.com/earlephilhower/arduino-pico.git', 'C:\\Users\\Tiago\\.platformio\\.cache\\tmp\\pkg-installing-y1ba5ryt']

Git: Could not resolve host github.com error while cloning remote repository in git - Stack Overflow?

For example, it seems that I cannot install submodule hidapi:

Submodule 'hidapi' (https://github.com/signal11/hidapi) registered for path 'pico-sdk/lib/tinyusb/tools/uf2/hidapi'

Cloning into 'C:/Users/Tiago/.platformio/.cache/tmp/pkg-installing-xfghmzwz/pico-sdk/lib/tinyusb/tools/uf2/hidapi'...

Submodule path 'pico-sdk/lib/tinyusb/tools/uf2/hidapi': checked out 'a6a622ffb680c55da0de787ff93b80280498330f'
fatal: Unable to checkout '17761f5cf9dbbf2dcf665b7c04934188add20082' in submodule path 'pico-sdk/lib/tinyusb/hw/mcu/wch/ch32v307'

But if I open any terminal (wsl,cmd,git) i can clone it withou problem.
The fix of that link didn’t solve anything.
Thanks for the help though!

Sorry, no idea why the clone won’t work.

Update: forgot to add the git line when trying to solve the filenames too long problem, it all works now.

Thank you so much!