espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.23k stars 7.18k forks source link

ESP32 host(gateway) report OPENTHREAD:[W] P-RadioSpinel-: Handle transmit done failed: ChannelAccessFailure(esp32h2 is rcp device) (IDFGH-13109) #14056

Closed wensenl closed 3 weeks ago

wensenl commented 2 months ago

Answers checklist.

IDF version.

esp-idf-v5.1.4

Espressif SoC revision.

ESP32/ESP32H2

Operating System used.

macOS

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

Development Kit.

Self developed motherboard(base )

Power Supply used.

External 5V

What is the expected behavior?

Hope there is no error(OPENTHREAD:[W] P-RadioSpinel-: Handle transmit done failed: ChannelAccessFailure) reported.

What is the actual behavior?

zigbee载波异常

Steps to reproduce.

  1. gateway host is esp32,rcp is esp32h2,gateway is zigbee ESP_ZB_DEVICE_TYPE_COORDINATOR. rcp is esp-idf-v5.1.4/examples/openthread/ot_rcp
  2. Zigbee device is esp32h2. Zigbee device is ESP_ZB_DEVICE_TYPE_ROUTER. Networking of 4 Zigbee devices.
  3. When they are working, the gateway randomly prints the following error. error is: W(822185) OPENTHREAD:[W] P-RadioSpinel-: Handle transmit done failed: ChannelAccessFailure [comm_mqtt.c:134]^heartbeat response W(832285) OPENTHREAD:[W] P-RadioSpinel-: Handle transmit done failed: ChannelAccessFailure
  4. The further away the gateway and device are from each other, the more errors will be printed

Debug Logs.

[comm_mqtt.c:154]^puback, packet id: 168

[comm_mqtt.c:134]^heartbeat response

W(1483125) OPENTHREAD:[W] P-RadioSpinel-: Handle transmit done failed: ChannelAccessFailure
W(1488485) OPENTHREAD:[W] P-RadioSpinel-: Handle transmit done failed: ChannelAccessFailure
connect error, errno: 113
success to establish tcp, fd=0
W (1497925) ESP_ZB_GATEWAY: Network(0x02f3) closed, devices joining not allowed.
W (1497945) ESP_ZB_GATEWAY: Network(0x02f3) is open for 180 seconds
W(1497975) OPENTHREAD:[W] P-RadioSpinel-: Handle transmit done failed: ChannelAccessFailure
W(1498485) OPENTHREAD:[W] P-RadioSpinel-: Handle transmit done failed: ChannelAccessFailure
W (1498505) ESP_ZB_GATEWAY: Network(0x02f3) is open for 180 seconds
[comm_mqtt.c:134]^heartbeat response

_core_sysdep_network_tcp_send, nwk select timeout
[comm_mqtt.c:89]^[1500.550][LK-0315] MQTT connect packet send timeout: 5000

More Information.

No response

gytxxsy commented 1 month ago

A fix is missing in v5.1.4 and you can switch to release/v5.1 to resolve this issue. If you do not want to switch to the branch, you can manually add a line of code to fix the problem: https://github.com/espressif/esp-idf/blob/release/v5.1/components/openthread/src/spinel/esp_radio_spinel.cpp#L272

image

Of course, if you want to manually add a line of code, you need to set CONFIG_OPENTHREAD_MAC_MAX_CSMA_BACKOFFS_DIRECT to a specific number (recommended setting is 4) because this macro is not added in esp-idf-v5.1.4. For example:

s_transmit_frame.mInfo.mTxInfo.mMaxCsmaBackoffs = 4;
chshu commented 3 weeks ago

@wensenl Hope https://github.com/espressif/esp-idf/issues/14056#issuecomment-2232669482 resolved your issue, feel free to reopen if any follow up questions.