Reading GNSS from UART returns nothing - how to debug

You need to understand the basics of ESPHome and then adapt the code.

Start with a good read of the debug uart page and work on setting up a minimal uart debugger with just logging of the messages.

Getting that set-up is a first step.

I can help a little later if you can’t work through it.

ok then, thanks for your time. I need just a code that would work on my tiny case of reading GNSS over UART. The result -1 means, no NMEA message is sent. So I added switching on of the GNSS to the on_boot section, but no result. If you can help me instead of tell me that I need to be on a different level, I would appreciate it. I am novice in ESP Home but this seems to be super easy configuration, which does not work.

  on_boot:
    - priority: -100
      then:
        - uart.write: "AT\r\n"
        - delay: 1s
        - uart.write: "AT+CGNSSPWR=1"
        - delay: 1s
        - uart.write: "AT+CGNSSTST=1"

So first step I think is to see if you can recieve some UART messages and see them in the ESPHome logs. Try this. You may need to adjust the baud_rate and/or maybe the after:

uart:
  baud_rate: 115200
  debug:
    direction: BOTH
    dummy_receiver: true
    after:
      delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);

If you want to send uart you can do it a few ways - a UART button, or UART switch could be good for testing.

The device you have seems relatively complex to me and there is quite a lot of docs to get through…

I moved a bit, your help is appreciated!

  1. I created a lot of buttons sending AT commands I found in the documentation of A76xx
  2. I properly configured the UART according to the documentation of ESP32-S3
  3. When I send the AT command, I get echo, which probably means the device received my command and sent it back - uart is properly configured, however, the device does not respond on any command as expected (OK, GPS data etc…) or in case of device reset, it certainly does not reset itself.

GPS is receiving -1 on everything, I am not sure how it is written in ESP home but it seems to me that it is independent on UART because the number is received under any uart configurations when I was switching pins etc.

I did not figure out where the debug log should be found. I am looking to the log after compilation but there is no change after adding the code from the section “debug” of the “uart bus” page on ESP Home documentation. Should I look elsewhere?

Here is my current log:

INFO ESPHome 2024.12.4
INFO Reading configuration /config/esphome/cannondale-tracker.yaml...
WARNING GPIO3 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Generating C++ source...
INFO Compiling app...
Processing cannondale-tracker (board: esp32-s3-devkitc-1; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 
 - toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- AsyncTCP-esphome @ 2.1.4
|-- WiFi @ 2.0.0
|-- FS @ 2.0.0
|-- Update @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.2.2
|-- DNSServer @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- noise-c @ 0.1.6
|-- Wire @ 2.0.0
|-- TinyGPSPlus @ 1.0.2
Compiling .pioenvs/cannondale-tracker/src/main.cpp.o
Linking .pioenvs/cannondale-tracker/firmware.elf
RAM:   [=         ]  12.6% (used 41360 bytes from 327680 bytes)
Flash: [=====     ]  48.8% (used 896061 bytes from 1835008 bytes)
Building .pioenvs/cannondale-tracker/firmware.bin
Creating esp32s3 image...
Successfully created esp32s3 image.
esp32_create_combined_bin([".pioenvs/cannondale-tracker/firmware.bin"], [".pioenvs/cannondale-tracker/firmware.elf"])
Wrote 0xeadc0 bytes to file /data/build/cannondale-tracker/.pioenvs/cannondale-tracker/firmware.factory.bin, ready to flash to offset 0x0
esp32_copy_ota_bin([".pioenvs/cannondale-tracker/firmware.bin"], [".pioenvs/cannondale-tracker/firmware.elf"])
========================= [SUCCESS] Took 28.35 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.2.185 port 3232...
INFO Connected to 192.168.2.185
INFO Uploading /data/build/cannondale-tracker/.pioenvs/cannondale-tracker/firmware.bin (896448 bytes)
Uploading: [============================================================] 100% Done...

INFO Upload took 8.66 seconds, waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.2.185 using esphome API
INFO Successfully connected to cannondale-tracker @ 192.168.2.185 in 7.390s
INFO Successful handshake with cannondale-tracker @ 192.168.2.185 in 0.068s
[13:14:48][I][app:100]: ESPHome version 2024.12.4 compiled on Jan 21 2025, 13:14:07
[13:14:48][C][wifi:600]: WiFi:
[13:14:48][C][wifi:428]:   Local MAC: 18:8B:0E:CD:4D:48
[13:14:48][C][wifi:433]:   SSID: [redacted]
[13:14:48][C][wifi:436]:   IP Address: 192.168.2.185
[13:14:48][C][wifi:440]:   BSSID: [redacted]
[13:14:48][C][wifi:441]:   Hostname: 'cannondale-tracker'
[13:14:48][C][wifi:443]:   Signal strength: -71 dB ▂▄▆█
[13:14:48][C][wifi:447]:   Channel: 4
[13:14:48][C][wifi:448]:   Subnet: 255.255.255.0
[13:14:48][C][wifi:449]:   Gateway: 192.168.2.1
[13:14:48][C][wifi:450]:   DNS1: 192.168.2.131
[13:14:48][C][wifi:451]:   DNS2: 192.168.2.1
[13:14:48][C][logger:185]: Logger:
[13:14:48][C][logger:186]:   Level: DEBUG
[13:14:48][C][logger:188]:   Log Baud Rate: 115200
[13:14:48][C][logger:189]:   Hardware UART: USB_CDC
[13:14:48][C][i2c.arduino:071]: I2C Bus:
[13:14:48][C][i2c.arduino:072]:   SDA Pin: GPIO3
[13:14:48][C][i2c.arduino:073]:   SCL Pin: GPIO2
[13:14:48][C][i2c.arduino:074]:   Frequency: 50000 Hz
[13:14:48][C][i2c.arduino:086]:   Recovery: bus successfully recovered
[13:14:48][I][i2c.arduino:096]: Results from i2c bus scan:
[13:14:48][I][i2c.arduino:102]: Found i2c device at address 0x36
[13:14:48][C][uart.arduino_esp32:151]: UART Bus 0:
[13:14:48][C][uart.arduino_esp32:152]:   TX Pin: GPIO18
[13:14:48][C][uart.arduino_esp32:153]:   RX Pin: GPIO17
[13:14:48][C][uart.arduino_esp32:155]:   RX Buffer Size: 256
[13:14:48][C][uart.arduino_esp32:157]:   Baud Rate: 115200 baud
[13:14:48][C][uart.arduino_esp32:158]:   Data Bits: 8
[13:14:48][C][uart.arduino_esp32:159]:   Parity: NONE
[13:14:48][C][uart.arduino_esp32:160]:   Stop bits: 1
[13:14:48][C][max17048:033]: MAX17048:
[13:14:48][C][max17048:034]:   Address: 0x36
[13:14:48][C][max17048:035]:   Voltage (V) 'Battery voltage'
[13:14:48][C][max17048:035]:     Device Class: 'battery'
[13:14:48][C][max17048:035]:     State Class: 'measurement'
[13:14:48][C][max17048:035]:     Unit of Measurement: 'V'
[13:14:48][C][max17048:035]:     Accuracy Decimals: 3
[13:14:48][C][max17048:036]:   State of Charge (%) 'Battery level'
[13:14:48][C][max17048:036]:     Device Class: 'battery'
[13:14:48][C][max17048:036]:     State Class: 'measurement'
[13:14:48][C][max17048:036]:     Unit of Measurement: '%'
[13:14:48][C][max17048:036]:     Accuracy Decimals: 2
[13:14:48][C][max17048:037]:   Discharge Rate (%/hr) 'Battery discharge rate'
[13:14:48][C][max17048:037]:     Device Class: 'battery'
[13:14:48][C][max17048:037]:     State Class: 'measurement'
[13:14:48][C][max17048:037]:     Unit of Measurement: '%/h'
[13:14:48][C][uart.button:014]: UART Button 'Open GNSS data output'
[13:14:48][C][uart.button:014]: UART Button 'Warm restart GNSS'
[13:14:48][C][uart.button:014]: UART Button 'Get GPS fixed position'
[13:14:48][C][uart.button:014]: UART Button 'Get NMEA raw data 0.0'
[13:14:48][C][uart.button:014]: UART Button 'Get NMEA raw data 0.1'
[13:14:48][C][uart.button:014]: UART Button 'RESET MODULE'
[13:14:48][C][uart.button:014]: UART Button 'SCAN WIFI'
[13:14:48][C][captive_portal:089]: Captive Portal:
[13:14:48][C][mdns:116]: mDNS:
[13:14:48][C][mdns:117]:   Hostname: cannondale-tracker
[13:14:48][C][esphome.ota:073]: Over-The-Air updates:
[13:14:48][C][esphome.ota:074]:   Address: cannondale-tracker.local:3232
[13:14:48][C][esphome.ota:075]:   Version: 2
[13:14:48][C][esphome.ota:078]:   Password configured
[13:14:48][C][safe_mode:018]: Safe Mode:
[13:14:48][C][safe_mode:020]:   Boot considered successful after 60 seconds
[13:14:48][C][safe_mode:021]:   Invoke after 10 boot attempts
[13:14:48][C][safe_mode:023]:   Remain in safe mode for 300 seconds
[13:14:48][C][api:140]: API Server:
[13:14:48][C][api:141]:   Address: cannondale-tracker.local:6053
[13:14:48][C][api:143]:   Using noise encryption: YES
[13:14:52][D][sensor:094]: 'Latitude': Sending state -1.00000 ° with 6 decimals of accuracy
[13:14:52][D][sensor:094]: 'Longitude': Sending state -1.00000 ° with 6 decimals of accuracy
[13:14:52][D][sensor:094]: 'Altitude': Sending state -1.00000 m with 1 decimals of accuracy
[13:14:54][D][button:010]: 'Get GPS fixed position' Pressed.
[13:14:54][D][uart.button:010]: 'Get GPS fixed position': Sending data...
[13:14:54][D][uart_debug:158]: >>> "AT+CGPSINFO"
[13:14:54][D][uart_debug:158]: <<< "AT+CGPSINFO"
[13:14:59][D][button:010]: 'SCAN WIFI' Pressed.
[13:14:59][D][uart.button:010]: 'SCAN WIFI': Sending data...
[13:14:59][D][uart_debug:158]: >>> "AT+CWSTASCAN"
[13:14:59][D][uart_debug:158]: <<< "AT+CWSTASCAN"
[13:15:01][D][button:010]: 'Get NMEA raw data 0.0' Pressed.
[13:15:01][D][uart.button:010]: 'Get NMEA raw data 0.0': Sending data...
[13:15:01][D][uart_debug:158]: >>> "AT+CGNSSPORTSWITCH = 0,0"
[13:15:01][D][uart_debug:158]: <<< "AT+CGNSSPORTSWITCH = 0,0"
[13:15:02][D][button:010]: 'Get NMEA raw data 0.1' Pressed.
[13:15:02][D][uart.button:010]: 'Get NMEA raw data 0.1': Sending data...
[13:15:02][D][uart_debug:158]: >>> "AT+CGNSSPORTSWITCH = 0,1"
[13:15:02][D][uart_debug:158]: <<< "AT+CGNSSPORTSWITCH = 0,1"
[13:15:03][D][button:010]: 'Open GNSS data output' Pressed.
[13:15:03][D][uart.button:010]: 'Open GNSS data output': Sending data...
[13:15:03][D][uart_debug:158]: >>> "AT+CGNSSTST=1"
[13:15:03][D][uart_debug:158]: <<< "AT+CGNSSTST=1"
[13:15:04][D][button:010]: 'Power on the GNSS' Pressed.
[13:15:04][D][uart.button:010]: 'Power on the GNSS': Sending data...
[13:15:04][D][uart_debug:158]: >>> "AT+CGNSSPWR=1"
[13:15:04][D][uart_debug:158]: <<< "AT+CGNSSPWR=1"
[13:15:06][D][button:010]: 'RESET MODULE' Pressed.
[13:15:06][D][uart.button:010]: 'RESET MODULE': Sending data...
[13:15:06][D][uart_debug:158]: >>> "AT+CRESET"
[13:15:06][D][uart_debug:158]: <<< "AT+CRESET"
[13:15:12][D][sensor:094]: 'Latitude': Sending state -1.00000 ° with 6 decimals of accuracy
[13:15:12][D][sensor:094]: 'Longitude': Sending state -1.00000 ° with 6 decimals of accuracy
[13:15:12][D][sensor:094]: 'Altitude': Sending state -1.00000 m with 1 decimals of accuracy

My yaml:

esphome:
  name: cannondale-tracker
  friendly_name: Cannondale Tracker

external_components:
  - source: github://Option-Zero/esphome-components
    components: [max17048]

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:
  encryption:
    key: "h00Nj97jCO4I9jDUmxIfcCHy0WpIXy9rocFsy+RfXKg="

ota:
  - platform: esphome
    password: "f32a9ac7d88a3f88a297e1884319fe67"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Cannondale-Tracker"
    password: "AoJdi85n0F9z"

captive_portal:

uart:
  rx_pin: 17
  tx_pin: 18
  baud_rate: 115200
  debug:
    direction: BOTH
    dummy_receiver: true
    after:
      delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);
      
i2c:
  sda: GPIO3
  scl: GPIO2

sensor:
  - platform: max17048
    battery_voltage:
      name: Battery voltage
      id: batt_v
    battery_level:
      name: Battery level
      id: batt_pct
    rate:
      name: Battery discharge rate
      id: batt_discharge_rate

button:
  - platform: uart
    name: "Power on the GNSS"
    data: "AT+CGNSSPWR=1"
  - platform: uart
    name: "Open GNSS data output"
    data: "AT+CGNSSTST=1"
  - platform: uart
    name: "Warm restart GNSS"
    data: "AT+CGPSWARM"
  - platform: uart
    name: "Get GPS fixed position"
    data: "AT+CGPSINFO"
  - platform: uart
    name: "Get NMEA raw data 0.0"
    data: "AT+CGNSSPORTSWITCH = 0,0"
  - platform: uart
    name: "Get NMEA raw data 0.1"
    data: "AT+CGNSSPORTSWITCH = 0,1"

  - platform: uart  
    name: "RESET MODULE"
    data: "AT+CRESET"
  - platform: uart  
    name: "SCAN WIFI"
    data: "AT+CWSTASCAN"

gps:
  latitude:
    name: "Latitude"
  longitude:
    name: "Longitude"
  altitude:
    name: "Altitude"
1 Like

I’m wondering whether you might be better off first working through the provided device example demos (especially the ESP-IDF ones) to confirm your hardware is all set-up and working correctly with tested code before venturing into moving it to ESPHome?

I feel like the hardware interfaces and protocols between the various onboard hardware isn’t “obvious” (at least to me).

Anyone trying to support you here would need to read and develop a bit of understanding of your device, which would take them a little time.

I read the wiki from top to bottom, it helped me to implement the battery status sensor with help of one esp home recipe I found around.

However, ESP IDF is visibly advanced. I thought that ESP Home’s magic is in the simplicity of the implementation: nothing more than UART pins is not needed, the GPS component of ESP Home seems to be developed on the NMEA standards. Both in concert produce several sensors and voiala, everything else can be done in home assisstant. There’s literally nothing special that one has to know if it were developed as expected. Or am I wrong and ESP home is not about the simplicity for people like me?

UART pins are certainly on 17 and 18. All documentations (Waveshare, ESP32-S3) says the same. What more do I need to get GPS readings?

So I bought ESP32-S3 board, a fresh tiny mini devboard and tried to connect an external GPS module LC76G GNSS from Waveshare, its wiki here.

There is really not too much to do wrong, I followed the documentation. Connected (GNSS to ESP):

  • VCC to 5V
  • GND to GND
  • RX to TX
  • TX to RX

Wrote this yaml:

uart:
  id: uart_gnss
  tx_pin: GPIO43
  rx_pin: GPIO44
  baud_rate: 115200

uart_id: uart_gnss
  latitude:
    name: "GNSS Latitude"
  longitude:
    name: "GNSS Longitude"
  altitude:
    name: "GNSS Altitude"
  speed:
    name: "GNSS Speed"
  satellites:
    name: "GNSS Satellites"

and I am in the same situation. PINs are certainly correct, baud 115200 as well, it is written in the documentation and all receives are -1.00000. See below.

I do not see what else I can do better, maybe somebody knows?

INFO ESPHome 2024.12.4
INFO Reading configuration /config/esphome/esp32-s3-testing-1.yaml...
INFO Starting log output from 192.168.2.105 using esphome API
INFO Successfully connected to esp32-s3-testing-1 @ 192.168.2.105 in 0.106s
INFO Successful handshake with esp32-s3-testing-1 @ 192.168.2.105 in 0.057s
[18:43:24][I][app:100]: ESPHome version 2024.12.4 compiled on Jan 23 2025, 18:12:18
[18:43:24][C][wifi:600]: WiFi:
[18:43:24][C][wifi:428]:   Local MAC: 64:E8:33:7D:F5:D4
[18:43:24][C][wifi:433]:   SSID: [redacted]
[18:43:24][C][wifi:436]:   IP Address: 192.168.2.105
[18:43:24][C][wifi:440]:   BSSID: [redacted]
[18:43:24][C][wifi:441]:   Hostname: 'esp32-s3-testing-1'
[18:43:24][C][wifi:443]:   Signal strength: -74 dB ▂▄▆█
[18:43:24][C][wifi:447]:   Channel: 4
[18:43:24][C][wifi:448]:   Subnet: 255.255.255.0
[18:43:24][C][wifi:449]:   Gateway: 192.168.2.1
[18:43:24][C][wifi:450]:   DNS1: 192.168.2.131
[18:43:24][C][wifi:451]:   DNS2: 192.168.2.1
[18:43:24][C][logger:185]: Logger:
[18:43:24][C][logger:186]:   Level: DEBUG
[18:43:24][C][logger:188]:   Log Baud Rate: 115200
[18:43:24][C][logger:189]:   Hardware UART: USB_CDC
[18:43:24][C][uart.arduino_esp32:151]: UART Bus 0:
[18:43:24][C][uart.arduino_esp32:152]:   TX Pin: GPIO43
[18:43:24][C][uart.arduino_esp32:153]:   RX Pin: GPIO44
[18:43:24][C][uart.arduino_esp32:155]:   RX Buffer Size: 256
[18:43:24][C][uart.arduino_esp32:157]:   Baud Rate: 115200 baud
[18:43:24][C][uart.arduino_esp32:158]:   Data Bits: 8
[18:43:24][C][uart.arduino_esp32:159]:   Parity: NONE
[18:43:24][C][uart.arduino_esp32:160]:   Stop bits: 1
[18:43:24][C][captive_portal:089]: Captive Portal:
[18:43:24][C][mdns:116]: mDNS:
[18:43:24][C][mdns:117]:   Hostname: esp32-s3-testing-1
[18:43:24][C][esphome.ota:073]: Over-The-Air updates:
[18:43:24][C][esphome.ota:074]:   Address: esp32-s3-testing-1.local:3232
[18:43:24][C][esphome.ota:075]:   Version: 2
[18:43:24][C][esphome.ota:078]:   Password configured
[18:43:24][C][safe_mode:018]: Safe Mode:
[18:43:24][C][safe_mode:020]:   Boot considered successful after 60 seconds
[18:43:24][C][safe_mode:021]:   Invoke after 10 boot attempts
[18:43:24][C][safe_mode:023]:   Remain in safe mode for 300 seconds
[18:43:24][W][safe_mode:029]: Last reset occurred too quickly; safe mode will be invoked in 7 restarts
[18:43:24][C][api:140]: API Server:
[18:43:24][C][api:141]:   Address: esp32-s3-testing-1.local:6053
[18:43:24][C][api:143]:   Using noise encryption: YES
[18:43:40][D][sensor:094]: 'GNSS Latitude': Sending state -1.00000 ° with 6 decimals of accuracy
[18:43:40][D][sensor:094]: 'GNSS Longitude': Sending state -1.00000 ° with 6 decimals of accuracy
[18:43:40][D][sensor:094]: 'GNSS Speed': Sending state -1.00000 km/h with 6 decimals of accuracy
[18:43:40][D][sensor:094]: 'GNSS Altitude': Sending state -1.00000 m with 1 decimals of accuracy
[18:43:40][D][sensor:094]: 'GNSS Satellites': Sending state -1.00000  with 0 decimals of accuracy
[18:44:00][D][sensor:094]: 'GNSS Latitude': Sending state -1.00000 ° with 6 decimals of accuracy
[18:44:00][D][sensor:094]: 'GNSS Longitude': Sending state -1.00000 ° with 6 decimals of accuracy
[18:44:00][D][sensor:094]: 'GNSS Speed': Sending state -1.00000 km/h with 6 decimals of accuracy
[18:44:00][D][sensor:094]: 'GNSS Altitude': Sending state -1.00000 m with 1 decimals of accuracy
[18:44:00][D][sensor:094]: 'GNSS Satellites': Sending state -1.00000  with 0 decimals of accuracy
[18:44:20][D][sensor:094]: 'GNSS Latitude': Sending state -1.00000 ° with 6 decimals of accuracy
[18:44:20][D][sensor:094]: 'GNSS Longitude': Sending state -1.00000 ° with 6 decimals of accuracy
[18:44:20][D][sensor:094]: 'GNSS Speed': Sending state -1.00000 km/h with 6 decimals of accuracy
[18:44:20][D][sensor:094]: 'GNSS Altitude': Sending state -1.00000 m with 1 decimals of accuracy
[18:44:20][D][sensor:094]: 'GNSS Satellites': Sending state -1.00000  with 0 decimals of accuracy
[18:44:40][D][sensor:094]: 'GNSS Latitude': Sending state -1.00000 ° with 6 decimals of accuracy
[18:44:40][D][sensor:094]: 'GNSS Longitude': Sending state -1.00000 ° with 6 decimals of accuracy
[18:44:40][D][sensor:094]: 'GNSS Speed': Sending state -1.00000 km/h with 6 decimals of accuracy
[18:44:40][D][sensor:094]: 'GNSS Altitude': Sending state -1.00000 m with 1 decimals of accuracy
[18:44:40][D][sensor:094]: 'GNSS Satellites': Sending state -1.00000  with 0 decimals of accuracy
[18:45:00][D][sensor:094]: 'GNSS Latitude': Sending state -1.00000 ° with 6 decimals of accuracy
[18:45:00][D][sensor:094]: 'GNSS Longitude': Sending state -1.00000 ° with 6 decimals of accuracy
[18:45:00][D][sensor:094]: 'GNSS Speed': Sending state -1.00000 km/h with 6 decimals of accuracy
[18:45:00][D][sensor:094]: 'GNSS Altitude': Sending state -1.00000 m with 1 decimals of accuracy
[18:45:00][D][sensor:094]: 'GNSS Satellites': Sending state -1.00000  with 0 decimals of accuracy
[18:45:20][D][sensor:094]: 'GNSS Latitude': Sending state -1.00000 ° with 6 decimals of accuracy
[18:45:20][D][sensor:094]: 'GNSS Longitude': Sending state -1.00000 ° with 6 decimals of accuracy
[18:45:20][D][sensor:094]: 'GNSS Speed': Sending state -1.00000 km/h with 6 decimals of accuracy
[18:45:20][D][sensor:094]: 'GNSS Altitude': Sending state -1.00000 m with 1 decimals of accuracy
[18:45:20][D][sensor:094]: 'GNSS Satellites': Sending state -1.00000  with 0 decimals of accuracy

What uart debug messages in the logger do you get with that set-up (if any)?

This may be a silly question, but I assume you are testing somewhere where you can recieve a GPS signal?

Thank you for keeping in touch!

I do not see any UART debug related logs in the device log (the one I can open by clicking on “logs” button of the device on the ESP home page of Home Assistant or the log I see after compilation).

If you think of the following example code, I do not know where the output is supposed to be.

# Example configuration entry
uart:
  baud_rate: 115200
  debug:
    direction: BOTH
    dummy_receiver: false
    after:
      delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);

However, I tried presence sensor LD2420 for testing and made it work (for a while, then the sensor became unknown and I was not successful in ressurecting it). However, it proved me that I can configure UART.

I also tried a third different GPS module, same result with -1.00000 output, even after a lot of minutes under the sky.

ok, I think I am narrowing down the problem. UART works well without interruption on GPIO1 (TX) 2 (RX), instead of on the TX RX onboard pins (43, 44) for the presence sensor.

1 Like

Heureka!

[17:00:41][D][gps:040]: Location:
[17:00:41][D][gps:041]: Lat: 48.173710
[17:00:41][D][gps:042]: Lon: 16.358925
[17:00:41][D][gps:057]: Altitude:
[17:00:41][D][gps:058]: 237.089996 m
[17:00:41][D][gps:062]: Satellites:
[17:00:41][D][gps:063]: 17
[17:00:41][D][gps:040]: Location:
[17:00:41][D][gps:041]: Lat: 48.173710
[17:00:41][D][gps:042]: Lon: 16.358925
[17:00:41][D][gps:047]: Speed:
[17:00:41][D][gps:048]: 0.000000 km/h
[17:00:41][D][gps:052]: Course:
[17:00:41][D][gps:053]: 0.000000 °

1 Like

So! VCC must be 3V3 pin. 5V pin did not even turn up the GPS module despite the documentation in which I read that both are possible.

RX TX on board of ESP32-S Wroom cannot be used and apparently not any GPIO can be configured for UART. I used GPIO 1 and 2 for TX and RX and it works. WORKS!

That does not mean I found how to read debug logs…

I have confirmed from WAVESHARE support that GPIO for UART is TX17, RX18 and are shared on the chip A7670. I think that Waveshare board has to be configured with ESP IDF because the hardware is different to ESP32 for which ESP home is programmed.

1 Like

Congrats, sounds like you are working now, but if you are still curious to inspect the logs you may need this.

Plus set this to VERY_VERBOSE

You are looking in the right place for logs. It’s where you got the ones you’ve pasted from.

[20:45:01][D][uart_debug:158]: <<< "\x03\x00\x05\xB9\x02\xA1\x02\xD5\x02\xF8\xF7\xF6\xF5\xF4\xF3\xF2\xF1#\x00\x01#\x00\xA0G\x05\x87\x02\xBD1@\x91\x1Ey\x13i\r\xE2\v\xAA\x06\x14\x06A\x06\xFD\x02E\x04\xA8\x02*\x02\x80\x02\xF8\xF7\xF6\xF5\xF4\xF3\xF2\xF1#\x00\x01#\x002\xD9\x12\x92\xBA\xB8D>\x12\x1D\x81\x13J\fY\f5\a\xB4\x05:\x06\xFD\x02\xA4\x03\xE9\x02\x90\x02\x81\x02\xF8\xF7\xF6\xF5\xF4\xF3\xF2\xF1#\x00\x01#\x00e(\xBD|\x11\xC9}D\xB2\x1E1\x13\xD5\fz\v\x9D\x06%\x06\x90\x05\x01\x04\xE1\x04\xDD\x02\xD4\x01D\x02\xF8\x
[20:45:01][D][uart_debug:158]: <<< “\xF2\xF1#\x00\x01#\x00\xFD\xA5\x9A\xA3\xA0\xBE\x05?A\x1E\x05\x14@\r\x84\fQ\a\xF5\x05\x01\x06A\x03\xB9\x03\xDA\x02\x02\x02\xA8\x02\xF8\xF7\xF6\xF5\xF4\xF3\xF2\xF1#\x00\x01#\x00\x85\x9B\rO\x10\xE2\xB4F\x89 \xA2\x11b\f\xDA\t\xED\x04\xA4\x05\xF2\x02\xC9\x01J\x02\xA9\x00\xF4\x00\x82\x00\xF8\xF7\xF6\xF5\xF4\xF3\xF2\xF1#\x00\x01#\x00m\x18-S\x19\xD99F\xF4!@\x12i\rq\v\x9D\x06Z\a\xC1\x04\x04\x03\xD9\x03\xE2\x01\x15\x02\b\x02\xF8\xF7\xF6\xF5\xF4\xF3\xF2\xF1#\x00\x01#\x00\xD5m\xFDNh\xD
[20:45:01][D][uart_debug:158]: <<< " #E\x14\xE2\r\xA1\f\x1A\at\a\xF5\x05\xAD\x03\xA2\x04A\x02\xA8\x02\x9A\x02\xF8\xF7\xF6\xF5\xF4\xF3\xF2\xF1#\x00\x01#\x00*%\xCABB\xD6II\xD2"\x9D\x13\xD0\rP\f\x84\a$\ar\x05M\x03\xD5\x04\xB4\x02"\x03\xC8\x02\xF8\xF7\xF6\xF5\xF4\xF3\xF2\xF1#\x00\x01#\x00\xE4\x93\x11\x02\xD5\xD4\x11F\xA1!\x84\x14\b\x0F\x02\rM\b\xE1\a\xB4\x05M\x03H\x05\xAD\x02\xF5\x02\xD5\x02\xF8\xF7\xF6\xF5\xF4\xF3\xF2\xF1#\x00\x01#\x00\xCA\xA6\x95J9\xC8\x12C\xD5\x1F=\x13\x8D\r\x82\f]\a\x80\x06\xD2\x06\x89”

1 Like

I am wondering what are the pins RX TX called for on ESP boards while they should not be used for UART? I was trying even others, I think 9,10, 56, 57 and some others. Are some descriptions at the pins necessary to become UART interface? I was looking for that information but nothing found. Choosing GPIO1 and 2 was just a luck, I tried those that are close on the ESP32 board.
image

http://wiki.fluidnc.com/en/hardware/ESP32-S3_Pin_Reference

This is the usual go to resource for esp32 pins. I think there are other versions for newer esp32 variants. I’m not so sure about them. The table with info on gpios is a good resource.

From what I understand the RX and TX pins are usually the default for UART0 and so are usually used by the serial logger, and sharing it can sometimes cause problems. See hardware uarts.

Therefore sometimes it’s better to use other pins for your uart.

This is another good overview of esp32s.

I spent dozens of hours, procrastinating from my everyday job, to reach success by luck.

The ESP Home/UART Bus page says: “Any pair of GPIO pins can be used, as long as they support the proper output/input modes." What are >>>proper input/output modes”?

Elsewhere, they write that GPIO 1 and 3 could overlap with logger uart, I did not know that logger needs to have its own uart, which is probably the one that we should NOT use. However, these pins vary between boards, better not to mention them. These are the devils in the detail.

1 Like

So, I am at the end of the road, which is finally successful.

There were two experiments: make the Waveshare board work on ESP home and build a GPS tracker with the ESP32-S3 board. The latter was achieved as said, the waveshare is a bit different.

Waveshare operates on AT commands (does not produce NMEA messages) over uart with the GPS which is integrated into the LTE module A7670, which is actually SIM7600 chip.

I went through the documentation very carefully and realized that I need a custom c++ component for ESP Home for both: GPS and LTE (common GPS modules produce NMEA, Waveshare has an antenna and the module is on one chip with LTE). As I am not a programmer, I just did my best to understand the logic and possible architecture and then I wrote very specific prompt to ChatGPT o3mini designed for coding, who wrote the c++ library and some additional configurations (even GPS sensors have to be in the c++ of course because you cannot use TinyGPS library). It took me about five loops with some errors and the board is up. Yes, five loops, I feel this as a revolution. Previous models were not able to even have a solid discussion with me, this was amazing cooperation.

The AI won’t write it entirely, you must understand what you are doing and know specifics (Waveshare have differences in AT commands, such as powering it up, there is double SS) but without AI, I would write it down in a month. However, couple of such experiments and I will become coding myslef.

1 Like

and here is the final solution to it by professionals, as expected, only ESP IDF:
[modem] pppos tcp/ip for uart modem (esp-idf only) by oarcher · Pull Request #6721 · esphome/esphome

1 Like

Nice work and good on you for sharing back and raising a request.