Open oldmylei opened 1 week ago
Thank you for sharing detailed logs and clear issue description @oldmylei .
Currently ESP driver code not able to claim spi bus.
Meaning possibly you are using incorrect spi bus and/or incorrect cs.
Other possibility that spidev(default Linux user space driver for spi) is still using the spi bus. If the bus is available only then hosted kernel driver can claim.. if spidev is still enabled, (check $ ls /dev/spidevX.Y
output. X is bus, Y is CS. If bus-cs mapping file is present, spidev has claimed it. You might need to disable spidev in device tree or SoC config)
Please review carefully, https://github.com/espressif/esp-hosted/blob/master/esp_hosted_ng/docs/porting_guide.md
I read this tutorial and it required me to turn off the default SPI driver. Here is the SPI node configuration I used. I actually disabled it and went to the device node that did not generate /dev/spidevX.Y
Although we are not experts for device tree of your Linux SoC, From experience, It looks like you are disabling spi bus altogether. you need to only disable spidev (disable the user space driver only. not the bus itself)
I think I should understand what you mean. Do you mean to mask only the default driver of SPI as I did in the picture above?
Change status disabled for (inside) spidev. not outside it. Outside would disable 'spi6' altogether.
I am not sure of compatible. But I think, let it be as is for now.
You would need to port the spi bus number to 6 and cs to 0(?). Also connect the smallest wires possible with spi6 and CS0 of spi 6 with slave' connections.
There are three extra wires/GPIOs apart from 4 wire spi, that you need. Please refer porting guide in earlier comment.
Once those handshake, dataready and resetpin are configured, test them. reset pin on toggle should reset slave. data_ready and handshake are interrupt at host, so manually low to high (edge) interrupt should either print in hosted code (check porting guide)
these are typical steps while porting..
I set handshake, dataready and resetpin as normal output GPIO
IO90 is handshake, then IO91 is dataready, I didn't connect the resetpin signal because the ESP32C3 has a reset button on the development board After doing this, I still get the following error when loading the compiled generated driver
resetpin is not for manual resetting of c6. Reason for resetpin: Host on bootup always should reset c3. resetpin is mandatory for spi.
Issue 'Failed to obtain SPI master handle' would go off, when
Consider case, you have spi bus 6 and two cs, 0 and 1. When you disable spidev from device tree for bus 6 and cs 0 and re flashed the device tree (dtb) to Linux, on bootup, you would note, /dev/spidev6.0 is no more listed. but /dev/spidev6.1 should still be seen. This means /dev/spidev6.0 could be used by kernel driver. You would need to change esp_spi.c to use correct bus (6) and cs (0) and then build and insert driver.
you configure the spi bus, cs correctly, this error would not be seen. Either you are not disabling spidev OR disabling incorrect spidev instance, OR esp_spi.c is not configured.
Only one of these 3 is the reason for not loading.
Good morning, according to the documentation, it seems that only 4.X kernel adaptation is described. My system kernel is version 5.10, can it adapt to this module?
HCI over SPI is supported 'over' kernel version 4.7.0. Meaning, 4.7.0 + is supported for HIC over SPI (bluetooth over spi).
You kernel version is supported.
I didn't connect the resetpin signal because the ESP32C3 has a reset button on the development board
Reset not only a buttin, but GPIO on devkit header, named 'RST'
Can you please run command,
ls /dev/spidev*
-> 1. Without disabling spidev -> 2. After disabling spidev
Also can you please post the current device tree for spi?
Hello, I have solved the problem of loading the driver, but I did not generate the WIFI node after loading the esp32_spi.ko driver, the following is the detailed log
root@myd-jd9x:~# insmod esp32_spi.ko resetpin=89 root@myd-jd9x:~# root@myd-jd9x:~# root@myd-jd9x:~# lsmod Module Size Used by Tainted: G esp32_spi 49152 0 lt8912b_hdmi 16384 0 yt6801 368640 0 xrp_hw_semidrive 16384 0 lm75 20480 0 pvrsrvkm 1273856 0 ngbe 217088 0 root@myd-jd9x:~# root@myd-jd9x:~# root@myd-jd9x:~# ifconfig lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:168 errors:0 dropped:0 overruns:0 frame:0 TX packets:168 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:12416 (12.1 KiB) TX bytes:12416 (12.1 KiB)
root@myd-jd9x:~# 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:52
can1 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:53
can2 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:54
can3 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:55
enp1s0 Link encap:Ethernet HWaddr 00:55:7B:B5:7D:F7 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:50 Base address:0x8000
eth0 Link encap:Ethernet HWaddr 56:B8:E5:23:5E:F3 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:46
eth1 Link encap:Ethernet HWaddr 76:AF:C2:A6:A3:16 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:47
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:168 errors:0 dropped:0 overruns:0 frame:0 TX packets:168 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:12416 (12.1 KiB) TX bytes:12416 (12.1 KiB)
teql0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 NOARP 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:100 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
tunl0 Link encap:UNSPEC HWaddr 00-00-00-00-30-30-00-30-00-00-00-00-00-00-00-00 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:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
root@myd-jd9x:~#
This is the info information for loading the driver
ifconfig listing is later stage. Also, have you changed the name of network intterface as such? (by default, it would be espsta0 for ng) I think something is wrong before reaching to ifconfig stage. dmesg and esp side logs would let you know the issues.
As resetpin is not hooked, please reset esp manually and check the logs in the dmesg again..
Reset pin is mandatory.
For now,
and manually trigger posedge interrupt, to see these pins are correct.
Also , please test spidev test (before disabling spidev), to verify the underlying spi driver is working fine or not for your bus and chip select combination.
In summary, do the porting (using porting guide). Verify all GPIOs work as they are intended to be working. Verify SPI lines are working fine (both hardware and software/config issues would need tto rule out first)
All I know for sure is that the resetpin I set will reset the ESP32C3 properly
sure. other pins working as they expected to be?
Unless all GPIOs work as they need to, porting is incomplete and solution would not work as such
I added the above printing information, the result did not print these sentences
Is it proof that my handshake and dateready pins are not connected correctly, I am sure that I have set both pins to GPIO output mode and are GPIO90 and GPIO91 pins
I noticed the spi/esp_spi.h file, do I need to change the HANDSHAKE_PIN and SPI_DATA_READY_PIN values?
Can you add KERN_ERR log instead (not sure what level your log level is)
https://github.com/espressif/esp-hosted/issues/407#issuecomment-2196405152
yes, This is mentioned in porting guide..
After I changed the values of HANDSHAKE_PIN and SPI_DATA_READY_PIN, an interrupt did occur and the debugging information above, but still no wifi node was generated
Worth to check the porting guide step-wise. Porting is prerequisite for ESP-Hosted project. We have added common issues and ways to fix them in this guide.
Hello, I tried to connect our board to the ESP32 development board, and there was an error when loading the driver.
The following is the diagram of the hardware connection. We connected seven signals with the ESP32 in total, and one GND signal was not drawn:![d40ba2d336354f3c4eb316b072365bd](https://github.com/espressif/esp-hosted/assets/126750652/3250baa9-5cc9-4e19-9902-52617accf62e)
When I finished this, I built and burned the ESP32 board image under esp_hosted_ng/esp/esp_driver/network_adapter, and compiled the driver of our board under esp_hosted_ng/host. Below is the log of the ESP32C3 development board and the dmesg content information of our board: esp32_dmesg.txt esp32_log.txt
According to the log, it seems that my board is not properly wired to the ESP32 development board? Or the ESP32 needs to start some kind of mode.
Could you take a look, please? Thank you