espressif / esp-hosted

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

esp hosted fg error with -84 #242

Closed gauthamikosanam closed 1 year ago

gauthamikosanam commented 1 year ago

Hi I am using arm cortex a5d2x microprocessor as host and esp32 module as slave. In between this communication I am getting error. I have used fg 0.0.5 version and compiled in kernel and flashed the respective binaries in esp 32 module. Attaching the logs for both host and esp ,please let me know the solution. host_fg.txt esp_fg.txt esp_sdio: probe of mmc0:0001:1 failed with error -84

gauthamik9 commented 1 year ago

Hi Yogesh, I tried again with NG driver , it is working. This is the log of host. root@rugged-board-a5d2x-sd1:~# modprobe esp32_sdio.ko esp_probe: ESP network device detected Rx Pre ====== 0 Rx Pos ====== 0 Tx Pre ====== 0 Tx Pos ====== 10 esp_probe:793 esp_sdio: probe of mmc0:0001:2 failed with error -22 root@rugged-board-a5d2x-sd1:~# Received ESP bootup event EVENT: 3 ESP chipset detected [esp32] EVENT: 0 ESP peripheral capabilities: 0x1d ESP Bluetooth init Capabilities: 0x1d. Features supported are:

root@rugged-board-a5d2x-sd1:~# ifconfig -a can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:16 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:10 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:48

espsta0 Link encap:Ethernet HWaddr C4:DE:E2:63:56:8C
BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

eth0 Link encap:Ethernet HWaddr 04:91:62:D3:7A:C6
BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:28 Base address:0x8000

lo Link encap:Local Loopback
LOOPBACK MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

In Esp32 module flashed this image. 2023.03.16_NG_timingNP_1.0.2.zip

mantriyogesh commented 1 year ago

2023.03.16_NG_timingNP_1.0.2.zip

Please try with NP binaries with new host side code from master: commit: 5910e160d20e99d6ea9ab5a45c0bbdb6afa65629 -> https://github.com/espressif/esp-hosted/tree/5910e160d20e99d6ea9ab5a45c0bbdb6afa65629/esp_hosted_ng/host

let me know If this works, will create fg bins.

Please stick to binaries and host side git commit. no other commit should be used.

gauthamik9 commented 1 year ago

Hi Yogesh, For Fg driver, driver is loaded and created nodes in raspberry pi . How can I test for both station and ap mode. If I give this command getting error. wpa_supplicant -D nl80211 -i ethsta0 -c /etc/wpa_supplicant.conf & nl80211: Driver does not support authentication/association or connect commands nl80211: deinit ifname=ethsta0 disabled_11b_rates=0 ethsta0: Failed to initialize driver interface

gauthamik9 commented 1 year ago

I raspberry pi, for soft ap mode to test I am using c_support. In this I am getting protobuf-c.c no such file or directory. In protobuf-c folder .c file is not there. I tried with https://github.com/protobuf-c/protobuf-c.git but getting No such file or directory.

mantriyogesh commented 1 year ago

wpa_supplicant -D nl80211 -i ethsta0 -c /etc/wpa_supplicant.conf &

This is not the way to use FG driver, please check FG documentation.

mantriyogesh commented 1 year ago

I raspberry pi, for soft ap mode to test I am using c_support. In this I am getting protobuf-c.c no such file or directory.

If you follow the documentation correctly, you should not face this issue.

https://github.com/espressif/esp-hosted/blob/master/esp_hosted_fg/docs/Linux_based_host/Linux_based_readme.md#12-host-setup -> Clone ESP-Hosted code repository

gauthamik9 commented 1 year ago

In raspberrypi 3 model B+ , I am testing the soft ap mode,getting this error. pi@raspberrypi:~/Documents/esp_timing_fg/esp-hosted/esp_hosted_fg/host/linux/host_control/c_support $ sudo ./test.out set_softap_vendor_ie Enable heartbeat with duration 20 Heartbeat operation successful Freeing 0x0x350730 Success in set vendor specific ie

Requested operation complete Sleeping for some time just to showcase heartbeat 2023-08-18 17:48:12 > App EVENT: Heartbeat event [0] 2023-08-18 17:48:37 > App EVENT: Heartbeat event [1] Disable Heartbeat Heartbeat operation successful pi@raspberrypi:~/Documents/esp_timing_fg/esp-hosted/esp_hosted_fg/host/linux/host_control/c_support $ sudo ./test.out reset_softap_vendor_ie Enable heartbeat with duration 20 Heartbeat operation successful Success in set vendor specific ie

Requested operation complete Sleeping for some time just to showcase heartbeat 2023-08-18 17:49:15 > App EVENT: Heartbeat event [0] 2023-08-18 17:49:40 > App EVENT: Heartbeat event [1] Disable Heartbeat Heartbeat operation successful pi@raspberrypi:~/Documents/esp_timing_fg/esp-hosted/esp_hosted_fg/host/linux/host_control/c_support $ sudo ./test.out softap_start Enable heartbeat with duration 20 Heartbeat operation successful esp32 softAP started ethap0 interface down MAC address 30:ae:a4:10:95:59 set to ethap0 interface ethap0 interface up

Requested operation complete Sleeping for some time just to showcase heartbeat 2023-08-18 17:50:19 > App EVENT: Heartbeat event [0] 2023-08-18 17:50:44 > App EVENT: Heartbeat event [1] Disable Heartbeat Heartbeat operation successful

daemon --no-resolv --no-poll --dhcp-script=/system/bin/dhcp_announce --dhcp-range=192.168.4.1,192.168.4.20,1h

dnsmasq: failed to create listening socket for port 53: Address already in use

any suggestion.

mantriyogesh commented 1 year ago

dnsmasq is illustrated just as an example to show how higher layer can use the dhcp server. dnsmasq issues are out of scope for ESP-Hosted.

gauthamik9 commented 1 year ago

If I give this command ,getting the error. sudo python3 test.py start_softap --ssid ESP_WiFi --pwd ESP_WiFi@123 --channel 6 --sec_prot wpa_wpa2_psk --max_conn 9 --hide_ssid False --bw 40 control response timed out after 30 sec Response not received. ESP log:

I (957563) slave_ctrl: softap mode set I (957563) slave_ctrl: mac [30:ae:a4:10:95:59] I (957565) slave_ctrl: 30:ae:a4:10:95:59 I (957567) slave_ctrl: softap stop handler stop I (957571) wifi:Total power save buffer number: 32 I (957575) slave_ctrl: ssid ESP_Wifi pwd ESP_Wifi@123 authmode 4 ssid_hidden 0 max_conn 9 channel 6 I (957581) slave_ctrl: ESP32 SoftAP is avaliable I (957587) NETWORK_ADAPTER: Get softap mac address I (957591) NETWORK_ADAPTER: AP mac [30:ae:a4:10:95:59]

mantriyogesh commented 1 year ago

Is this same observed always in python and not in C? Or also fails in c some times?

gauthamik9 commented 1 year ago

Sometimes It is observed in C also. Done with sudo ./test.out set_softap_vendor ie sudo ./test.out reset_softap_vendor_ie sudo ./test.out softap_start

If I on Wifi in my mobile, ESPWifi can able to identify but connection is getting failed. ESP Log: I (311381) wifi:idx:2, tid:0 I (322105) wifi:new:<1,0>, old:<1,0>, ap:<1,1>, sta:<255,255>, prof:1 I (322107) wifi:station: 92:81:9d:a1:03:b2 join, AID=1, bgn, 20 I (322133) slave_ctrl: station 92:81:9d:a1:03:b2 join, AID=1 I (322149) wifi:idx:2 (ifx:1, 92:81:9d:a1:03:b2), tid:0, ssn:0, winSize:64 I (336583) wifi:station: 92:81:9d:a1:03:b2 leave, AID = 1, bss_flags is 658531, bss:0x3ffe3694 I (336583) slave_ctrl: station 92:81:9d:a1:03:b2 leave, AID=1 I (336585) wifi:new:<1,0>, old:<1,0>, ap:<1,1>, sta:<255,255>, prof:1 I (336587) slave_ctrl: mac [9c:63:fb:3f:9c:63]

I (336591) wifi:idx:2, tid:0

mantriyogesh commented 1 year ago

Most likely this is spi level timing issue. Please run raw throughput test both Tx and Rx) check raw TP doc

Which esp chipset is being used?

From porting guide at: https://github.com/espressif/esp-hosted/blob/master/esp_hosted_fg/docs/Linux_based_host/porting_guide.md#24-peripheral-configurations

Check all things ( smaller wires, smaller clk, timing tuning etc step by step)

gauthamik9 commented 1 year ago

Hi Yogesh, I am using esp32 wroom 32E module. In raspberry pi 3 model B + I am trying to connect station mode,but ip is not pinging. Attaching the logs of both host and esp. rasp_log.txt esp_log.txt

With python based approach, This is the log captured. esp_log.txt rasp_log.txt

mantriyogesh commented 1 year ago

As seen from logs, you can send the packets from host to esp. but esp to host packet are not sent some times. Also with combination, raspberry pi 3B+ <--sdio--> esp32 you do not need timing adjustment. so test with sdio timing =0;

mantriyogesh commented 1 year ago

Make sure that you have very small wires and external pull-ups in place. if you do not do these two things, you may still face issues.

gauthamik9 commented 1 year ago

Can I use fg 0.0.5 version for both host and esp ?

mantriyogesh commented 1 year ago

yes you can. option 1. make sure the git commit is matched at host to one on which release is made. option 2. I had also sent you timing adjust binaries and their expected host commit. if you are on same commit, you can just switch to fg binries without timing adjustment.

are external pull-ups and shorter length wires used?

gauthamik9 commented 1 year ago

I have used esp fg 0.0.5 version . Flashed the respective binaries in esp module. This is the log captured. Getting read packet error -85. rasp_log.txt esp_log.txt

mantriyogesh commented 1 year ago

setup image?

gauthamik9 commented 1 year ago

setup

mantriyogesh commented 1 year ago

I strongly suspect the pull-ups are not working in your case. We use external pull-ups with 51K Ohm with same setup, with pcb, works fine:

Raspberry Pi 3B+ <-- sdio --> esp32.

gauthamik9 commented 1 year ago

I used 10K Ohm pull-ups externally,is not sufficient?

mantriyogesh commented 1 year ago

is sufficient. So you mean you try ng and works on same setup and fg doesn't work (both with RaspberryPi - SDIO - ESP32)?

gauthamik9 commented 1 year ago

I want soft ap mode ,so switched to fg driver. Once I want to test with raspberry pi ,if it works fine then I need switch to arm cortex processor.So testing on raspberry pi to understand better.Please let me know further how to proceed.

mantriyogesh commented 1 year ago

As you had said in earlier comments, your ng driver works but fg doesn't (on your hardware). Which is strange as at transport layer, both are same.

Considering Raspberry Pi, your FG doesn't work, with error -84. this is typically issue when the communication is not correct in between slave and host. reasons vary like signal integrity issue, external pull-ups not present etc.

You had claimed the ng worked and fg didn't work for your hardware. is it the same observation in case of fg on Raspberry Pi?

gauthamik9 commented 1 year ago

In arm cortex processor--esp32--sdio, used https://github.com/espressif/esp-hosted/commit/8cb1ccb4da87da952b3b28e5544c849c1dcd7b67 commit it is compiled and probe also working. ESP module is flashed with https://github.com/espressif/esp-hosted/files/12288782/2023.08.08_gh242_sdio_timingchange_ESP32_sdio.tgz binaries.But need to test both station and soft ap mode.Previously for ng driver used wpa_supplicant and udhcpd commands for connectivity,here in fg driver it is not supporting those same commands to test station mode.

For raspberry pi , tested with host side commit is https://github.com/espressif/esp-hosted/commit/8cb1ccb4da87da952b3b28e5544c849c1dcd7b67 and esp module is flashed with https://github.com/espressif/esp-hosted/files/12288782/2023.08.08_gh242_sdio_timingchange_ESP32_sdio.tgz but while testing dhclient is not confgured.Ip is not set.This is the issue facing in raspberrypi.

gauthamik9 commented 1 year ago

Dear Yogesh, Please let me know how to proceed further with raspberry pi , with the above setup not able to get response from esp to host for the below command. $ sudo python3 ./test.py connect_ap --ssid PHYIN_TEST --pwd Phytec@2023

mantriyogesh commented 1 year ago

Hello @gauthamikosanam @gauthamik9

Were you able to run the NG on Raspberry Pi?

gauthamik9 commented 1 year ago

Yes Yogesh, It is working and able to connect with the router using wpa_supplicant and udhcpd commands.In similar way,tested with my arm processor ----esp32 combination setup also.It is working. In similar way I want to test the FG driver to set the configuration for AP mode. Need your support to complete this task.

mantriyogesh commented 1 year ago

So you mean Raspberry Pi works with NG and not with FG. just similar to your board?

gauthamik9 commented 1 year ago

After sdio timing changed in esp, the driver is working in both configuration. 1.RaspberryPi--esp32 Not getting read error. If I try to check station and soft ap mode, ip is not configured via dhclient command. 2.Arm Processor ----esp32

mantriyogesh commented 1 year ago
  1. If I try to check station and soft ap mode, ip is not configured via dhclient command. what are commands and outputs fired ?
gauthamik9 commented 1 year ago

https://github.com/espressif/esp-hosted/issues/242#issuecomment-1687416977 These are the logs.

mantriyogesh commented 1 year ago

That is the reason it is suggested to run the raw throughput. If you run raw throughput, it will not have any higher layer configuration dependency. if transport isn ot working, we should only check transport first.

If we add unknowns, we would not understand what is making it to fail.

So, I need to understand first:

  1. which host and which esp chipset

    confirm Raspberry Pi with ESP32

  2. host side git commit
  3. esp firmware used
  4. timing of sdio used
  5. is there any variation in between Raspberry Pi with FG and with NG
gauthamik9 commented 1 year ago

Hi Yogesh, I tried with raw throughput, this is the log.Please let me know. Changed the TEST_RAW_TP to 1 ,compiled ,build,and flashed into the module. log.zip

1.raspberrypi 3 model B+ -----esp32 2.host side git commit is root@0d4c4bb56531:/home/wifi/esp_timing_fg/esp-hosted/esp_hosted_fg# git branch

gauthamik9 commented 1 year ago

Hi Yogesh, Any solution can you give us to close this issue.

mantriyogesh commented 1 year ago

actually your raw throughput is not working. This is very clear sign that the sdio level things are not working correctly.

I see first event was received. but later the message exchange was not working. Please cross check wire lengths and external pull-ups again.

if you can setup the idf (release/v5.1) correctly, I can give you instructions to try to tweak the changes in esp firmware.

mantriyogesh commented 1 year ago

I really do not understand when you say

3.esp firmware 0.0.5 is used and 4.In this changed sdio timing to SDIO_SLAVE_TIMING_NSEND_PSAMPLE TEST_RAW_TP 1

Are you using release binaries or source code building or something else?

As told multiple times, same code to be used for building at esp and host. otherwise solution will just fail.

As you say NG worked on Raspberry Pi (say v1), what exactly works on NG? If raw throughput is working fine or iperf is running fine, run fg on the same solution with:

master branch FG code built at both esp and host.

mantriyogesh commented 1 year ago

-84 is typical error, indicating there is timing issues due to wire lengths or external gpio or something damaged on host hardware.

gauthamik9 commented 1 year ago

-84 error I am not getting now when I load the driver.I am able to get the nodes for both station and soft ap nodes.

I took the git commit 8cb1ccb,and integrated the driver with arm processor as well raspberry pi. root@0d4c4bb56531:/home/wifi/esp_timing_fg/esp-hosted/esp_hosted_fg# git branch

In the below path I changed the sdio timing and enable the test raw tp to 1 and build and flashed into the esp32 module. gauthami@gauthami-Latitude-3420:~/esp_timing/esp-hosted/esp_hosted_fg/esp/esp_driver/network_adapter/main

Please let me know if anything is wrong.

gauthamik9 commented 1 year ago

I tried again with softap mode, getting this log. host commit 8cb1ccb esp flashed with https://github.com/espressif/esp-hosted/files/12288782/2023.08.08_gh242_sdio_timingchange_ESP32_sdio.tgz rasp_log.txt esp_log.txt When I was trying to connect to mobile, name is showing ESPWifi but when I enter the password getting connecting... but it is not connecting.

mantriyogesh commented 1 year ago

On raspberry Pi the timing is not expected to be NP for ESP32 sdio. it is expected to be PP (default).

gauthamik9 commented 1 year ago

How can I check the bluetooth connectivity over sdio? It is to be expected to be PP (default) ,for this what changed i need to do ?

gauthamik9 commented 1 year ago

When I do advertise on then getting segmentation fault . LEAdvertisingManager not found Segmentation fault

mantriyogesh commented 1 year ago

is the transport working for you?

Without transport correctly set-up, any higher level applications would misbehave. Unless you don't get correct/reliable raw throughput in both Tx/Rx directions, running higher layer apps, would not be of any use.

gauthamik9 commented 1 year ago

Please send the bin files so that will check and let you know the status.

mantriyogesh commented 1 year ago

Have you set up the IDF? just let me know if you can build master using idf.py build

gauthamik9 commented 1 year ago

Hi Yogesh, Able to compile the esp-idf of master branch. This is the log. esp-idf log

mantriyogesh commented 1 year ago

Okay. can you please checkout hosted latest master (currently at 5910e16) ? and build & flash esp32?

same code copy to raspberry pi and build the kernel module for sdio. I hope /boot/config.txt is updated correctly as per esp-hosted documentation. (let me know if you are using device tree method at raspberry pi)

once done, please let me know the logs. do not change timing at sdio.

dmesg, esp log, commands and output log.

mantriyogesh commented 1 year ago

btw documentation link: https://github.com/espressif/esp-hosted/blob/master/esp_hosted_fg/docs/Linux_based_host/Linux_based_readme.md

keep transport as 'sdio only' in mind.