Using ESP32S3 native USB to communicate with GPS board with UART bridge - Page 1
Forum section: electronics / beginners

author: GuilleZGZ
author_rank: Newbie
timestamp: September 09, 2023, 01:22:28 pm
content: Hi all,This is my first message in the forum so first of all thanks to anybody spending some of his time in reading it and making any suggestion on how to proceed.I've been trying to connect a GPS receiver (Navspark NS-RAW for the matter) with an ESP32-S3-DevkitC-1 v1.0 board using the native USB port. I have to do so because, although the GPS microcontrollar has a serial interface, the board only directly exposes the TXD on the available pins. The RXD is only available on a micro-usb through a UART bridge. So the micro-usb port is the only way for the GPS board to receive commands from another device.The GPS board can be interfaced with the PC by means of a software provided by the provider or by directly sending commands in binary form with a software like Realterm. Both work fine, so the GPS board is ok and I understand the communication protocol.According to the manufacturer of the GPS board, if connected with a device functioning as an USB host (the ESP in this case) it should behave in the same way it does when connected to the PC. This might sound pretty obvious, but it's the first time I try it. I connect the ESP32 with the PC using the UART micro USB connector and the GPS board through pins 19 and 20 on the ESP32. I listen to the TXD pin of the GPS board with a logic analyzer. The board sends its position with 1Hz, as it should do unless told otherwise, so it's powered on and working.I'm using this example program in the Arduino IDE for my tests:https://github.com/espressif/arduino-esp32/blob/master/libraries/USB/examples/USBSerial/USBSerial.inoThis program should redirect any data going into the UART port of the ESP to the native USB. So, theoretically, the GPS board should be receiving any commands I send from the PC. Unfortunaly the GPS board doesn't react to them. This commands are correct, as the GPS reacts to them as expected when directly connected to the PC, but not when interfacing with the ESP. Swapping D+ and D- doesn't change anything.When I reset the ESP32 I get this per the UART port:Code:ESP-ROM:esp32s3-20210327Build:Mar 27 2021rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)SPIWP:0xeemode:DIO, clock div:1load:0x3fce3808,len:0x44cload:0x403c9700,len:0xbe4load:0x403cc700,len:0x2a68entry 0x403c98d4USB UNPLUGGEDIs there anything I'm missing here? Do I have to use any particular sort of cable like an OTG cable at the ESP32 or GPS board ends? Any help will be appreciated!

author: ledtester
author_rank: Super Contributor
timestamp: September 09, 2023, 02:26:30 pm
content: Quote from: GuilleZGZ on September 09, 2023, 01:22:28 pmThe link doesn't work. What is the full URL of the program you are using?

author: DavidAlfa
author_rank: Super Contributor
timestamp: September 09, 2023, 02:44:04 pm
content: The USB host is only the beginning.Then the ESP must have support to interface the serial device - A driver, probably ACM.

author: GuilleZGZ
author_rank: Newbie
timestamp: September 09, 2023, 03:20:59 pm
content: Quote from: ledtester on September 09, 2023, 02:26:30 pmhttps://github.com/espressif/arduino-esp32/blob/master/libraries/USB/examples/USBSerial/USBSerial.inoCorrected, thanks

author: GuilleZGZ
author_rank: Newbie
timestamp: September 09, 2023, 03:36:36 pm
content: Quote from: DavidAlfa on September 09, 2023, 02:44:04 pmAccording to the technical reference of the microcontroller, it has support for CDC-ACM serial port emulation (see attachment). You mean it would need a specific library or driver for interfacing with the UART bridge on the GPS board (2303HX) on top of that?https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf