PlatformIO Community

ESP32 wrover kit debugging on OS X

Hi.

This post will be about my debugging experiences on my macs with PlatformIO and the esp32 wrover kit.
Before making this to work, I used the serial log feature intensive to try and error my code. Therefore I use the settings below to color the prints in green, yellow, white and red.
I tried the debugging on the eclipse platform and this took several attempts and workarounds to get it functioning. After a high frustrating level, because the configuration resettled unexpectedly several times, I tried out debugging in PlatformIO, therefore I just modified my ini file as below and it worked on the first attempt! Great! Additional to the debugging I’m also able to open a serial monitor in parallel, did I already mention that it is great?!

ini Settings:
[platformio]
default_envs = esp32dev

[env:esp32dev]
platform = espressif32
framework = espidf

;board = esp32dev
board = esp-wrover-kit

; https://github.com/espressif/esp-idf/tree/master/components/partition_table
;board_build.partitions = partitions_two_ota.csv
board_build.partitions = single_part.csv

monitor_speed = 115200
monitor_flags=
–raw

After that, I tried to reproduce this success on my iMac. Debugging works fine again, but opening the serial port for logging output runs into an error. Error message will follow. On the MacBook opening the serial console gives me a decision menu to select one out of three serial adapters, it looks like I have different installled drivers. Unfortunately I can’t remember which one I installed on the MacBook :dizzy_face:
Now, I try several different drivers to get to success on the iMac as well.
I will update this post with outputs and results as soon as I have new findings.

Expected result on the MacBook:


within the debug mode, I’m able to select another port for serial monitor (port 3).

Failure picture on the iMac:


The console is returning Error 16.

The recommended one from the Espressif site for the wrover kit didn’t generate the expected results:
https://www.ftdichip.com/Drivers/VCP.htm

If you are using the ESP-Prog debugger probe on macOS, you need to unload the FTDI drivers as they restrict your debugger probe to be a serial port only.

There are several FTDI drivers from Apple and FTDI. Run the below commands. At least one of them should be successful:

sudo kextunload /System/Library/DriverExtensions/DriverKit.AppleUSBFTDI.dext
sudo kextunload /System/Library/Extensions/AppleUSBFTDI.kext
sudo kextunload /Library/Extensions/FTDIUSBSerialDriver.kext

The drivers are just unloaded, not uninstalled. They will be reactivate at the next reboot or if you execute kextload instead of kextunload.

In addition to the debugger, you probably have the regular USB cable connected to your ESP32. You can use it to keep the serial connection open at all times. If you add the below line, you can even keep it open during firmware uploads as it will be uploaded via the debugger:

upload_protocol = esp-prog

Hi Manuel.
Thanks for your suggestions. I will give it a try. On both PCs the hardware setup is equal, better to say I only have one hardware setup. It is the wrover kit with just one usb cable connected.

1 Like

Everybody who has come into contact with Windows is virtually conditioned to install a driver when they plug in a USB device. On the Mac it’s usually the wrong thing to do. And even on Windows it’s less and less common…

USB is designed such that it can work without additional drivers. Even on Windows, a simple entry in the device’s USB descriptor table instructs Windows to use the generic WinUSB driver if none of the standard protocols (for keyboard, mouse, mass storage, serial port etc.) is suitable.

And I don’t understand why FTDI, WCH and Silicon Labs sell so many of their USB-to-Serial chips that require a custom driver when they could implement the USB CDC standard so that their product could be used without additional drivers.

Sorry for the rant. But by installing additional drivers you went down the wrong road…

1 Like

Ok, ok I will give it a try. Nevertheless, I remember in my early days developing on the esp8266, I tried to connect to the device w/o any driver installed and that wasn’t successful… maybe an already installed apple FTDI driver blocked. We will see and I keep you updated.

Since about 5 years, macOS comes with FTDI drivers out of the box.

You need FTDI drivers if the MCU board has an FTDI chip for USB to serial conversion. But for debugging, the full feature set of the FTDI chip is required and the FTDI serial port driver is in the way as immediately acquires exclusive access to the USB device.

Hi again.

I tested the suggestion from Manuel with the following result:

  1. Connected the Grover Kit per USB
  2. executed the Commands
  3. Started debugging
  4. Tried to open a console

    -> Unfortunately the expected port was not available.

Regards

Stephan

What exact MCU board do you have? What USB-to-Serial chip does it use? Is it connected both to the debugger (via 5 or 6 cables - Dupont or similar) and directly to your Mac (via USB cable)?

Next test is the Silabs driver from:
https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers

After installation, debugging and serial console output works almost as expected:

Just wondering, that it directly connects instead of presenting a menu like on the MacBook. Maybe because the other interfaces are in use (bluetooth by keyboard, mouse, etc…)