Closed zhlftest closed 1 year ago
I understood your concern. Let me create firmware for you. Is this the only pin you want to change?
yes,only need to change IO3 to IO5,thanks
NG_ESP32C3_17jan23_GH194_Handshake_IO5.tgz
Use the firmware bins from 30MHz
directory.
Please capture the logs while running: Host: /var/log/kern.log ESP: minicom log with 112500 baud rate
Please let us know once you are unblocked..
The driver insmod successfully, but linux didn't get signal from ESP32C3, Now, we were measuring the signal for handshake and Data ready with an oscilloscope kernel.txt esp32_log.txt
By the way resetpin is mandatory. We need to reset ESP on every loading of Kernel module.
I hope the length of all the jumper wires is similar & ~5-6cm each.
Alternative to oscilloscope, you can also add KERN_ERR logs in https://github.com/espressif/esp-hosted/blob/29208b6c156be06dfd90dadc6dd43acd4d98d748/esp_hosted_ng/host/spi/esp_spi.c#L67-L74 and https://github.com/espressif/esp-hosted/blob/29208b6c156be06dfd90dadc6dd43acd4d98d748/esp_hosted_ng/host/spi/esp_spi.c#L76-L83
You need to get the first (bootup) event, from ESP to Host. Worth checking if Connections are correct. (First Milestone)
Which Linux are using?
Are you using Linux other than Raspberry Pi? If so, check SPI config in Device Tree (DT) is correct. Next check if spidev is working fine after SPI is configured. Further disable the spidev after verification & then load the esp32_spi.ko driver using rpi_init.sh
.
Linux version 4.4.289 CPU: ARM926EJ-S the en/handshake/data-ready pin is work fine,but the spi host does not communication with the esp32c3; when the handshake/data-ready pin pull up,they keep high level all the way,is it correct?
the spi host config as below:
what is output of ls /dev/spidev*
It is normal to wire spi host mosi and miso together and test the device with software.
spi mode: 0x0 bits per word: 8 max speed: 500000 Hz (500 KHz) TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@..................... RX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.....................
Now please disable the spidev. see reference: https://github.com/espressif/esp-hosted/issues/165#issuecomment-1275877729
Once you disable spidev, the user-space will not claim the spi. Only then the esp32_spi.ko can claim the free SPI bus.
when the handshake/data-ready pin pull up,they keep high level all the way,is it correct?
Are using jumper cables? is the length <= 5 to 6cm?
Hello @zhlftest ,
Can you please use this debug binary for flashing and the host side code patch for ESP32-C3 testing (includes IO 05 changes)?
Are using jumper cables? is the length <= 5 to 6cm?
no,I designed the hardware. I put chips on the hardware board
Okay..
Hello @zhlftest ,
Can you please use this debug binary for flashing and the host side code patch for ESP32-C3 testing (includes IO 05 changes)?
Thanks a lot,but we have a holiday here, so we can't test until January 28th
No problem. Let us know once you are able to test it again.
The patch has been added, and the result is the same as before. It seems that the program does not go into the added debugging information.
The log is as follows: Jan 29 08:54:19 buildroot kern.info kernel: nf_conntrack: automatic helper assignment is deprecated and it will be removed soon. Use the iptables CT target to attach helpers instead. Jan 29 08:54:22 buildroot kern.info kernel: esp_reset, ESP32: Triggering ESP reset. Jan 29 08:54:22 buildroot kern.info kernel: ESP32 peripheral is registered to SPI bus [2],chip select [1], SPI Clock [10] Jan 29 08:54:23 buildroot kern.info kernel: esp_init, init esp32, ret = 0 Jan 29 08:54:23 buildroot auth.info sshd[1237]: WARNING: /usr/local/etc/moduli does not exist, using fixed modulus Jan 29 08:54:26 buildroot auth.info sshd[1237]: Accepted password for root from 192.168.1.200 port 50211 ssh2
@mantriyogesh Please take a look at this question, thank you
Have you checked, https://github.com/espressif/esp-hosted/blob/master/esp_hosted_fg/docs/Linux_based_host/porting_guide.md#124-peripheral-configurations from porting guide?
I am curious to know why are you using chip select as 1
at
https://github.com/espressif/esp-hosted/blob/fe0b10584417629908cee8141699c2f35ea05a25/esp_hosted_ng/host/spi/esp_spi.c#L469-L470
Considering /dev/spidev2.0 was tested, you can make esp_board.bus_num = 2;
and esp_board.chip_select = 0;
Did you get a chance to look at this?
/dev/spidev2.0 has been occupied by the system. Modules cannot use the same spi device
By /dev/spidev2.0 has been occupied by the system
,
I interprete that you want to use but the system is not leaving spi instance.
Most likely it would be because spidev is claiming the device.
If you intent to use, need to disable spidev https://github.com/espressif/esp-hosted/issues/194#issuecomment-1386573333
Once spidev is disabled for this spi instance, you should be able to use it.
This reference might help you to disable spidev from device tree. https://github.com/espressif/esp-hosted/issues/165#issuecomment-1275877729
This Linux system does not use the device tree function. If I disable spidev in the Linux system, the loading module will report this error (Failed to observe SPI master handle)
By the way, getting Linux platform up is outside scope of ESP-Hosted.
I might need some details to get to the problem:
1.root@buildroot:/# uname -a Linux buildroot 4.4.289 #111 PREEMPT Wed Oct 12 14:06:03 CST 2022 armv5tejl GNU/Linux
2.My configuration is in the blue square
3.There is a problem with the prototype designed before. We have modified the circuit. At present, the new circuit board has not been completed. We can continue testing this weekend.
2.After disabling 'User mode SPI device driver support',When I load "insmod esp32_spi. ko resetpin=206", the error : root@buildroot:/usr/modules# insmod esp32_spi.ko resetpin=206 Failed to obtain SPI master handle Failed Init SPI device insmod: can't insert 'esp32_spi.ko': No such device system log: RX nuc980_spi1_probe: dma0chan0 module removed TX nuc980_spi1_probe: dma0chan1 module removed nuc980-spi1 nuc980-spi1.0: No platform data supplied nuc980-spi1: probe of nuc980-spi1.0 failed with error -2
insmod: can't insert 'esp32_spi.ko': No such device
this is very worrisome.
Can you please do
$ file esp32_spi.ko
and check if it is expected for your platform?
What is output of before and after you disable 'User mode SPI device driver support' ?
$ ls /dev/spidev*
Okay.
From log, Failed to obtain SPI master handle
, the spi instance-chip select mentioned in was not
In general, we should first get the spidev working on some specific (spi instance and chip select), then disable it only for user space.
This way when the driver tries to capture the bus, as user space will not claiming, the kernel module is able to claim it.
I am not really sure how can you do through your linux configuration, but this is the way it has to be.
So ideally, when you were able to test spidev in user space (https://github.com/espressif/esp-hosted/issues/194#issuecomment-1386567343), you might have to check how can you selectively only disable 'spidev'. once this step is done, you should be able to use spi bus.
The error has been resolved, and the current status is as follows: root@buildroot:/usr/modules# insmod esp32_spi.ko resetpin=206 esp_reset, ESP32: Triggering ESP reset. ESP32 peripheral is registered to SPI bus [2],chip select [1], SPI Clock [10] esp_init, init esp32, ret = 0 root@buildroot:/usr/modules# ls /dev/spidev* /dev/spidev2.0 /dev/spidev2.1 root@buildroot:/usr/modules#
Great!! I am not sure how but now you need to just disable spidev. make sure you just disable spidev only. not the original spi instance.
I first need to disable /dev/spidev2.0 ? then "insmod esp32_spi.ko resetpin=206"?
Does this configuration need to be modified?
I first need to disable /dev/spidev2.0 ? then "insmod esp32_spi.ko resetpin=206"?
yes. you might need to study how it is done for your Linux system. But you can find something after checking other peripherals / configurations.
Does this configuration need to be modified?
modalias just a name, Better you do not name it spidev as it might confuse you later point of time. You only want to change last two lines bus_num=2 and chip_select=0.
Note: after doing only step (1), you should check if /dev/spidevX.Y are no more seen. Only then you move to step (2) and module building and loading.
If there is no/dev/spidevX. Y, when I execute "insmod esp32_spi. ko reset=206", the error "Failed to obtain SPI master handle, Failed Init SPI device" should appear.
For reference of Device Tree, see this: You might have to figure out how this can be translated to your Linux configuration system.
In above image, SPI instance is enabled but only spidev is disabled for Chip Select 0.
Hello @zhlftest @emmmmlb Any updates so far?
Sorry, there is no progress for the time being. It may not be tested in the near future.
Okay. Anyway, can you please close the issue by the time? You can re-open when you test again?
Please do re-open when you come back.
I am using esp hosted ng,host based linux4.4, chip is esp32c3, spi only The esp32c3 use https://github.com/espressif/esp-hosted/releases/tag/release%2Fng-v1.0.2 , and the linux drivers use https://github.com/espressif/esp-hosted/tree/master/esp_hosted_ng; I check the \esp-hosted-master\esp_hosted_ng\docs\setup.mk,the Handshake pin used the esp32c3 IO3,but in my hardware design,the IO3 has used to other function,can you help to build another firmware,change the Handshake pin to the esp32c3 IO5;