Open HanJiec opened 11 months ago
For your suggestion "Can you please try the master branch on ESP and host " . I get code as red block in the following picture. Is it right ? Could you please show me echo commit of the component ,such as fg esp-idf and so on
I get code follow your answer , the code got using this method , is master , right ?
I modify esp_sdio.c in esp_probe start , printk(KERN_DEBUG "%s enter" , func ) ; not in log in esp_init_interface_layer , printk(KERN_INFO "%s enter" , func ) ; printk(KERN_DEBUG "%s enter" , func ) ; 2 line are in log esp_init_interface_layer is called really , seems esp_probe not be called. please see attached source modified and log mcukmsg.log esp_sdio_c.txt
esp_sdio: probe of mmc0:0001:1 failed with error 8 can been seen.
$ cat /sys/devices/platform/soc/3f300000.mmc/mmc_host/mmc1/mmc1\:0001/mmc1\:0001\:1/uevent
SDIO_CLASS=00
SDIO_ID=0092:6666
MODALIAS=sdio:c00v0092d6666
$ sudo cat /sys/kernel/debug/mmc1/ios
Above command will not exactly match. Please check your matching mmc instance (mmc0) and change path according to your linux and post output \ \
$ cd esp-hosted
$ git log --oneline |head -4
$ git status
$ git diff
and get the full textual output at both ESP and Linux
For Esp_hosted_fg : h@hvB:~/esp_hosted_202312152053/esp-hosted
$ git log --oneline |head -4
301e94a Merge branch 'fix/build_mac2str_error' into 'master'
20af007 fix(esp_hosted_ng): Fix build error for MAC2STR
ce3c50a Merge branch 'fix/spi_sdio_uart_c2_documentation' into 'master'
c4843f1 fix(esp_hosted_ng): Fix error in esp32c2 spi/sdio + uart documentation
h@hvB:~/esp_hosted_202312152053/esp-hosted
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add
no changes added to commit (use "git add" and/or "git commit -a") h@hvB:~/esp_hosted_202312152053/esp-hosted
$ git diff
diff --git a/esp_hosted_fg/esp/esp_driver/network_adapter/main/app_main.c b/esp_hosted_fg/esp/esp_driver/network_adapter/main/app_main.c
index aa44039..ac0923d 100644
--- a/esp_hosted_fg/esp/esp_driver/network_adapter/main/app_main.c
+++ b/esp_hosted_fg/esp/esp_driver/network_adapter/main/app_main.c
@@ -778,6 +778,7 @@ void app_main()
while (!datapath) {
sleep(1);
ESP_LOGI(TAG,"wait datapath true");
}
/* send capabilities to host */
diff --git a/esp_hosted_fg/esp/esp_driver/network_adapter/main/sdio_slave_api.c b/esp_hosted_fg/esp/esp_driver/network_adapter/main/sdio_slave_api.c
index 5cc3f61..688756c 100644
--- a/esp_hosted_fg/esp/esp_driver/network_adapter/main/sdio_slave_api.c
+++ b/esp_hosted_fg/esp/esp_driver/network_adapter/main/sdio_slave_api.c
@@ -205,6 +205,13 @@ static interface_handle_t * sdio_init(void)
* */
.timing = SDIO_SLAVE_TIMING_NSEND_PSAMPLE,
+
+/* SDIO_SLAVE_TIMING_PSEND_PSAMPLE
SDIO_SLAVE_TIMING_NSEND_PSAMPLE
SDIO_SLAVE_TIMING_PSEND_NSAMPLE
SDIO_SLAVE_TIMING_NSEND_NSAMPLE */
};
config.flags |= SDIO_SLAVE_FLAG_DEFAULT_SPEED;
- What are the command outputs for :
$ cat /sys/devices/platform/soc/3f300000.mmc/mmc_host/mmc1/mmc1\:0001/mmc1\:0001\:1/uevent SDIO_CLASS=00 SDIO_ID=0092:6666 MODALIAS=sdio:c00v0092d6666 Answer: /sys/devices/soc0/soc/soc:sdmmc/mmc_host/mmc0/mmc0:0001/mmc0:0001:1 # cat uevent SDIO_CLASS=00 SDIO_ID=0092:6666 SDIO_REVISION=0.0 MODALIAS=sdio:c00v0092d6666 $ sudo cat /sys/kernel/debug/mmc1/ios Answer: /sys/kernel/debug/mmc0 # cat ios clock: 25000000 Hz vdd: 20 (3.2 ~ 3.3 V) bus mode: 2 (push-pull) chip select: 0 (don't care) power mode: 2 (on) bus width: 2 (4 bits) timing spec: 0 (legacy) signal voltage: 0 (3.30 V) driver type: 0 (driver type B) Above command will not exactly match. Please check your matching mmc instance (mmc0) and change path according to your linux and post output 2. what is the code diff at Linux? Source file without base cimit will be hard to understand the change. run:
$ cd esp-hosted $ git log --oneline |head -4 $ git status $ git diff
and get the full textual output at both **ESP** and **Linux**
Linux source code is got by zip , no Git repo answer for esp_hosted_fg has provided in last comment
Debug patch Please apply sdio_debug_gh293.patch over clean repo with current git master (301e94a)
If don't want to use patch, use esp_sdio.c.zip esp_sdio_api.c.zip esp_sdio_decl.h.zip
Note: a. Changes are not compiled. Please correct if any issues in compilation either side ESP or Host.
In Raspberry Pi, I could see output as:
root@rpi-zhf:/home/pi# cat /sys/kernel/debug/mmc1/ios clock: 25000000 Hz actual clock: 25000000 Hz vdd: 21 (3.3 ~ 3.4 V) bus mode: 2 (push-pull) chip select: 0 (don't care) power mode: 2 (on) bus width: 2 (4 bits) timing spec: 0 (legacy) signal voltage: 0 (3.30 V) driver type: 0 (driver type B)
Linux source code is got by zip , no Git repo
While debugging like this, git repo will be useful to understand nay difference. Otherwise, if something is changed or wrong, will not be able to know diff/change as no tracking information.
Although I strongly suggest checking your Linux Driver for SDIO / SDHOST / SDHCI.
error code '8' is not from esp_hosted.
SPI solution is easier to implement. Can think of this as an alternative.
Try with some other Linux. To test the solution, can also use Raspberry Pi.
Ship the board with necessary Linux setup details, we will try to check the issue, but may take some time to ship & debug the issue
Have you checked the voltage at the pins?
Have you tried one bit sdio mode?
Have you checked the voltage at the pins?
Have you tried one bit sdio mode?
esp power in my board is 3.293 v , so 3.2-3.3v is right ? have not try 1 bit
- esp32c6 linux driver ,via SDIO transport #293 (comment) has debug patch, can be applied easily if you have git repo. anyway, the Documentation will always ask to git clone, not to download zip. Apply this code patch and find where you have reached in code and where the failure starts.
Although I strongly suggest checking your Linux Driver for SDIO / SDHOST / SDHCI. can I send the source code to you?
error code '8' is not from esp_hosted.
- SPI solution is easier to implement. Can think of this as an alternative.
- Try with some other Linux. To test the solution, can also use Raspberry Pi.
- Ship the board with necessary Linux setup details, we will try to check the issue, but may take some time to ship & debug the issue
Have you checked the voltage at the pins? Have you tried one bit sdio mode?
esp power in my board is 3.293 v , so 3.2-3.3v is right ? have not try 1 bit
Okay. Can you try 1 bit first??
Which source code? Hosted? You can git clone and meld the diff and send the patch.
Which source code? Hosted? You can git clone and meld the diff and send the patch.
I means I can send kernel code to you to help check ? do you accept ?
Have you checked the voltage at the pins? Have you tried one bit sdio mode?
esp power in my board is 3.293 v , so 3.2-3.3v is right ? have not try 1 bit
Okay. Can you try 1 bit first??
I don't know how to try 1 bit
Check (5) in https://github.com/espressif/esp-hosted/issues/293#issuecomment-1863756451 and reflash the Linux Kernel with new dtb. You should refer to your SoC manuals to do such change.
Any bootloops or data loss happens due to wrong flashing, ESP-Hosted would not be responsible.
I means I can send kernel code to you to help check ? do you accept ?
Can you point me your Device driver for sdio in https://elixir.bootlin.com/linux/latest/source? Match kernel version. What is the SoC you use? Full names will help to localise faster.
esp_init_interface_layer enter to sdio_register_driver
[sdmmc_0] Err: #Cmd_52 (0x80022000)=>(E: 0x0008)(S: 0x000010FF)__(L:1047) esp_sdio: probe of mmc0:0001:1 failed with error 8 [sdmmc_0] Err: #Cmd_52 (0x80042000)=>(E: 0x0008)(S: 0x000010FF)__(L:1047) esp_sdio: probe of mmc0:0001:2 failed with error 8 HanJ printfucInfo sdio_context.func not inited
Calling sdio_register_driver dump “probe of mmc0:0001:2 failed with error 8”
In addition to exchanging CMD/Respone signals through the CMD line,does sdio_register_driver also need to exchange data through data 0 to 3 ? If no need , change to 1bit cannot have effect . 除了通过CMD信号线交换CMD/Respone外,sdio_register_driver还需要通过data0~3交换数据吗?
The SD 1 bit is as per the standard specifications. The commands response flow through cmd line.
Check the sdio communication with slave: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/protocols/esp_sdio_slave_protocol.html Detailed spec: SDIO Simplified Specification
改成1bit 可以有助于 sdio_register_driver 成功执行吗?
Removing calling esp_reset , make the ko. The net card come out : ethap0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 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)
ethsta0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 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) Is esp_rest is necessary ?
Okay, for now you can proceed that way, issue with resetpin can be deferred for now. Later will need to address. What is dmesg, ESP log, Linux command responses?
dmesg esp log and command are attached here. Please help check mcukmsg.log esp32c6.log rpi_init.zip
Your SDIO looks to be working fine.
Problem is the porting of rpi_init.sh
or Makefile
.
Please check the code from error is coming: https://github.com/espressif/esp-hosted/blob/3769eea28bbbc59d8ea2aff425d62564b7fb3e68/esp_hosted_fg/host/linux/host_driver/esp32/main.c#L409-L424
Option 1: Correct the rpi_init.sh / Makefile porting. Makefile doesn't include https://github.com/espressif/esp-hosted/blob/3769eea28bbbc59d8ea2aff425d62564b7fb3e68/esp_hosted_fg/host/linux/host_driver/esp32/Makefile#L1
Option 2: Take your changes as diff and keep them safe. Chaneg base commit to latest master, where we have removed CONFIG_SUPPORT_ESP_SERIAL at all (Code under this flag is always included, as FG always needs it)
You means I can remove the first line of esp-hosted/esp_hosted_fg/host/linux/host_driver/esp32/Makefile to fix the problem that you find. Change Makefile first line to #CONFIG_SUPPORT_ESP_SERIAL = y ? Problem is here ; process_rx_packet, Dropping unsupported serial frame ?
CONFIG_SUPPORT_ESP_SERIAL is expected in your code. Check safe option (2) above
Correct your Makefile and rpi_init.sh https://github.com/espressif/esp-hosted/blob/ea8b0aae76813d663fed1a4d3e8b6a6f96ac43eb/esp_hosted_fg/host/linux/host_driver/esp32/Makefile#L30
Should be there in your existing code. If you use master , CONFIG_SUPPORT_ESP_SERIAL symbol is not needed.
OK,Thanks
now , net card is up , but setting IP addr failed.
In addition to using dhclient by the fg doc, is there other method to set IP addr ? My board hasn't dhclient , need to serach source code and compile it.
Command and response is as the following lines:
/customer/wifi # ifconfig
ethsta0 Link encap:Ethernet HWaddr 40:4C:CA:45:85:C8
UP BROADCAST RUNNING 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)
/customer/wifi # ifconfig espsta0 192.168.43.30 netmask 255.255.255.0;route add default gw 192.168.43.1 ifconfig: SIOCSIFADDR: No such device route: SIOCADDRT: Network is unreachable
DHCP software is higher layer and varies from platform to platform or distribution to distribution. So we only make sure till the virtual network interface is working fine.
To quickly test your virtual network interface, you can connect to the AP using C demo / Python demo app and assign static IP. If your AP assigns IP address in subnet, 192.168.43.XXX and you wish to assign static IP , 192.168.43.233 (just example),
sudo ifconfig ethsta0 down
sudo ifconfig ethsta0 192.168.43.233
sudo ifconfig ethsta0 up
Please make sure the IP address you are assigning is not already assigned to some other node, to avoid IP collision.
You need to check how to configure DHCP IP address using DHCP client on your platform.
https://github.com/espressif/esp-hosted/blob/master/esp_hosted_fg/docs/common/c_demo.md#some-points-to-note
This is just an example to demonstrate dhclient
. For your DHCP client, you need to use commands as per the software supports.
Can ping other device using static IP , lost a few . Thanks. /customer/wifi # ping 192.168.43.244 PING 192.168.43.244 (192.168.43.244): 56 data bytes 64 bytes from 192.168.43.244: seq=16 ttl=128 time=114.922 ms 64 bytes from 192.168.43.244: seq=17 ttl=128 time=48.427 ms 64 bytes from 192.168.43.244: seq=18 ttl=128 time=30.816 ms 64 bytes from 192.168.43.244: seq=19 ttl=128 time=19.396 ms 64 bytes from 192.168.43.244: seq=20 ttl=128 time=48.116 ms ^C --- 192.168.43.244 ping statistics --- 21 packets transmitted, 5 packets received, 76% packet loss
It could be network or transport layer issue. Or very high debugging added in either ESP or host.
To localise,
Sir , BusyBox has udhcpc to get dhcp IP addr. I use "udhcpc -i ethsta0" to get IP addr and succeed . It is 192.168.1.102. But when i use ifconfig command to show ethsta0 status, there is no ip addr attach to it. Ping other device fail. Then i run "ifconfig ethsta0 192.168.1.102 netmask 255.255.255.0; route add default gw 192.168.1.1 " , It can work correctly . Is the situation right? The following is the commands and response . Please be noted the first ifconfig response have not this line : inet addr:192.168.1.102 Bcast:192.168.1.255 Mask:255.255.255.0
log: /customer/wifi # udhcpc -i ethsta0 -b ;ifconfig udhcpc (v1.20.2) started Sending discover... Sending select for 192.168.1.102... Sending select for 192.168.1.102... Lease of 192.168.1.102 obtained, lease time 7200
ethsta0 Link encap:Ethernet HWaddr 40:4C:CA:45:85:C8
UP BROADCAST RUNNING MTU:1500 Metric:1
RX packets:84 errors:0 dropped:0 overruns:0 frame:0
TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:25184 (24.5 KiB) TX bytes:5796 (5.6 KiB)
/customer/wifi # ifconfig ethsta0 192.168.1.102 netmask 255.255.255.0; route add default gw 192.168.1.1
/customer/wifi # ifconfig
ethsta0 Link encap:Ethernet HWaddr 40:4C:CA:45:85:C8
inet addr:192.168.1.102 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MTU:1500 Metric:1
RX packets:118 errors:0 dropped:0 overruns:0 frame:0
TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:33740 (32.9 KiB) TX bytes:5796 (5.6 KiB)
/customer/wifi # ping 192.168.1.101 PING 192.168.1.101 (192.168.1.101): 56 data bytes 64 bytes from 192.168.1.101: seq=0 ttl=128 time=2853.184 ms 64 bytes from 192.168.1.101: seq=1 ttl=128 time=1855.973 ms
--- 192.168.1.101 ping statistics --- 7 packets transmitted, 7 packets received, 0% packet loss round-trip min/avg/max = 22.011/813.121/2853.184 ms
I am not sure of udhcpc
software.
But lines
64 bytes from 192.168.1.101: seq=0 ttl=128 time=2853.184 ms
64 bytes from 192.168.1.101: seq=1 ttl=128 time=1855.973 ms
Looks very strange. Is the default gateway correct / needed?
Run the raw_throughput test one by one for Tx and Rx
I suspect your transport is not so stable.
Sir , Firmware for testing wifi RF signal should compiled by myself ? is there any document for it ?
For RF testing, You can use the https://github.com/espressif/esp-idf/tree/master/examples/phy/cert_test example directy on c6.
Just to avoid any sort of confusion,
raw throughput is different from RF testing, BTW. The raw throughput test can be done on transport, to understand what is max transport performance, without involving Wi-Fi. https://github.com/espressif/esp-hosted/blob/master/esp_hosted_fg/docs/Linux_based_host/porting_guide.md#3-troubleshooting has link for raw throughput testing
Sir, Raw throughput test shows esp=>host : 30Mbits/S , host=>esp : 50Mbits/S. Detail data is attached: throughput-24-1-12-esp2host.txt
throughput-24-1-12-host2esp.txt Please help check. I cannot find a reference data from the esp github
For RF testing, You can use the https://github.com/espressif/esp-idf/tree/master/examples/phy/cert_test example directy on c6.
In https://github.com/espressif/esp-idf/blob/master/examples/phy/cert_test/README.md , have the following Line: Supported Targets | ESP32-C3 | ESP32-S3 | not include esp32-c6 . Can I use this code ?
Yes. It could be reaching little more. But anyway this should also be fine for your test.
The result is very stable and clean. But dhcpd still looks very bad.
Can you cross check your networking once (are all packets follow exactly one route)? Ideally there should not be any loss or very high jitter like in one of your posts above.
Ifconfig -a
Also, do you have multiple AP s with same SSID? or AP very far?
Yes. It could be reaching little more. But anyway this should also be fine for your test.
The result is very stable and clean. But dhcpd still looks very bad. Do you means ping round time is very long and lost some packets based discusses before today ? not based today data.
AP is very near , and no multiple AP with same SSID
Can you please log issue in ESP-IDF for this? I think it should work, not tested, not sure.
Possible interruption from any other technologies kept very nearby, like bluetooth / microwave / thread router etc? Is the channel selection to auto in Wi-Fi router?
Possible to test with some other AP or channel conditions?
Can you please log issue in ESP-IDF for this? I think it should work, not tested, not sure.
I have not try . Just review the README.md and it don't declare supporting esp32-c6
esp32c6 as slave , mcu run linux kernel 5.10 , using esp-hosted-fg as codebase