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

Can't connect to wifi AP using CLI when coexistence is enabled (TZ-465) #51

Closed
theomeyer-tado opened this issue Dec 4, 2023 · 2 comments

Comments

@theomeyer-tado
Copy link
Contributor

theomeyer-tado commented Dec 4, 2023

When CONFIG_EXTERNAL_COEX_ENABLE is set to both ot_rcp and esp-thread-br config, connection to Wi-Fi using the CLI wifi connect -s my_ssid -p my_pass is failing. With coexistence disabled, the connection is successful.
If coexistence is enabled, but Wi-Fi connection initiated using the protocol_examples_common component, then the connection is succesfull (but it's expected since coexistence is only really enabled later in the code).

I'm using a custom board based on the Espressif ESP-Thread BR&Zigbee GW rev1.1. The wiring is slightly different though and I'm using pin 12, 13 and 14 of the ESP32-S3 for COEX_PRIORITY, COEX_REQUEST and COEX_GRANT respectively. It is configured as such in the sdkconfig of esp-thread-br :

#
# External coexist wire type and pin config
#
CONFIG_ESP_WIFI_EXTERNAL_COEXIST_ENABLE=y
CONFIG_EXTERNAL_COEX_ENABLE=y
CONFIG_EXTERNAL_COEX_WIRE_TYPE=2
CONFIG_EXTERNAL_COEX_REQUEST_PIN=13
CONFIG_EXTERNAL_COEX_GRANT_PIN=14
CONFIG_EXTERNAL_COEX_PRIORITY_PIN=12
# end of External coexist wire type and pin config

In the output log, one line is interesting :

I (14958) wifi:Set ps type: 0, coexist: 0

coexist is alway 0, wich or without CONFIG_EXTERNAL_COEX_ENABLE.

After boot and before issuing the wifi connect command, the state of the PTA pins are as follow :

  • WL_ACTIVE (grant) = LOW
  • BT_ACTIVE (request) = HIGH
  • BT_PRIORITY (priority)= LOW

During the command execution :

  • WL_ACTIVE (grant) = HIGH
  • BT_ACTIVE (request) = HIGH (no change)
  • BT_PRIORITY (priority)= LOW (no change)

After the command execution :

  • WL_ACTIVE (grant) = HIGH
  • BT_ACTIVE (request) = HIGH
  • BT_PRIORITY (priority)= LOW

Full log output :

I (27) boot: ESP-IDF v5.1.1 2nd stage bootloader
I (27) boot: compile time Dec  4 2023 15:36:29
I (27) boot: Multicore bootloader
I (30) boot: chip revision: v0.2
I (34) boot.esp32s3: Boot SPI Speed : 80MHz
I (39) boot.esp32s3: SPI Mode       : DIO
I (43) boot.esp32s3: SPI Flash Size : 4MB
I (48) boot: Enabling RNG early entropy source...
I (54) boot: Partition Table:
I (57) boot: ## Label            Usage          Type ST Offset   Length
I (64) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (72) boot:  1 otadata          OTA data         01 00 0000f000 00002000
I (79) boot:  2 phy_init         RF data          01 01 00011000 00001000
I (87) boot:  3 ota_0            OTA app          00 10 00020000 00190000
I (94) boot:  4 ota_1            OTA app          00 11 001b0000 00190000
I (102) boot:  5 web_storage      Unknown data     01 82 00340000 00019000
I (109) boot:  6 rcp_fw           Unknown data     01 82 00359000 000a0000
I (117) boot: End of partition table
I (121) boot: No factory image, trying OTA 0
I (126) esp_image: segment 0: paddr=00020020 vaddr=3c100020 size=535b8h (341432) map
I (196) esp_image: segment 1: paddr=000735e0 vaddr=3fc98000 size=054fch ( 21756) load
I (201) esp_image: segment 2: paddr=00078ae4 vaddr=40374000 size=07534h ( 30004) load
I (208) esp_image: segment 3: paddr=00080020 vaddr=42000020 size=f7a14h (1014292) map
I (392) esp_image: segment 4: paddr=00177a3c vaddr=4037b534 size=0c9c8h ( 51656) load
I (412) boot: Loaded app from partition at offset 0x20000
I (441) boot: Set actual ota_seq=1 in otadata[0]
I (441) boot: Disabling RNG early entropy source...
I (452) cpu_start: Multicore app
I (452) cpu_start: Pro cpu up.
I (452) cpu_start: Starting app cpu, entry point is 0x4037555c
0x4037555c: call_start_cpu1 at C:/Users/theo.meyer/Documents/Firmware/esp-idf/components/esp_system/port/cpu_start.c:154

I (0) cpu_start: App cpu up.
I (470) cpu_start: Pro cpu start user code
I (470) cpu_start: cpu freq: 160000000 Hz
I (470) cpu_start: Application information:
I (473) cpu_start: Project name:     XXXX
I (478) cpu_start: App version:      6dae8bf37-dirty
I (484) cpu_start: Compile time:     Dec  4 2023 15:36:14
I (490) cpu_start: ELF file SHA256:  24f7a90465f51518...
I (496) cpu_start: ESP-IDF:          v5.1.1
I (501) cpu_start: Min chip rev:     v0.0
I (505) cpu_start: Max chip rev:     v0.99
I (510) cpu_start: Chip rev:         v0.2
I (515) heap_init: Initializing. RAM available for dynamic allocation:
I (522) heap_init: At 3FCAEEF0 len 0003A820 (234 KiB): DRAM
I (528) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DRAM
I (535) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (541) heap_init: At 600FE010 len 00001FD8 (7 KiB): RTCRAM
I (548) spi_flash: detected chip: gd
I (552) spi_flash: flash io: dio
W (556) spi_flash: Detected size(16384k) larger than the size in the binary image header(4096k). Using the size in the binary image header.
I (569) sleep: Configure to isolate all GPIO pins in sleep state
I (576) sleep: Enable automatic switching of GPIO sleep configuration
I (583) coexist: coex firmware version: 80b0d89
I (588) coexist: coexist rom version e7ae62f
I (593) app_start: Starting scheduler on CPU0
I (598) app_start: Starting scheduler on CPU1
I (598) main_task: Started on CPU0
I (608) main_task: Calling app_main()
�������������I (688) gpio: GPIO[11]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
I (698) OPENTHREAD: spinel SPI interface initialization completed
I (698) obtr_web: <=======================server start========================>

I (708) obtr_web: http://0.0.0.0:80/index.html

I(708) OPENTHREAD:[I] Platform------: RCP reset: RESET_POWER_ON
I(718) OPENTHREAD:[I] Platform------: Software reset RCP successfully
I (718) obtr_web: <===========================================================>

I (698) main_task: Returned from app_main()
I(798) OPENTHREAD:[I] ChildSupervsn-: Timeout: 0 -> 190
I (808) esp_ot_br: Internal RCP Version: openthread-esp32/e088c3766b-5beae1437; esp32h2;  2023-12-04 14:34:50 UTC
I (808) esp_ot_br: Running  RCP Version: openthread-esp32/e088c3766b-5beae1437; esp32h2;  2023-12-04 14:34:50 UTC
I (828) OPENTHREAD: OpenThread attached to netif
> >
> wifi connect -s my_ssid -p my_password

ssid: my_ssid 
psk: my_password
I (14848) pp: pp rom version: e7ae62f
I (14858) net80211: net80211 rom version: e7ae62f
I (14868) wifi:wifi driver task: 3fcb25e4, prio:23, stack:6144, core=0
I (14868) wifi:wifi firmware version: ce9244d
I (14868) wifi:wifi certification version: v7.0
I (14878) wifi:config NVS flash: enabled
I (14878) wifi:config nano formating: enabled
I (14878) wifi:Init data frame dynamic rx buffer num: 32
I (14888) wifi:Init management frame dynamic rx buffer num: 32
I (14888) wifi:Init management short buffer num: 32
I (14898) wifi:Init dynamic tx buffer num: 32
I (14908) wifi:Init static tx FG buffer num: 2
I (14908) wifi:Init static rx buffer size: 1600
I (14908) wifi:Init static rx buffer num: 10
I (14918) wifi:Init dynamic rx buffer num: 32
I (14918) wifi_init: rx ba win: 6
I (14918) wifi_init: tcpip mbox: 32
I (14928) wifi_init: udp mbox: 6
I (14928) wifi_init: tcp mbox: 6
I (14928) wifi_init: tcp tx win: 5744
I (14938) wifi_init: tcp rx win: 5744
I (14948) wifi_init: tcp mss: 1440
I (14948) wifi_init: WiFi IRAM OP enabled
I (14958) wifi_init: WiFi RX IRAM OP enabled
I (14958) wifi:Set ps type: 0, coexist: 0

I (14958) phy_init: phy_version 601,98f2a71,Jun 29 2023,09:58:12
I (15008) wifi:mode : null
I (15008) wifi:mode : sta (48:27:e2:20:7f:2c)
I (15008) wifi:enable tsf
wifi reconnecting...
wifi reconnecting...
W (19628) wifi:m f probe req l=0
wifi reconnecting...
W (33548) wifi:m f probe req l=0
W (33678) wifi:m f probe req l=0
W (33798) wifi:m f probe req l=0
W (33918) wifi:m f probe req l=0
W (34038) wifi:m f probe req l=0
W (34158) wifi:m f probe req l=0
W (34288) wifi:m f probe req l=0
W (34408) wifi:m f probe req l=0
W (34528) wifi:m f probe req l=0
W (34648) wifi:m f probe req l=0
wifi reconnecting...
W (35008) wifi:m f probe req l=0
W (35128) wifi:m f probe req l=0
W (35248) wifi:m f probe req l=0
W (35368) wifi:m f probe req l=0
W (35498) wifi:m f probe req l=0
W (35618) wifi:m f probe req l=0
W (35738) wifi:m f probe req l=0
W (35858) wifi:m f probe req l=0
W (35988) wifi:m f probe req l=0
W (36108) wifi:m f probe req l=0
W (36228) wifi:m f probe req l=0
W (36718) wifi:m f probe req l=0
wifi reconnecting...
W (36838) wifi:m f probe req l=0
W (36958) wifi:m f probe req l=0
W (37088) wifi:m f probe req l=0
W (37208) wifi:m f probe req l=0
W (37328) wifi:m f probe req l=0
W (37448) wifi:m f probe req l=0
W (37578) wifi:m f probe req l=0
W (37698) wifi:m f probe req l=0
W (37818) wifi:m f probe req l=0
W (37938) wifi:m f probe req l=0
W (38428) wifi:m f probe req l=0
wifi reconnecting...
W (38548) wifi:m f probe req l=0
W (38678) wifi:m f probe req l=0
...
...
...
W (39528) wifi:m f probe req l=0
W (39648) wifi:m f probe req l=0
wifi reconnecting...
W (45008) wifi:TX Q not empty: 500, TXQ_BLOCK=0
W (45008) wifi:force witi stop
I (45008) wifi:flush txq
I (45008) wifi:stop sw txq
I (45008) wifi:lmac stop hw txq
W (45008) wifi:sw txq[0] state(1) is not idle, potential error!
W (45018) ot_ext_cli: Connection time out, please check your ssid & password, then retry.
wifi sta connection is failed
Done
>

@github-actions github-actions bot changed the title Can't connect to wifi AP using CLI when coexistence is enabled Can't connect to wifi AP using CLI when coexistence is enabled (TZ-465) Dec 4, 2023
@theomeyer-tado
Copy link
Contributor Author

If I disconnect BT_ACTIVE signal, the connection happen successfully. I guess the BT_ACTIVE default state should be low but it's not. Also when I start the thread border router, there is no activity on this pin. SO I suspect the issue might come from the RCP
(ESP32-H2) side.

@theomeyer-tado
Copy link
Contributor Author

I was using IDF v5.1.1 and the feature has been introduced in ot_rcp from IDF v5.1.2.
Adding the external coexistence initialization to the ot_task_worker after esp_openthread_init was sufficient to make it work.

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

1 participant