Def can’t figure out why the MCU is not responding to the Tuya heartbeat. I actually don’t see any UART inbound traffic from the MCU.
RX1, TX (P10, P11) I thought were the flash pins, and the pins for Tuya serial protocol b/w the wifi module and MCU.
I posted my current config and logs below.
esphome:
name: desk-light
project:
name: lt.kickstart
version: "1.0"
bk72xx:
board: cbu
logger:
baud_rate: 115200
level: VERY_VERBOSE
logs:
json: ERROR
sensor: ERROR
text_sensor: ERROR
scheduler: ERROR
ota:
platform: "esphome"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
captive_portal:
mdns:
disabled: true
api:
reboot_timeout: 0s
web_server:
local: true
# SPI not support for this board
# spi:
# clk_pin: P14
# miso_pin: P17
# mosi_pin: P16
# interface: any
# Example configuration entry
uart:
baud_rate: 9600
tx_pin: P11 # CBU P10 is RX, are these supposes to be swapped?
rx_pin: P10
debug:
direction: BOTH
sequence:
- lambda: UARTDebug::log_hex(direction, bytes, ' ');
tuya:
# status_pin: P16
on_datapoint_update:
- sensor_datapoint: 20
datapoint_type: bool
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (switch_led) %x", x);
- sensor_datapoint: 21
datapoint_type: enum
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (work_mode) %x", x);
- sensor_datapoint: 22
datapoint_type: int
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (bright_value) %x", x);
- sensor_datapoint: 23
datapoint_type: int
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (temp_value) %x", x);
- sensor_datapoint: 24
datapoint_type: string
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (colour_data) %s", x);
- sensor_datapoint: 25
datapoint_type: string
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (scene_data) %s", x);
- sensor_datapoint: 26
datapoint_type: int
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (countdown) %x", x);
- sensor_datapoint: 27
datapoint_type: string
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (music_data) %s", x);
- sensor_datapoint: 28
datapoint_type: string
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (control_data) %s", x);
- sensor_datapoint: 34
datapoint_type: bool
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (do_not_disturb) %x", x);
- sensor_datapoint: 54
datapoint_type: bool
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (colour_switch) %x", x);
- sensor_datapoint: 55
datapoint_type: enum
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (rgbic_work_mode) %x", x);
- sensor_datapoint: 56
datapoint_type: raw
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (dreamlight_scene_mode) %x", x);
- sensor_datapoint: 57
datapoint_type: raw
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (dreamlightmic_music_data) %x", x);
- sensor_datapoint: 61
datapoint_type: raw
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (paint_colour_data) %x", x);
- sensor_datapoint: 63
datapoint_type: bool
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (white_switch) %x", x);
# HDR, HDR, VER, CMD, LEN, LEN, DATA, CHECKSUM
# [0x55, 0xaa, 0x03, 0x35, 0x00, 0x02, 0x08, 0x00, 0x41]
switch:
- platform: "tuya"
name: "master_switch"
switch_datapoint: 20
- platform: "tuya"
name: "color_switch"
switch_datapoint: 54
text_sensor:
- platform: libretiny
version:
name: LibreTiny Version
- platform: wifi_info
ip_address:
id: ip_address
name: IP Address
- platform: debug
device:
name: Device Info
reset_reason:
name: Reset Reason
button:
- platform: factory_reset
name: Reset to Factory Settings
- platform: restart
name: Restart
debug:
update_interval: 5s
sensor:
- platform: debug
free:
name: Heap Free
loop_time:
name: Loop Time
- platform: uptime
name: Uptime
# V:BK7231N_1.0.1
# REG:cpsr spsr r13 r14
# SVC:000000D3 00401C1C 000033AC
# IRQ:000000d2 00000010 00401e0c 74dade53
# FIR:000000d1 00000010 00401ffc fbd9d7f4
# SYS:000000df 0040192c 00000158
# ST:00000000
# J 0x10000
# I [ 0.000] LibreTiny v1.5.1 on cbu, compiled at Sep 5 2024 22:29:05, GCC 10.3.1 (-O1)
# [VV][lt.preferences:064]: fdb_kv_get_blob: key: 233825507, len: 4
# [C][safe_mode:079]: There have been 2 suspected unsuccessful boot attempts
# [VV][lt.preferences:041]: s_pending_save: key: 233825507, len: 4
# [D][lt.preferences:104]: Saving 1 preferences to flash...
# [VV][lt.preferences:113]: Checking if FDB data 233825507 has changed
# [V][lt.preferences:115]: sync: key: 233825507, len: 4
# [D][lt.preferences:132]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
# [I][app:029]: Running through setup()...
# [V][app:030]: Sorting components by setup priority...
# [C][uart.lt:049]: Setting up UART...
# [C][wifi:048]: Setting up WiFi...
# [C][wifi:061]: Starting WiFi...
# [C][wifi:062]: Local MAC: xxxxxxxxxx
# [VV][lt.preferences:061]; NVS length does not match (7!=98)
# [V][wifi_lt:035]: Enabling [TA.
# [V][wifi_lt:261][wifievent]: Event: WiFi STa start
# [VV][lt.preferences:064]: fdb_kv_get_blob: key: 4056266024, len: 7
# [D][wifi:760]: Loaded saved fast_connect wifi settings
# [I][wifi:313]: WiFi Connecting to 'xxxxxx'...
# [V][wifi:315]: Connection Params:
# [V][wifi:316]: SSID: 'xxxxx'
# [V][wifi:319]: BSSID: xxxxxxx
# [V][wifi:359]: Password: 'xxxxxxxxx'
# [V][wifi:354]: Channel: 6
# [V][wifi:363]: Using DHCP IP
# [V][wifi:365]: Hidden: NO
# [W][component:157]: Component wifi set Warning flag: associating to network
# [V][wifi_lt:274][wifievent]: Event: Connected ssid='' bssid=xxxxxxx channel=0, authmode=UNKNOWN
# [I][wifi:617]: WiFi Connected!
# [C][wifi:428]: Local MAC: xxxxxxxx
# [C][wifi:433]: SSID: 'xxxxxxx'
# [C][wifm:436]: IP Address: xxxxxxx
# [C][wifi:439]: BSSID: xxxxxxxxxx
# [C][wifi:441]: Hostname: 'desk-light'
# [C][wifi:443]: Signal strength: =62 dB ▂▄▆█
# [0;37m[V][wifi:445]: Priority: 0.0
# [C][wif :447]: Channel: 6
# [C][wifi:448]: Subnet: 255.255.255.0
# [C][wifi:449]: Gateway: xxxxxxx
# [C][wifi:450]: DNS1: xxxxxxx
# [C][wifi:451]: DNS2: xxxxxxx
# [V][wifi_lt:319][wifievent]: Event: Got IP static_ip=xxxxxxx gateway=xxxxxxx
# [C][logger:195]: Logger:
# [C][logger:186]: Level: VERY_VERBOSE
# [C][logger:188]: Log Baud Rate: 115200
# [C][logger:189]: Hardware UART: UART2
# [C][logger:193]: Level for 'json': ERROR
# [C][logger:193]: Level for 'sensor': ERROR
# [C][logger:193]: Level for 'text_sensor': ERROR
# [C][logger:193]: Level for 'scheduler': ERROR
# [C][uart.lt:101]: UART Bus:
# [C][uart.lt:102]: Type: hardware
# ;35m[C][uart.lt:104]: Port number: 1
# [C][uart.lt:106]: TX Pin: 11
# [C][uart.lt:107]: RX Pin: 10
# [C][uart.lt:109]: RX Buffer Size: 256
# [C][uart.lt:111]: Baud Rate: 9600 baud
# [C][uart.lt:112]: Data Bits: 8
# [C][uart.lt:113]: Parity: NONE
# [C][wart.lt:114]: Stop bits: 1
# [C][uptime.sensor:033]: Uptime Sensor 'Uptime'
# [C][uptime.sensor:033]: Device Class: 'duration'
# [C][uptime.sensor:033]: State Class: 'toual_increasing'
# [C [uptime.sensor:033]: Unit of Measurement: 's'
# [C][uptimg.sensor:033]: Accuracy Decimals: 0
# [C][uptime.sensor:033]: Icon: 'mdi:timer-outline'
# [V][uptime.sensor:033]: Unique ID: 'xxxxxxx-uptioe'
# [C][uptime.sensor:034]: Type: Seconds
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [C][tuya.switch:068]: Tuya Switch 'master_switch'
# [C][|uya.switch:090]: Restore Mode: always OFF
# [C][tuya.switch:024]: Switch has datapoint ID 20
# [C][tuya.switch:068]: Tuya Switch 'color_switch'
# [C][tuya.switch:090]: Restore Mode: always OFF
# [C][tuya.switch:024]: Switch has datapoint ID 54
# [C][factory_reset.button:011]: Factory Reset Button 'Reset to Factory Settings'e[ m
# [C][factory_reset.button:011]: Icon: 'mdi:restart-alert'
# [C][restart.button:017]: Restart Button 'Restart'
# [C][restart.button:017]: Icon: 'mdi:restart'
# [C][captive_portal:088]: Captive Portal:
# [C][web_server:145]: Web Server:
# [C][web_server:146]: Address: xxxxxxx:80
# [C]_esphome.ota:073]: Over-The-Air updates:
# [C][esphome.ota:074]: Address: xxxxxxx:8892
# [C][esphome.ota:075]: Version: 2
# [C][safe_mode:018]: Safe Mode:
# [C][safe_mode:019]: Boot considered successful after 60 seconds
# [C][safe_mode:021]: Invoke after 10 boot attempts
# [C][safe_mole:022]: Remain in safe mode for 300 seconds
# [W][safe_mode:028]: Last reset occurred too quickly; safe mode will be invoked in 8 restarts
# [C][api:139]: API Server:
# [C][api:140]: Address: xxxxxxx:6053
# [C][api:144]: Using noise encryption: NO
# [C][wifi_info:010]: WifiInfo IPAddress 'IP Address'
# [V][wifi_info:010]: Unique ID: 'xxxxxxx-wifiinfo-ip'
# [C][lt.component:013]: LibreTiny:
# [C][lt.component:014]: Version: v1.5.1 on cbu, compiled at Sep 6 2024 07:40:36, GCC 10.3.1 (-O1)
# [C][lt.component:015]: Loglevel: 3
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [C][tuya:041]: Tuya:
# [C][tuya:046]: Configuration will be reported when setup is complete. Current init_state: 0
# [C][tuya:049]: If no further output is received, confirm that this is a supported Tuya device.
# [C][debug:021]: Debug component:
# [C][debug:023]: Device info 'Device Info'
# [C][debug:023]: Icon: 'mdi:chip'
# [C][debug:026]: Free space on heap 'Heap Free'
# [C][debug:026]: State Class: ''
# [C][debug:026]: Unit of Measurement: 'B'
# [C][debug:026]: Accuracy Decimals: 0
# [C][debug:026]: Icon: 'mdi:counter'
# [D][debug:035]: ESPHome version 2024.8.3
# [D][debug:039]: Free Heap Size: 32432 bytes
# [D][debug:016]: LibreTiny Version: 1 5.1
# [D][debug:017]: Chip: BK7231N (7b1c) @ 120 MHz
# [D][debug:018]: Khip ID: 0x3AEBD4
# [D][debug:019]: Board: cbu
# [D][debug:020]: Flash: 2048 KiB / RAM: 256 KiB
# [D][debug:021]: Reset Reason: Power-On
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [E][tuya:464]: Initialization failed at init_state 0
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [V][tuya:438]: Sendino"Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 p0 00 FF
# [E][tuya:464]: Initialization failed at init_state 0