uart via built in usb on esp board

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

uart via built in usb on esp board

Postby Deouss » Thu Jun 07, 2018 2:46 pm

I have a serial port listener on PC and want to receive data over it from ESP.
How can I do it using just onboard built-in usb to serial functionality (soldered chip like CP210x).
In fact this is listed as com port on PC so how do I set uart parameters on esp?
What is the pin number for that internal RX/TX chip?

Thanks

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: uart via built in usb on esp board

Postby kolban » Thu Jun 07, 2018 4:12 pm

If you have an ESP32 module/board which already has a USB connector on it, it is likely that the board also contains a USB->UART converter. If you plug your ESP32 into your PC using the USB socket on the ESP32 to a USB socket on your PC, you should find that the PC side will see a new COM port. At this point you can read from the COM port using a terminal emulation program. Serial data written by the ESP32 (such as logging) will then appear on the terminal emulator.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: uart via built in usb on esp board

Postby Deouss » Thu Jun 07, 2018 4:22 pm

Is there example of usb sockets on esp?
That built in chip is able to flash the board so it has to be somehow connected and maybe I could access it
What do you suggest?

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: uart via built in usb on esp board

Postby fly135 » Thu Jun 07, 2018 4:49 pm

I'm guessing there is no support for IP over serial in the SDK. Do you have an application on your PC that supports TCP/IP over a serial port? Is there any reason you can't do data xfers by simply talking to the serial port?

John A

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: uart via built in usb on esp board

Postby Deouss » Thu Jun 07, 2018 5:19 pm

Well my question is - how I use uart on ESP to send data to PC serial port?
uart needs a pin number but serial communication is controlled by that converter chip.
So how data from 'printf' is sent to PC ?? It is all sent via usb cable as serial but how?
Should I just use printf() ? or UART hardware

It is possible but how. Please I need help with that

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: uart via built in usb on esp board

Postby fly135 » Thu Jun 07, 2018 5:53 pm

I use printf. But you are going to get some bogus data when the unit boots as I haven't seen any way to turn off some of the boot text. The baud rate appears to be set in make menuconfig under serial boot loader/"make monitor" baud rate.

There are also programmatic ways to set the baud (uart_set_baudrate()) and talk to the UART. And this is the link to the docs for that...

https://esp-idf.readthedocs.io/en/lates ... light=uart

If you need to send binary data then I guess the way to go is the UART API.

John A

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: uart via built in usb on esp board

Postby Deouss » Thu Jun 07, 2018 6:17 pm

yes however uart api needs a pin number but I have no idea what pin number that is.
Or maynbe there is other way

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: uart via built in usb on esp board

Postby fly135 » Thu Jun 07, 2018 6:38 pm

TX0 - GPIO 01
RX0 - GPIO 03

or perhaps use UART_PIN_NO_CHANGE since the uart is already configured maybe there is no need to use a pin number.

I'm guessing that every prototype board that uses a UART to talk to the PC for development is going to use the same UART and the same pins since that's all setup in the boot process before your program ever loads.

John A

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: uart via built in usb on esp board

Postby Deouss » Thu Jun 07, 2018 6:53 pm

Thanks so much. I will try it and let know if it worked

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: uart via built in usb on esp board

Postby Deouss » Thu Jun 07, 2018 10:19 pm

I cannot get it working. Tried all 3 uarts 0-2 with UART_PIN_NO_CHANGE
Also noticed according to pinout of devkit board uart0 txd is 41 but undefined
I will try wifi then

Who is online

Users browsing this forum: Kuralmozhi and 94 guests