espressif / esp-hosted

Hosted Solution (Linux/MCU) with ESP32 (Wi-Fi + BT + BLE)
Other
711 stars 170 forks source link

NG solution Keep scanning when network card is running #361

Open Xiehanxin opened 7 months ago

Xiehanxin commented 7 months ago

same issue in linux 5.1/4.4 , esp32 module keep scanning request

811f856f-0e8c-4fb9-9a2a-c2aaaa56eb5b 427517a2-e821-4404-86c5-6b3362196b0a
mantriyogesh commented 7 months ago

@kapilkedawat ++

mantriyogesh commented 7 months ago

@Xiehanxin Can you help communicate following information to customer?

Is the AP they are trying to connect nearby and are they able to connect the same AP SSID and password using other device like mobile phone, when kept nearby ESP?

Some basic suggestions:

[A] use exact same git commit at both ESP and Linux [B] Make sure there is only one process of wpa_supplicant running Check https://github.com/espressif/esp-hosted/tree/master/esp_hosted_ng#311-wi-fi It does sudo killall wpa_supplicant and then starts new instance of wpa_supplicant [C] you can add -d in wpa_supplicant command to get the debug logs. These debug logs will help a lot to understand what is ongoing at wpa_supplicant. [D] Use master branch for your testing.

Logs

  1. ESP logs: Set ESP side default logging to 'Debug' using
    $ idf.py menuconfig

    Navigate to (Top) → Component config → Log output → Default log verbosity and change log level to Debug and re-flash ESP using latest master

Flash ESP and get full textual logs from starting

  1. Full textual Linux dmesg log from bootup

  2. wpa_supplicant debug textual logs with option -d added (see above [C])

  3. Possibly a full sniffer capture, which will pinpoint the issue (start sniffer before triggering connect)

kapilkedawat commented 7 months ago

Hi @Xiehanxin, wpa_supplicant issues scan periodically to update its scan cache and find relevant AP provided in network configuration(which is an expected and default behavior).

What is the exact issue here? Is station not able to connect if correct credentials are provided or just that we are seeing periodical scan request.

Xiehanxin commented 7 months ago

hi @kapilkedawat @mantriyogesh here is the debug log esp32.log nuc980.log

kapilkedawat commented 7 months ago

Hi @Xiehanxin, espsta0 is not able to find the AP during the scan. Is the AP present in the vicinity of client?

linjif commented 7 months ago

There are multiple WiFi access points (APs) around the espsta0 device, and the PC can connect normally. However, there are instances where using the iw dev espsta0 scan command also fails to detect any AP hotspots.

linjif commented 7 months ago

@kapilkedawat There are multiple WiFi access points (APs) around the espsta0 device, and the PC can connect normally. However, there are instances where using the iw dev espsta0 scan command also fails to detect any AP hotspots.

mantriyogesh commented 7 months ago

The ESP wifi log can be confirmed by Kapil (the team would be on regional holiday)

I am wondering why the capabilities are not populated:

esp32_sdio: print_capabilities: Capabilities: 0x0. Features supported are:
  1. Are these capabilities always coming 0? Surprisingly, In your earlier log, you had espsta0 Mac address updated fine.

  2. As I remember, you used to connect using the PCB. But the pull up registers were not correct earlier. Are the pull up registers corrected (cmd, d0-d3) need to be minimum 10k ohm.

  3. Is it possible to run raw throughout first, before jumping to wifi, just to make sure your transport is correct and stable? Raw throughout: https://github.com/espressif/esp-hosted/blob/master/esp_hosted_ng/docs/Raw_TP_Testing.md Please test rx and tx both sides individually.

kapilkedawat commented 7 months ago

Hi @linjif, given that transport is correct and verified and external antenna is attached properly. Please try with attached patch and share logs from starting till issue occurs. 0001-esp_hosted_ng-Add-scan-logging.patch

MacChu0315-Espressif commented 7 months ago

Hi @kapilkedawat, i was trying to build the ng bin for our customer but encountered some issue. I used the latest esp-hosted and applied the patch you provied, can you take a look? 企业微信截图_17127192061990

KenKang2015 commented 7 months ago

The ESP wifi log can be confirmed by Kapil (the team would be on regional holiday)

I am wondering why the capabilities are not populated:

esp32_sdio: print_capabilities: Capabilities: 0x0. Features supported are:
  1. Are these capabilities always coming 0? Surprisingly, In your earlier log, you had espsta0 Mac address updated fine.
  2. As I remember, you used to connect using the PCB. But the pull up registers were not correct earlier. Are the pull up registers corrected (cmd, d0-d3) need to be minimum 10k ohm.
  3. Is it possible to run raw throughout first, before jumping to wifi, just to make sure your transport is correct and stable? Raw throughout: https://github.com/espressif/esp-hosted/blob/master/esp_hosted_ng/docs/Raw_TP_Testing.md Please test rx and tx both sides individually. Hi @kapilkedawat iIn the early stage, I used device debugging, but now I'm using development board debugging. T development board has pull up registers(cmd,d0-d3) for 10K ohm. and in development board,using ESP32-WROOM-32E .Regarding the third point, I'll give it a try,
kapilkedawat commented 7 months ago

Hi @kapilkedawat, i was trying to build the ng bin for our customer but encountered some issue. I used the latest esp-hosted and applied the patch you provied, can you take a look? 企业微信截图_17127192061990

Please follow the instructions here first to setup the environment or use export.sh to setup the env. Apply the patch after that(since export.sh resets the changes) and the try to compile.

MacChu0315-Espressif commented 7 months ago

Please follow the instructions here first to setup the environment or use export.sh to setup the env. Apply the patch after that(since export.sh resets the changes) and the try to compile.

Hi @kapilkedawat, the firmware has been provided to the customer, thank you!

KenKang2015 commented 7 months ago

Hi @kapilkedawat,,The log of the firmware test using the new firmware is as follows: nuc980.log esp322.log

kapilkedawat commented 7 months ago

Hi @KenKang2015, from the logs, esp32 is forwarding beacons and probe response to host.

FW_CMD: handle_wpa_sta_rx_mgmt:654 beacon frame RSSI=-33 FW_CMD: handle_wpa_sta_rx_mgmt:659 probe response RSSI=-66 wifi:Send scan done event: status=0, apnum=9 FW_CMD: Wifi scan done event

Could you please not daemonize wpa_supplicant and add extra logging mode(-d) to see what's happening.

wpa_supplicant -i espsta0 -c wpa_supplicant.conf -dd &

Also please share content of wpa_supplicant.conf file.

KenKang2015 commented 7 months ago

Hi @kapilkedawat using "pa_supplicant -i espsta0 -c wpa_supplicant.conf -dd &" for log nuc980.log esp322.log

kapilkedawat commented 7 months ago

Hi @KenKang2015, Please check 3 point of https://github.com/espressif/esp-hosted/issues/361#issuecomment-2045085662 . We need to verify the SDIO transport and its working correctly. I see that esp32 is sending the scan results whereas supplicant is not seeing any.

Also does customer has any local modification in the driver, if yes, we would like to check if that is not causing any issue.

KenKang2015 commented 7 months ago

Hi @kapilkedawat

How do I modify the source code to achieve the functionality of "./rpi_init.sh sdio rawtp_esp_to_host"? because I'm using cross-compilation.,compile on Ubuntu 22, run on NUC980 (ARM9).

kapilkedawat commented 7 months ago

rawtp code is always compiled in, we just need to pass argument during insmod. please use sudo insmod esp32_sdio.ko $RESETPIN raw_tp_mode=1 # for host to esp sudo insmod esp32_sdio.ko $RESETPIN raw_tp_mode=2 # for esp to host

KenKang2015 commented 7 months ago

Hi @kapilkedawat, with using "insmod esp32_sdio.ko $RESETPIN raw_tp_mode=2 # for esp to host" command ,the log is: nuc980-foresp2host.log esp32-foresp2host.log with using "insmod esp32_sdio.ko $RESETPIN raw_tp_mode=1 # for host to esp" command ,the log is: nuc980-forhost2esp.log esp32-forhost2esp.log

Shreyas0-7 commented 7 months ago

Hey @KenKang2015 As we can check from logs the raw throughput between ESP and Host is 0, which implies there is some problem with connection of ESP and Host. I suspect this is reason why you are facing issues you mentioned earlier. Can you please verify your connection once again?

MacChu0315 commented 7 months ago

Hi @kapilkedawat, Our customer performed Troubleshoot Instructions - 1 and offers messages from linux and debug log from esp, can you take a look?

messages_20240418.txt

ded364e7-1d59-44b8-8f7f-4f30b1b5d030

kapilkedawat commented 7 months ago

Hi @MacChu0315, did you load the driver(esp32_sdio.ko) using insmod? messages_20240418.txt doesn't show that it was loaded.

jiajia13201845317 commented 7 months ago

Hi @kapilkedawat , the customer provide test information in the attachment, could you please help checkout ? Thanks ! test_picture 20240419_message.txt

kapilkedawat commented 7 months ago

Hi @jiajia13201845317, Please help customer to capture dmesg correctly. We need to dmesg when customer loaded the kernel module(ie insmod esp32_sdionew.ko). Provided logs doesn't show any of those logs.

Also please confirm that the pull-up b/w esp and broad matches our SDIO pull-up requirements.