Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LD2420 triggers boot loop due WDT on ESP32S3 #5705

Open
andyvandesand opened this issue Apr 17, 2024 · 4 comments
Open

LD2420 triggers boot loop due WDT on ESP32S3 #5705

andyvandesand opened this issue Apr 17, 2024 · 4 comments

Comments

@andyvandesand
Copy link

andyvandesand commented Apr 17, 2024

The problem

I'm trying to get an LD2420 to work with an ESP32-S3, the waveshare s3-zero version. As the specific board profile isn't available yet I've already tried changing some paramters, without success. I've tried just the UART without the LD2420, that's working fine. Other pins don't seem to change much either. When monitoring the uart I can see the sensor actually providing valid data, but then the WDT resets the chip.

The sensor is working on an ESP32-WROOM-32E.

Any help would be appreciated...

EDIT: removed external components to narrow down the issue

Which version of ESPHome has the issue?

2024.4.0

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2024.4.0

What platform are you using?

ESP32

Board

Waveshare ESP32-S3-Zero

Component causing the issue

LD2420

Example YAML snippet

substitutions:
  name: esphome-web-529aa0
  friendly_name: "Theatre AC"
  # Unique device ID in HA
  deviceid: "thatreacesp"
  # Unique device name in HA
  devicename: "Theatre AC"

esphome:
  name: ${deviceid}
  friendly_name: ${devicename}
  name_add_mac_suffix: false
  platformio_options:
    board_build.flash_mode: dio
    board_build.f_cpu: 240000000L
    board_build.f_flash: 80000000L
    board_upload.maximum_ram_size: 327680
    board_upload.maximum_size: 4194304
    build_flags:
      - "-DBOARD_HAS_PSRAM"
      - "-DARDUINO_USB_MODE=1"
  project:
    name: esphome.web
    version: '1.0'

esp32:
  board: adafruit_feather_esp32s3
  flash_size: 4MB
  
  variant: ESP32S3
  framework:
    type: arduino
    

psram:
  mode: octal
  speed: 80MHz

# Enable logging
logger:

# Enable Home Assistant API
api:


# Allow Over-The-Air updates
ota:

# Allow provisioning Wi-Fi via serial
improv_serial:

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-529aa0"
    password: !secret wifi_backup

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/firmware/esphome-web/esp32s3.yaml@v2
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
#esp32_improv:
#  authorizer: none

# To have a "next url" for improv serial
#web_server:

uart:
  id: mmuart
  tx_pin: 7
  rx_pin: 8
  baud_rate: 115200
#  debug:
#    direction: BOTH
#    after:
#      delimiter: "\r\n"
#    sequence:
#      - lambda: UARTDebug::log_string(direction, bytes);

ld2420:

text_sensor:
  - platform: version
    name: ESPHome Version
  - platform: wifi_info
    ip_address:
      name: IP
    ssid:
      name: SSID
    bssid:
      name: BSSID
  - platform: ld2420
    fw_version:
      name: LD2420 Firmware

sensor:
  - platform: uptime
    name: Uptime
  - platform: wifi_signal
    name: WiFi Signal
    update_interval: 60s
  - platform: ld2420
    moving_distance:
      name : Moving Distance
#  - platform: internal_temperature
#    id: internaltemp
#    name: "Internal Temperature"


binary_sensor:
  - platform: ld2420
    has_target:
      name: Presence


select:
  - platform: ld2420
    operating_mode:
      name: Operating Mode

number:
  - platform: ld2420
    presence_timeout:
      name: Detection Presence Timeout
    min_gate_distance:
      name: Detection Gate Minimum
    max_gate_distance:
      name: Detection Gate Maximum
    # See "Number" section below for detail
    gate_select:
      name: Select Gate to Set
    still_threshold:
      name: Set Still Threshold Value
    move_threshold:
      name: Set Move Threshold Value

button:
  - platform: ld2420
    apply_config:
      name: Apply Config
    factory_reset:
      name: Factory Reset
    restart_module:
      name: Restart Module
    revert_config:
      name: Undo Edits
  - platform: restart
    name: Restart
    entity_category: diagnostic


  
light:
  - platform: esp32_rmt_led_strip
    id: rgbled
    rgb_order: RGB
    pin: GPIO21
    num_leds: 1
    rmt_channel: 1
    chipset: ws2812
    name: "Light"

#switch:
#  - platform: gpio
#    pin: 1
#    id: pin1
#    name: "pin1"

Anything in the logs that might be useful for us?

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40378c1e
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x39c
load:0x403c9700,len:0x9bc
load:0x403cc700,len:0x28dc
entry 0x403c98c0
[I][logger:158]: Log initialized
[C][ota:483]: There have been 0 suspected unsuccessful boot attempts.
[D][esp32.preferences:114]: Saving 1 preferences to flash...
[D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[I][app:029]: Running through setup()...
[C][uart.arduino_esp32:077]: Setting up UART...
[C][ld2420:114]: Setting up LD2420...
[D][ld2420:566]: Sending set config enable command: FF
E (10682) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (10682) task_wdt:  - loopTask (CPU 1)
E (10682) task_wdt: Tasks currently running:
E (10682) task_wdt: CPU 0: IDLE
E (10682) task_wdt: CPU 1: loopTask
E (10682) task_wdt: Aborting.
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40377590
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x39c
load:0x403c9700,len:0x9bc
load:0x403cc700,len:0x28dc
entry 0x403c98c0
[I][logger:158]: Log initialized
[C][ota:483]: There have been 1 suspected unsuccessful boot attempts.

Additional information

No response

@StreakingJerry
Copy link

Totally same issue with esp32c3

@fragpic
Copy link

fragpic commented Apr 22, 2024

Is the LD2420 connected to the board when you boot it?
The LD2420 component has an issue where if no data is seen on the RX pin at boot, it will bootloop.
#6594 is supposed to fix it

@andyvandesand
Copy link
Author

I just tried without the board attached at all, and it does the same.
Going off the fact that the LD actually sends data through the uart until the WDT resets when I monitor it I would assume this is purely a bug in the ld2420 library?

@andyvandesand
Copy link
Author

Sorry took me a while to get a local version setup. I can confirm this is at least a partial fix. There is still an issue, in that on every other cold power up the sensor just gets flagged as "failed". Restarting the board seems to fix this.
I don't have the required insight to fix this, but I'm very happy to do some local testing if anyone has any info for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants