I have been trying to upload the famous Blink routine to my ESP32. The procedure has been successfully compiled but every time I try to upload the compiled code I receive the error "Serial port not selected"
The port option in Tools is greyed out. My user account belongs to dialout, tty, plugdev all groups for which it is suggested membership is essential to access serial ports.
I noticed that using dmesg showed that the ESP32 did in fact connect to the USB port but then immediately disconnected:
johnb@mac-mini:~$ dmesg | tail -f
[18902.614086] usb 1-1: New USB device found, idVendor=10c4, idProduct=ea60, bcdDevice= 1.00
[18902.614092] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[18902.614095] usb 1-1: Product: CP2102 USB to UART Bridge Controller
[18902.614098] usb 1-1: Manufacturer: Silicon Labs
[18902.614101] usb 1-1: SerialNumber: 0001
[18902.629088] cp210x 1-1:1.0: cp210x converter detected
[18902.631171] usb 1-1: cp210x converter now attached to ttyUSB0
[18905.015392] usb 1-1: usbfs: interface 0 claimed by cp210x while 'brltty' sets config #1
[18905.016347] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[18905.016394] cp210x 1-1:1.0: device disconnected
t makes no difference whether I connect to the pc usb port directly or via a powered usb hub, the report is the same just the port ID changes.
Any ideas??
John B
This may be wide of the mark, but I found a post elsewhere that suggested a possible clash with VirtualBox. Are you running VirtualBox or anything similar?
Aaaaah! Now that is interesting! I set up VirtualBox just a few days ago on the Mac-Mini. I use Linux Mint (LMDE40) instead of MacOS and I had been unable to get software to run two scanners in Linux and so I setup VirtualBox to run Windows so that I could use the scanners. And yes there is a problem with connecting to the USB ports although not so difficult to overcome .
After I posted I tried connecting the ESP32 to a Raspberry Pi and the connection was stable. So I was beginning to think the Mini might have some esoteric hardware configuration.
Yours is much less of a stretch for the imagination. A quick purge of VirtualBox......
Thanks for the suggestion Yurkshirelad. I will let you know how it goes.
John B
I found that Virtualbox and ESP32 IDF or VSCode were not compatible. If you have the ESP32 setup right on Linux Mint 20 or Ubuntu 20.04, you have to install python-is-python3. If you try to install Virtualbox it forces you to uninstall python-is-python3. the esptool.py use pyserial.py and they have to run with python3.
At least this is what was explained to me. And I got it working by doing this. I wanted to use Virtualbox to put my Arduino in one VM and VSCode in another VM. I also had to install the Espressif IDE so I could build CircuitPython with some special menuconfig options. All of that screwed up Arduino.
So I ended up using 2 different computers instead of VMs. I have a Raspberry Pi 4 so I can run Arduino setup of everything except ESP32. I also have it setup with another SSD to run VSCode with Pico SDK which is not compatible with PlatformIO, at least I've not been successful having both on the same system.
What I do is setup a Raspberry Pi 4 with just what I need to do a task and then save that image with free space removed. That image can be restored using Raspberry Pi Imager.
If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.
Another option for running VMs under Linux is https://www.linux-kvm.org/page/Main_Page, but I'm not sure if it would solve the original USB problem.
Progress so far: removed/purged VirtualBox from system (LMDE 4 on Mac-Mini) . Arduino IDE still does not see USB connection and dmesg still showing esp32 connecting and then disconnecting.
@b89john I went and looked for how I got things working last time and I found a recipe that I saved so I cold repeat it if necessary. This was a file saved with my Arduino stuff.
Stuff to add to a new system to get Arduino running for Ubuntu 20.04 based systems.
1. sudo usermod -aG dialout jim
2. sudo apt install python-is-python3
3. sudo apt-mark hold python2 python2-minimal python2.7 python2.7-minimal libpython2-stdlib
4. sudo apt install python3-pip
5. pip3 install pyserial
Once this was done I could install Arduino IDE and then just add the link for ESP32 via board manager.
If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.
SUCCESS!!
The solution might be a little drastic but I really didn't feel like doing the homework to sort out the path and group issues that seemed to underpin the connection to the USB bus. I installed Linux Mint 20 which is based on Ubuntu rather than pure Debian.
I then paid attention to Bill's Arduino IDE install instructions in his YouTube videos "Build a Developer's Linux Workstation" and for the ESP32: "ESP32 Getting Started". Lo and behold 'Port' in the Arduino IDE tools is no longer greyed out and /dev/ttyUSB0 can be selected. Euphoria!
Tried to compile the ubiquitous 'blink' sketch - failed because it couldn't find "Python". So I followed each of Jim's "Stuff to add to a new system..........." and bingo compilation a success and upload worked correctly. Just got to work out why the LED isn't blinking yet. But that's small beer- I hope!
Thanks to you both @jfabernathy && @YurkshireLad for your time and help. It was much appreciated
John B
Happy to hear it!
Something I discovered in the last few days is getting Arduino and VSCode working with my boards in KVM-QEMU and Virtual Machine Manager. I had to abandon VIrtualbox because of the conflict between VB and the python-is-python3 package required by vscode for the ESP32.
My only issue is using the ESP-Prog JTAG debugger. Since I have to unplug it during code upload, it causes problems with the USB assignments in QEMU. If you just use the one USB for connection to the MCU board it's not an issue since you can assign that port to the VM at start. I can use the ESP-Prog in QEMU, but the process will drive you to drink, but that's not an issue for me. 😀
If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.
Having successfully established everything works in Mint - Ubuntu version I decided to have another go with Mint - Debian version. I think the Debian version has an issue with which Python version you want to use. Its default is Python 2.7.
I tried to run sudo apt install python-is-python3 as you suggest. This fails in the Debian version ¨cannot be found¨. Similarly: python-is-python2.
This at a guess means that ´pip3 pyserial´ installs pyserial ok but it is not seen when the arduino looks for a port using python 2,7. (As I am writing this: is there a pip2?) Your suggestion of installing python-is-python3 is the key to the solution to my original problem. I had a look at changing the default version of python in the debian setup but this is apparently fraught with its own problems: see
where there are strong opinions for and against.
So rethink time. Again!
John B
@b89john I run Mint 20 Cinnamon and it works fine for me. Debian is too old and their use of Python2.7 in a time when that is dead to the world, is a problem. In fact I had to move my Kernel in Mint 20 to 5.8 to fix some Dell XPS laptop freeze up issues.
If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.
Having tried to install the python functions pyserial etc for python2.7 in an attempt to get it consistent on LMDE4 I agree with you Mint 20 is fine and on the surface is the same OS as LMDE4. I also fail to understand why Debian is so far behind with Python. I know the OS is rock solid stable but jeeze Python 2.7 is all but 10years old. So I have installed most of the software recommended by Bill in his tutorial Workshop Workstation. Its now back to working on the ESP32 and no serial port problems. I see you have another thread running on ESP32 so I will look for your pearls of wisdom there.
John B
... I see you have another thread running on ESP32 so I will look for your pearls of wisdom there.
John B
Be careful of those pearls; you never know when they are really painted "BS" droppings. 😆
If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.
I also fail to understand why Debian is so far behind with Python.
I'm not sure why you find this, the Debian should contain the following. - i.e always 2.7 and always the latest stable release python 3 when the distribution is released.