-
Notifications
You must be signed in to change notification settings - Fork 187
Issues in Spi Communication and clock synchronisation between Rasberrypi host and esp32s3 in the esphosted fg implementation #479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you please use same git commit, preferably hosted master on ESP and host? |
|
host dmesg from system boot up
|
wires are too long. You can limit the clock using
Solution is already available for Raspberry Pi, which is your host. Porting is not needed in your case. However, it is important to note the important hardware considerations from porting guide. Additionally, I couldn't find the esp log, yet, which is crucial for debugging. |
hi we have set the clock as 10mhz only
|
You have reattached the dmesg log. What is flashed on esp chipset? Where are esp chipset logs? Where is /boot/firmware/config.txt? Also confirm the raspberry and esp connections. which pins connected to what. |
With respect to esp32s3 we have flashed ESP-Hosted-FG-release_0.0.5.tgz for esp32 s3 wroom 1
|
Flash latest master on esp and use same commit on host. dtoverlay=spidev_disabler |
Once you flash the
Also verify the connection. use smaller 10cm, equal and good quality wires. |
please find the esp logs for the repository which we flashed which is ESP-Hosted-FG-release_0.0.5.tgz [ 0.210489] No Local Variables are initialized for Method [_PDC] [ 0.210491] Initialized Arguments for Method [_PDC]: (1 arguments defined for method invocation) [ 0.210505] ACPI Error: Aborting method _PR.CPU0.PDC due to previous error (AE_AML_OPERAND_TYPE) (20210730/psparse-529) |
As mentioned in #479 (comment), Please use latest master code from esp-hosted at both places, esp and host. Complete documentation of how to flash the ESP and host is available under https://github.com/espressif/esp-hosted/blob/master/README.md |
Please note, slave flashing and getting log on the slave chipsets is different from that of hosts. For ESP-Hosted to work:
|
please find the git commit on the esp32 side
|
please find the git commit in host rpi side
|
Sure. Check other things mentioned in #479 (comment) |
Hi sir I (589) SPI_DRIVER: Hosted SPI queue size: Tx:20 Rx:20 I (589) SPI_DRIVER: Hosted SPI queue size: Tx:20 Rx:20 |
please find the kernal logs from host side dmesg
|
hi sir sdkconfig
|
from sdkconfig, I could see,
From code: esp-hosted/esp_hosted_fg/esp/esp_driver/network_adapter/main/spi_slave_api.c Lines 114 to 129 in 3769eea
I assume you have not changed the code anywhere.
|
Hi Sir We have rechecked the connections properly |
|
Hi sir |
Either test in user space as said earlier or logic analyser as last sort. Problem is your spi pins, miso, clk, cs right now. Other gpios also need testing later. For now very sure of these tree keys not correct. |
Hi sir |
You meant 'esp32_spi.ko' . So yes, this should get you wifi on spi built on kernel module side. |
it is worth to cross check your gpios are working fine first for spi. Once SPI gpios are correct, you can also check handshake and data ready gpios are correct or not. |
Hi Sir Please be informed that we have not done any specfice test than control command test available in the test.c available in the directory https://github.com/espressif/esp-hosted/tree/master/esp_hosted_fg/host/linux/host_control/c_support itas@raspberrypi:~/esp-hosted/esp_hosted_fg/host/linux/host_control/c_support $ sudo ./test.out get_fw_version Enable heartbeat with duration 20 Control response timed out after 30 sec Response not received Control response timed out after 30 sec Response not received Segmentation fault Other than that we have spi dev test with the following combinations
Other than this we have not done any specfic test. |
Did you check the module param in rpi_init.sh? The config should be provided through it. Spi slave frequency cannot be just set to anything. It should be supported by slave. 50mhz is nowhere supported for any ESP chipset for spi as slave. Did you verify your transport ported is correct first? |
Hi Sir Based on checking the steps mentioned in the porting guide and implementing the rawtp test to check the spi communication we found the following • Again had checked hardware connections with respect to the documentation and also verified continuity. gpiochip0: GPIOs 512-569, parent: platform/fe200000.gpio, pinctrl-bcm2711: gpiochip1: GPIOs 570-577, parent: platform/soc:firmware:gpio, raspberrypi-exp-gpio, can sleep: • Checked the gpio for handshake, dataready and reset found like this • We have got 506,522 and 527 as reset,handshake and spi datat ready respectively. what is meant by new gpio mentioned in the porting guide.
|
log of rpi side when transmitted data from esp to host using rawtp [ 5105.277818] esp32_spi: esp_spi_transaction: entered slave_ready [ 5105.279203] esp32_spi: esp_spi_transaction: entered slave_ready [ 5105.280598] esp32_spi: esp_spi_transaction: entered slave_ready [ 5105.281980] esp32_spi: esp_spi_transaction: entered slave_ready [ 5105.283370] esp32_spi: esp_spi_transaction: entered slave_ready [ 5105.284761] esp32_spi: esp_spi_transaction: entered slave_ready [ 5105.286153] esp32_spi: esp_spi_transaction: entered slave_ready [ 5105.287540] esp32_spi: esp_spi_transaction: entered slave_ready [ 5105.288928] esp32_spi: esp_spi_transaction: entered slave_ready [ 5105.290312] esp32_spi: esp_spi_transaction: entered slave_ready [ 5105.291696] esp32_spi: esp_spi_transaction: entered slave_ready [ 5105.293084] esp32_spi: esp_spi_transaction: entered slave_ready [ 5105.294470] esp32_spi: esp_spi_transaction: entered slave_ready [ 5105.296736] SPI Interrupt Handler called, IRQ: 55 [ 5107.664867] systemd-journald[272]: /dev/kmsg buffer overrun, some messages lost. [ 5539.775568] esp32_spi: esp_spi_transaction: entered slave_ready [ 5540.605164] esp32_spi: esp_spi_transaction: entered slave_ready [ 5540.606938] esp32_spi: esp_spi_transaction: entered slave_ready [ 5557.154541] esp32_spi: esp_spi_transaction: entered slave_ready [ 5557.156137] esp32_spi: esp_spi_transaction: entered slave_ready [ 5557.421374] esp32_spi: esp_spi_transaction: entered slave_ready [ 5557.426980] esp32_spi: esp_spi_transaction: entered slave_ready [ 5557.428553] esp32_spi: esp_spi_transaction: entered slave_ready itas@raspberrypi:~/esp-hosted/esp_hosted_fg/host/linux/host_control $ |
Please lower log like:
You can instead print (start 32 bytes of) frame in single line. From the logs, it is clearly visible, that spi is not working in expected manner. please state:
|
Based on our last communication please find the information furnished below.
![]() |
log for raw tp transportation from host to esp in host side |
I am not understanding, why would you go for higher frequency if lower frequency is not working? Once you get everything running on low frequency like 5m or 10m, then step-wise increase till your host ans slave support and are both interoperable. Porting guide states it explicitly at https://github.com/espressif/esp-hosted/blob/master/esp_hosted_fg/docs/Linux_based_host/porting_guide.md#spi-timing-issues----tuning
Please use low freq, get it working first. |
This is max slave spi clock freq supported for S3. Please use 5MHZ first. Get everything working (first to get TX and RX raw throughput working). Once everything tested fine, increase SPI clock from host in 1MHz step. If using wires, you may not go beyond 30MHz. If using PCB, can go till 40MHz. |
Hi Sir • SPI clock frequency for esp32s3 could be changed from macro SPI_CLK_MHZ in esp/esp_driver/network_adapter/main/spi_slave_api.c for esp hosted ng setup for fg setup this macro SPI_CLK_MHZ is not available.
|
Hi Sir Given the timing and synchronization challenges with the SPI communication between the ESP32S3 and Raspberry Pi, here’s a step-by-step approach based on which we are currently executing the test. |
Let me review the logs and comments you have posted tomorrow and get back to you on this. |
Hello @sreejitharikath , Please disable all the logging, set the spi mode to 3 at both the places. Flash the latest FG master at both the ESP32-S3 and Raspberry Pi (both kernel module, and C app). The raw throughput tests documentation is at https://github.com/espressif/esp-hosted/blob/master/esp_hosted_fg/docs/Linux_based_host/Raw_TP_Testing.md In the logs, I also notice the logs are printed per byte. Per byte logs are really not desired. Please back up your existing code somewhere and directly jump to latest master FG code for testing. Please confirm again individually:
Please confirm above, then as next steps we would move to raw throughput. Also, always provide the logs from start-up. Keep the SPI freq as 10MHz for now. |
Hi Sir mode 2.zip • Has Backed up the repositories cloned in the both esp32s and raspberry pi sides . Git commit in esp32s3side
Git commit in raspberrypi side
|
There is absolutely no communication from esp32-s3 to raspberry pi. Let me reproduce and confirm, and provide you success logs when I test with s3 + Raspberry Pi 4 Model B. |
git commit: 526ae2e spi mode: 2 (default) Raspberry Pi connected with S3: |
The first even comes effortlessly. I have captured file contents of relavant configurations used at raspberry pi in the host log, including /boot/config.txt, commands- output, dmesg log etc. also esp32-s3 log. As my rpi is using old kernel, I had changed rpi_init.sh such that, I also have captured (cat_ rpi_init.sh in the logs for your reference. |
any update @sreejitharikath ? |
Hi Sir By comparing the config.txt which you have send with the config .txt which we have used her in rpi we have added three lines of configuration which are |
Is it working or not? Also this is raspberry pi that you tested or some other host? |
Hi Sir Its not working raspberry pi 4 model b is the host. |
From the logs you have shared, there are a lot of kernel warns, although not panic from:
These warns are occuring not occuring from esp32_spi module.
it appears to be from vc4 driver. but I can't comment on this, as exact root cause you might know better. I am also not sure if something wrong with your kernel or config. With some search online, I could understand it is something that you connect as your display and the vc4 config incompatibility. online it suggested to replace
with
but I am not author of this driver, so I am as much new as you to this error. Regarding config,
Regarding unrelated warns and crashes: From the logs, I lost track what happened ahead of
The next log (even unsure if it is same boot session or not):
the logs in middle are lost. Please send us all* logs similar fashion we stated, which would showcase complete state of system at both esp and host side. Please correct your system state to avoid unaware problems, as I am not sure if they can affect or not affect the spi or kernel functionality and stability. esp: test log from flashing We have double time verified the S3 with Rasberry pi is working fine, without the kernel warns that you face in your setup. |
Hi Sir Based on your inputs i have made the following changes
3.Still my wifi communication through spi is getting failure esp32_log_17th jan.txt-esp log rpi_kernel_config_log_17thjan.txt-rpi logs with command responses complete_dmesg_log1(1).txt Inorder to connect to wifi configured ssid and password in control config.h in c_support directory and run test.out to execute the control commands to connect wifi. ![]()
itas@raspberrypi:~ $ cat /etc/os-release
By verifying and analysing all the inputs please let me know any more inputs is required from my side. |
I'll come back with the questions, but I did not understand the host gpios are changed: esp-hosted/esp_hosted_fg/host/linux/host_control/rpi_init.sh Lines 13 to 28 in b83e0d5
Old New are not 506 , 522, 527 As per the default master code it should be 518, 534, 539. Can you run once without any alternation, the bus, cs, pins, spi mode or sorts of change? These there pins I remember you had tested earlier. Have you remained them on your setup? Reset pin should ESP reset on driver reload. Handshake, Data ready should interrupt host. Can confirm through log or interrupt status in Linux. |
Checklist
How often does this bug occurs?
always
Expected behavior
virtual serial interface espso is not created after runing esphosted fg in both rpi4b and esp32s3 even after flashing their respective repositories from github
Actual behavior (suspected bug)
when runing the commad bash -x ./rpi_init.sh wifi=spi
[ 204.596250] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/spi@7e204000/spidev@0/status
[ 204.627263] esp32_spi: loading out-of-tree module taints kernel.
please help me in fixing this why after the module is inserted it is exiting why iam getting warning of memory leakage , why iam getting message that kernel is getting tainted
Error logs or terminal output
Steps to reproduce the behavior
see error
bash -x ./rpi_init.sh wifi=spi
Project release version
ESP-Hosted-FG-release_0.0.5.tgz for rpi4b and ESP-Hosted-FG-release_0.0.5.tgz for esp32 s3 wroom 1
System architecture
ARM 32-bit (Raspberry Pi 32-bit)
Operating system
Linux
Operating system version
PRETTY_NAME="Raspbian GNU/Linux 12 (bookworm)" NAME="Raspbian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=raspbian ID_LIKE=debian
Shell
Bash
Additional context
SPI Initialization: The esp32_spi module is initialized successfully with SPI bus 0, Chip Select 0, and SPI mode 2. The GPIOs for handshake and data ready are correctly set.
Resets and Reinitializations: The logs show multiple resets of the ESP32 and reinitializations of the SPI module. This might be triggered by specific actions like resetting the ESP32 or reloading the module.
Potential Overlay Warning: The warning about a potential memory leak when removing the overlay
why esps0 is not created or enabled why module is getting exit
The text was updated successfully, but these errors were encountered: