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
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s2-saola-1.html
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)
PACKAGES:
- 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
Collecting cryptography<35.0.0,>=2.1.4
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
Collecting future>=0.15.2
Using cached https://files.pythonhosted.org/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz
Collecting pyparsing<2.4.0,>=2.0.3
Using cached https://files.pythonhosted.org/packages/de/0a/001be530836743d8be6c2d85069f46fecf84ac6c18c7f5fb8125ee11d854/pyparsing-2.3.1-py2.py3-none-any.whl
Collecting kconfiglib==13.7.1
Using cached https://files.pythonhosted.org/packages/2a/a2/a046c1fd8f83c611d8610f2188b66ac3fdf0b64ca0b2b47563e9446d0031/kconfiglib-13.7.1-py2.py3-none-any.whl
Collecting cffi>=1.12
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
Collecting pycparser
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
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/esp32-s2-saola-1/src/main.o
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
*
*****************************************************************
#include "tinyusb.h"
^~~~~~~~~~~
compilation terminated.
Generating project linker script .pio/build/esp32-s2-saola-1/esp32s2.project.ld
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?
This is the content:
#!/home/djpx/.platformio/penv/bin/python
# -- coding: utf-8 --
import re
import sys
from platformio.main import main
if name == âmainâ:
sys.argv[0] = re.sub(râ(-script.pyw|.exe)?$â, ââ, sys.argv[0])
sys.exit(main())
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?
Sorry I over looked the pip3 list | grep plat command the output is:
platformdirs 2.4.0
platformio 5.2.3
And 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 pip3 program.
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)
Use the CLI to check that pio system info now returns a PlatformIO Core Executable within /home/djpx/.platformio.
Execute a 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 docs.
And regarding
Using the 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
Copy the 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_ENABLED and 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â.
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.
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.
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.