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

WIFI bootloop #295

Open
ianchi opened this issue Sep 16, 2024 · 3 comments
Open

WIFI bootloop #295

ianchi opened this issue Sep 16, 2024 · 3 comments

Comments

@ianchi
Copy link
Contributor

ianchi commented Sep 16, 2024

Hi, I have a CBU module from a AT/Tongou TO_Q_SY1_JWT that gets into bootloop when adding the WIFI component.

I have flashed many other identical devices with no problem, but this one doesn't start.

I tried with a totally bare config and added a few components, to find the offending one is WIFI

Any suggestion to debug it?

WORKING YAML

substitutions:
  node_id: bare-bk
  verbose_name: "Bare"

esphome:
  #name_add_mac_suffix: true
  name: ${node_id}
  comment: ${verbose_name}
 
preferences:
  flash_write_interval: 1s

bk72xx:
  board: cbu

  framework:
    loglevel: verbose
    debug:
      - wifi
      - ota

logger:
  level: VERY_VERBOSE
  hardware_uart: UART1

status_led:
  pin:
    number: P15
    inverted: true

switch:
  - platform: gpio
    name: ${verbose_name}
    pin: P26
    id: relay
    restore_mode: RESTORE_DEFAULT_ON

binary_sensor:
  - platform: gpio
    id: hard_button
    pin:
      number: P17
      inverted: true
    on_click:
      - switch.toggle: relay
      - output.turn_on: led_red
      - delay: 10s
      - output.turn_off: led_red

output:
  - platform: gpio
    id: led_red
    pin:
      number: P9
      inverted: true

Offending config

Above config boots and works well. It fails if I add:

wifi:
  ssid: MY-SSID
  password: "MyWifiPswd"

Serial Log Output

I [      0.022] logger
[C][status_led:014]: Setting up Status LED...
[I][app:029]: Running through setup()...
[V][app:030]: Sorting components by setup priority...
[VV][scheduler:063]: set_interval(name='', interval=1000, offset=466)
[C][switch.gpio:011]: Setting up GPIO Switch 'Bare'...
[VV][lt.preferences:064]: fdb_kv_get_blob: key: 1274655749, len: 1
[D][switch:016]: 'Bare' Turning OFF.
[VV][lt.preferences:041]: s_pending_save: key: 1274655749, len: 1
[D][switch:055]: 'Bare': Sending state OFF
[D][switch:016]: 'Bare' Turning OFF.
[D][binary_sensor:034]: 'hard_button': Sending initial state OFF
[C][wifi:048]: Setting up WiFi...
[C][wifi:061]: Starting WiFi...
[C][wifi:062]:   Local MAC: 1C:90:FF:15:07:49
[VV][lt.preferences:061]: NVS length does not match (0!=98)
[V][wifi_lt:035]: Enabling STA.
D [      0.112] WIFI: Mode changing NULL -> STA
D [      0.116] WIFI: Initializing func&app

It repeats the loop every 10s or so.

Another weird thing with this chip is that I get a bunch of CRC missmatch while checking chip type! in ltchiptool while flashing.
After a couple of retries it flash though.

I also tried two different power sources to rule out power issues, but it gets in bootloop with both.

By the way, @kuba2k2 congrats on the great work you've done with this project!!

@kuba2k2
Copy link
Member

kuba2k2 commented Sep 17, 2024

Make sure your power supply is good enough. This issue is usually caused by a weak power supply, bad wires etc.

@dwmw2
Copy link
Contributor

dwmw2 commented Sep 19, 2024

Don't leave P26 on either; that might not be helping with the power stability. See https://devices.esphome.io/devices/Tongou-TO-Q-SY1-JWT for a sample config which pulses P24 to close the relay and P26 to open it. (Which will be even simpler once esphome/esphome#7421 is merged).

Does this problem still happen if you use LWIP 2.1.3 which was in the LibreTiny 1.6.0 and earlier releases?

@numaiiiir
Copy link

Hi, I have a CBU module from a AT/Tongou TO_Q_SY1_JWT that gets into bootloop when adding the WIFI component.

I have flashed many other identical devices with no problem, but this one doesn't start.

I tried with a totally bare config and added a few components, to find the offending one is WIFI

Any suggestion to debug it?

WORKING YAML

substitutions:
  node_id: bare-bk
  verbose_name: "Bare"

esphome:
  #name_add_mac_suffix: true
  name: ${node_id}
  comment: ${verbose_name}
 
preferences:
  flash_write_interval: 1s

bk72xx:
  board: cbu

  framework:
    loglevel: verbose
    debug:
      - wifi
      - ota

logger:
  level: VERY_VERBOSE
  hardware_uart: UART1

status_led:
  pin:
    number: P15
    inverted: true

switch:
  - platform: gpio
    name: ${verbose_name}
    pin: P26
    id: relay
    restore_mode: RESTORE_DEFAULT_ON

binary_sensor:
  - platform: gpio
    id: hard_button
    pin:
      number: P17
      inverted: true
    on_click:
      - switch.toggle: relay
      - output.turn_on: led_red
      - delay: 10s
      - output.turn_off: led_red

output:
  - platform: gpio
    id: led_red
    pin:
      number: P9
      inverted: true

Offending config

Above config boots and works well. It fails if I add:

wifi:
  ssid: MY-SSID
  password: "MyWifiPswd"

Serial Log Output

I [      0.022] logger
[C][status_led:014]: Setting up Status LED...
[I][app:029]: Running through setup()...
[V][app:030]: Sorting components by setup priority...
[VV][scheduler:063]: set_interval(name='', interval=1000, offset=466)
[C][switch.gpio:011]: Setting up GPIO Switch 'Bare'...
[VV][lt.preferences:064]: fdb_kv_get_blob: key: 1274655749, len: 1
[D][switch:016]: 'Bare' Turning OFF.
[VV][lt.preferences:041]: s_pending_save: key: 1274655749, len: 1
[D][switch:055]: 'Bare': Sending state OFF
[D][switch:016]: 'Bare' Turning OFF.
[D][binary_sensor:034]: 'hard_button': Sending initial state OFF
[C][wifi:048]: [192.168.1.128]Setting up WiFi...
[C][wifi:061]: Starting WiFi...
[C][wifi:062]:   Local MAC: 1C:90:FF:15:07:49
[VV][lt.preferences:061]: NVS length does not match (0!=98)
[V][wifi_lt:035]: Enabling STA.
D [      0.112] WIFI: Mode changing NULL -> STA
D [      0.116] WIFI: Initializing func&app

It repeats the loop every 10s or so.

Another weird thing with this chip is that I get a bunch of CRC missmatch while checking chip type! in ltchiptool while flashing.
After a couple of retries it flash though.

I also tried two different power sources to rule out power issues, but it gets in bootloop with both.

By the way, @kuba2k2 congrats on the great work you've done with this project!!

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

4 participants