USB CDC serial communication example
Posted: Mon Apr 03, 2023 6:48 pm
Hello,
I'm a bit new to the whole IDF universe and making my first babysteps.
So working with the IDF was mandatory as I'm currently experimenting with some peripherals.
After getting to know how to create the necessary business logic I'm currently facing the problem with communicating as USB peripheral to my Macbook. Setup: Wemos Lolin S2 Mini with a VS Code Espressif IDF setup and IDF 5.0.1 with the setting Component config > ESP System Settings > Channel for console output > USB CDC for the feedback of the controller.
Now I wanted to improve my code to be able to receive commands via USB, so I added the console snippet (with linenoise) from the docs to receive commands via the VS Code serial monitor (aka. idf_monitor.py). This works very fine.
But now I wanted to improve my code and add communication via a self written tooling in golang. Every code I'm using on the internet does not show the results or stability as sending commands via the idf_monitor.py and using the esp_console.h. Does someone here have some examples or ressources for the communication between a usb cdc idf esp32 and some code on a pc/mac? Or at least some helping hints?
I don't stick to golang, as I'm currently just trying to get it work.
This is my current setup: https://github.com/mrkwenzel/esp-idf-go ... b130228706
The only thing to get it work is using Arduino like implementation as here https://gist.github.com/lroman242/e38f1 ... 43739c55ee but I want to use peripherals as the hmac perhipheral described like here: https://docs.espressif.com/projects/esp ... -reference
The idea is to send a message to the esp32 and receive the calculated result. And this over and over.
//Edit: Maybe this needs to be moved to IDF?
I'm a bit new to the whole IDF universe and making my first babysteps.
So working with the IDF was mandatory as I'm currently experimenting with some peripherals.
After getting to know how to create the necessary business logic I'm currently facing the problem with communicating as USB peripheral to my Macbook. Setup: Wemos Lolin S2 Mini with a VS Code Espressif IDF setup and IDF 5.0.1 with the setting Component config > ESP System Settings > Channel for console output > USB CDC for the feedback of the controller.
Now I wanted to improve my code to be able to receive commands via USB, so I added the console snippet (with linenoise) from the docs to receive commands via the VS Code serial monitor (aka. idf_monitor.py). This works very fine.
But now I wanted to improve my code and add communication via a self written tooling in golang. Every code I'm using on the internet does not show the results or stability as sending commands via the idf_monitor.py and using the esp_console.h. Does someone here have some examples or ressources for the communication between a usb cdc idf esp32 and some code on a pc/mac? Or at least some helping hints?
I don't stick to golang, as I'm currently just trying to get it work.
This is my current setup: https://github.com/mrkwenzel/esp-idf-go ... b130228706
The only thing to get it work is using Arduino like implementation as here https://gist.github.com/lroman242/e38f1 ... 43739c55ee but I want to use peripherals as the hmac perhipheral described like here: https://docs.espressif.com/projects/esp ... -reference
The idea is to send a message to the esp32 and receive the calculated result. And this over and over.
//Edit: Maybe this needs to be moved to IDF?