November 17, 2021, 12:55pm
Hello Community I bought an RSP32S2 devboard and would like to use it with PlatformIO. Since there is no Ardoino Support currently I decided to try the Espress IDF. Which worked for the first test programm too. Now I tryed to load the USB example but it can not comple due to a permission error (I guess phyton?) which prevents PlatformIO to install the TinyUSB dependency.
This is the code which I am using: https://github.com/espressif/esp-idf/blob/master/examples/peripherals/usb/tusb_serial_device/main/tusb_serial_device_main.c
This is my error which I get while trying:
Executing task: platformio run --environment esp32-s2-saola-1 <
Processing esp32-s2-saola-1 (platform: espressif32; board: esp32-s2-saola-1; framework: espidf)
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Espressif 32 (3.4.0) > Espressif ESP32-S2-Saola-1
HARDWARE: ESP32S2 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
- framework-espidf 3.40301.0 (4.3.1)
- tool-cmake 3.16.4
- tool-esptoolpy 1.30100.210531 (3.1.0)
- tool-ninja 1.7.1
- toolchain-esp32s2ulp 1.22851.191205 (2.28.51)
- toolchain-riscv32-esp 8.4.0+2021r1
- toolchain-xtensa-esp32s2 8.4.0+2021r1
Installing ESP-IDF's Python dependencies
Using cached https://files.pythonhosted.org/packages/96/07/4d23f8e34e56d8eeb2c37cd5924928a01c3dd756a1d99e470181bc57551e/cryptography-3.4.8-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Using cached https://files.pythonhosted.org/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz
Using cached https://files.pythonhosted.org/packages/de/0a/001be530836743d8be6c2d85069f46fecf84ac6c18c7f5fb8125ee11d854/pyparsing-2.3.1-py2.py3-none-any.whl
Using cached https://files.pythonhosted.org/packages/2a/a2/a046c1fd8f83c611d8610f2188b66ac3fdf0b64ca0b2b47563e9446d0031/kconfiglib-13.7.1-py2.py3-none-any.whl
Using cached https://files.pythonhosted.org/packages/e5/fe/1dac7533ddb73767df8ba26183a9375dde2ee136aec7c92c9fb3038108e3/cffi-1.15.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Using cached https://files.pythonhosted.org/packages/62/d5/5f610ebe421e85889f2e55e33b7f9a6795bd982198517d912eb1c76e1a53/pycparser-2.21-py2.py3-none-any.whl
Installing collected packages: pycparser, cffi, cryptography, future, pyparsing, kconfiglib
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Keine Berechtigung: '/usr/local/lib/python3.8/site-packages/pycparser-2.21.dist-info'
Consider using the `--user` option or check the permissions.
*** Error 1
Reading CMake configuration...
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Building in release mode
src/main.cpp:203:10: fatal error: tinyusb.h: No such file or directory
* Looking for tinyusb.h dependency? Check our library registry!
* CLI > platformio lib search "header:tinyusb.h"
* Web > https://platformio.org/lib/search?query=header:tinyusb.h
Generating project linker script .pio/build/esp32-s2-saola-1/esp32s2.project.ld
How can I fix that problem?
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Keine Berechtigung: ‘/usr/local/lib/python3.8/site-packages/pycparser-2.21.dist-info’
Consider using the
--user option or check the permissions.
PlatformIO should not attempt to install a Python package in the global Python packages site, but in its own isolated Python environment (e.g.
~/.platformio/penv/Lib/site-packages). Did you install PlatformIO
globally via e.g.
sudo -H pip3 install platformio or did you use the recommended
installer script and appended your PATH as is recommended since it gives you the isolated envrionment?
What is the output of
pio system info in a
November 17, 2021, 1:43pm
I installed PlatformIO as Visual Studio Code extension. So I didn´t had to do anything else. Do I need to change something there?
This is my output of the pio system info command:
PlatformIO Core 5.2.3
System Type linux_x86_64
File System Encoding utf-8
Locale Encoding UTF-8
PlatformIO Core Directory /home/djpx/.platformio
PlatformIO Core Executable /usr/local/bin/platformio
Python Executable /usr/bin/python3
Global Libraries 0
Development Platforms 3
Tools & Toolchains 24
It is clearly installed globally since that is not in
~/.platformio. When you do
cd ~/.platformio and
find . -name "pio", what does that return?
November 17, 2021, 1:47pm
It only returns this:
This is the content:
# - - coding: utf-8 --
from platformio. main import main
if name == ‘ main’:
sys.argv = re.sub(r’(-script.pyw|.exe)?$’, ‘’, sys.argv)
The PlatformIO installer does not create
~/usr/local/bin/platformio, it must come from another installation method. What does
sudo dpkg list | grep plat and
apt list --installed | grep plat and
pip3 list | grep plat output?
November 17, 2021, 2:04pm
Sorry that you had to wait i can not execute that command since I am on a fedora system. So I am not able to use the dpkg command
Then use either
dnf list installed | grep plat or
rpm -qa | grep plat.
November 17, 2021, 2:11pm
It seems it only finds the KDE platform
First command: kde-platform-plugin.x86_64
Secound command: kde-platform-plugin-4.11.22-27.fc32.x86_64
Well, last try, what does
rpm -qf /usr/local/bin/platformio output?
pip3 command returend nothing?
November 17, 2021, 2:28pm
Sorry I over looked the
pip3 list | grep plat command the output is:
rpm -qf /usr/local/bin/platformio returned:
The file /usr/local/bin/platformio does not belong to a package
( I translated that since it was in my mainlanguage
Aha so it
was installed via the global
It’s highly not-recommended to do that – you should do the following
Go to the VSCode PlatformIO extension settings and make sure the checkboxes “Use Builtin PIOCore” is
on, “Use Builtin Python” is on
Uninstall your global PlatformIO installion (
/usr/local/bin/platformio) – try
sudo -H pip3 uninstall platformio or
pip3 uninstall platformio
Restart VSCode and check if you can still compile basic projects (builtin core is working)
CLI to check that
pio system info now returns a
PlatformIO Core Executable within
pio platform update espressif32 while you’re at it to update the Espressif 32 platform.
Check if that makes the “Could not install packages” error disappear now that it’s using the builtin-Python and builtin-core
If you want PlatformIO to be globally accessible from the CLI, see
master branch is generally incorrect since PlatformIO may use a different version. Per
releases, the latest platform-espressif32 uses ESP-IDF 4.3.1 – you must use the same, which is esp-idf/tusb_serial_device_main.c at v4.3.1 · espressif/esp-idf · GitHub
Further it is most critical that the
sdkconfig is correct. The project commands
to be set. Make sure you either
sdkconfig.defaults file inside the PlatformIO project, delete the old
sdkconfig.<environment name> file and re-run compilation to regenerate the
sdkconfig.<environment name> from the defaults file
or, use menuconfig to search and enable the
CONFIG_USB_CDC_ENABLED oiptions –
CONFIG_IDF_TARGET should be set up automatically.
This should take care of the compilation error “
tinyusb.h not found”.
November 17, 2021, 2:39pm
Should I do a backup before I do that or does it not touch my project files?
Well if your project files are exactly just the ESP-IDF example (
esp-idf/examples/peripherals/usb/tusb_serial_device at v4.3.1 · espressif/esp-idf · GitHub), the no need to backup – everything is online. If you have already added custom code, you can ofc do a backup.
There should be no need to backup anything (e.g.
~./platformio/) as it can be reinstalled from scratch at anytime, and no personal data is stored therein.
November 17, 2021, 3:09pm
I got already alot projects with the ESP8266 and ESP32 which I don´t like to lose since I spend alot time on them. So I am currently doing an update on all of the just to be sure.
If you did no custom changes to files within
~/.platformio, everything is recoverable. In fact, the extension is programmed to recover from a completely deleted
~/.platformio folder through automatic reinstallation as if it were nothing.
November 17, 2021, 4:27pm
Thank you alot. It seems to compile now and i finally can do some testing when I assemble the USB-port on my ESP32S2.
Are you interessted in steams games or some Avast BreachGuard/Avast AntiTrack Premium I still have them here unused and would like give it to you if you are interested as thank you for your time.