espressif / esp-hosted

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

spi+NG Firmware version: 1.0.3 failed #409

Open hustzju opened 1 week ago

hustzju commented 1 week ago

I have tried to port spi+NG solution to my board. I use 1.0.3 version,but it does not work. host side log: root@myd-y6ull14x14:~# insmod esp32_spi.ko resetpin=44 raw_tp_mode=1 [ 62.261172] esp32_spi: loading out-of-tree module taints kernel. [ 62.515531] esp32_spi: spi_dev_init: ESP32 peripheral is registered to SPI bus [0],chip select [0], SPI Clock [10] root@myd-y6ull14x14:~# [ 64.502214] esp32_spi: process_esp_bootup_event: Received ESP bootup event [ 64.509381] esp32_spi: process_event_esp_bootup: Bootup Event tag: 3 [ 64.519797] esp32_spi: esp_validate_chipset: Chipset=ESP32 ID=00 detected over SPI [ 64.527798] esp32_spi: process_event_esp_bootup: Bootup Event tag: 2 [ 64.534208] esp32_spi: process_event_esp_bootup: Bootup Event tag: 0 [ 64.540839] esp32_spi: process_event_esp_bootup: Bootup Event tag: 1 [ 64.547437] esp32_spi: process_fw_data: ESP chipset's last reset cause: [ 64.554104] esp32_spi: print_reset_reason: POWERON_RESET [ 64.559578] esp32_spi: check_esp_version: ESP Firmware version: 1.0.3 [ 64.590606] esp32_spi: esp_reg_notifier: Driver init is ongoing [ 69.604735] esp32_spi: wait_and_decode_cmd_resp: Command[0x1] timed out [ 69.611444] esp32_spi: cmd_init_interface: wait_and_decode_cmd_resp(priv, cmd_node) failure, ret: -22 [ 69.625454] esp32_spi: esp_add_card: esp_add_network_ifaces(adapter) failure, ret: -1 [ 69.633557] esp32_spi: process_event_esp_bootup: network iterface init failed

esp32 side log: ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0030,len:7096 load:0x40078000,len:15584 load:0x40080400,len:4 ho 8 tail 4 room 4 load:0x40080404,len:3876 entry 0x4008064c I (31) boot: ESP-IDF v5.1.1-1-gd3c99ed-dirty 2nd stage bootloader I (31) boot: compile time Jun 21 2024 18:32:38 I (33) boot: Multicore bootloader I (37) boot: chip revision: v3.0 I (41) boot.esp32: SPI Speed : 40MHz I (45) boot.esp32: SPI Mode : DIO I (50) boot.esp32: SPI Flash Size : 4MB I (54) boot: Enabling RNG early entropy source... I (60) boot: Partition Table: I (63) boot: ## Label Usage Type ST Offset Length I (71) boot: 0 nvs WiFi data 01 02 00009000 00004000 I (78) boot: 1 otadata OTA data 01 00 0000d000 00002000 I (86) boot: 2 phy_init RF data 01 01 0000f000 00001000 I (93) boot: 3 factory factory app 00 00 00010000 00100000 I (100) boot: 4 ota_0 OTA app 00 10 00110000 00100000 I (108) boot: 5 ota_1 OTA app 00 11 00210000 00100000 I (116) boot: End of partition table I (120) boot: Defaulting to factory image I (125) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=20b50h (133968) map I (181) esp_image: segment 1: paddr=00030b78 vaddr=3ffbdb60 size=05430h ( 21552) load I (190) esp_image: segment 2: paddr=00035fb0 vaddr=40080000 size=0a068h ( 41064) load I (208) esp_image: segment 3: paddr=00040020 vaddr=400d0020 size=8ccc4h (576708) map I (416) esp_image: segment 4: paddr=000cccec vaddr=4008a068 size=14fb0h ( 85936) load I (468) boot: Loaded app from partition at offset 0x10000 I (468) boot: Disabling RNG early entropy source... I (479) cpu_start: Multicore app I (479) cpu_start: Pro cpu up. I (480) cpu_start: Starting app cpu, entry point is 0x40081448 I (0) cpu_start: App cpu up. I (497) cpu_start: Pro cpu start user code I (497) cpu_start: cpu freq: 240000000 Hz I (497) cpu_start: Application information: I (502) cpu_start: Project name: network_adapter I (508) cpu_start: App version: release/ng-v1.0.2-134-gce3c50a- I (515) cpu_start: Compile time: Jun 21 2024 18:32:27 I (521) cpu_start: ELF file SHA256: 85e42e0717a1bb23... I (527) cpu_start: ESP-IDF: v5.1.1-1-gd3c99ed-dirty I (533) cpu_start: Min chip rev: v0.0 I (538) cpu_start: Max chip rev: v3.99  I (543) cpu_start: Chip rev: v3.0 I (548) heap_init: Initializing. RAM available for dynamic allocation: I (555) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM I (561) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM I (567) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM I (573) heap_init: At 3FFC78A8 len 00018758 (97 KiB): DRAM I (579) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM I (586) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM I (592) heap_init: At 4009F018 len 00000FE8 (3 KiB): IRAM I (599) spi_flash: detected chip: generic I (603) spi_flash: flash io: dio I (607) coexist: coex firmware version: 80b0d89 I (612) app_start: Starting scheduler on CPU0 [0;32I (617) app_start: Starting scheduler on CPU1 mI (617) main_task: Started on CPU0 I (626) main_task: Calling app_main() I (630) stats:  I (638) stats: ESP-Hosted Firmware version :: 1.0.3  I (647) stats: Transport used :: SPI only  I (655) stats:  I (664) FW_MAIN: Supported features are: I (668) FW_MAIN: - WLAN over SPI I (672) FW_BT: - BT/BLE I (675) FW_BT: - HCI Over SPI I (679) FW_BT: - BT/BLE dual mode I (684) FW_MAIN: Capabilities: 0xf8 I (699) wifi:wifi driver task: 3ffbd5f0, prio:23, stack:6656, core=1 I (701) wifi:wifi firmware version: fddc5e5 I (702) wifi:wifi certification version: v7.0 I (704) wifi:config NVS flash: disabled I (708) wifi:config nano formating: disabled I (712) wifi:Init data frame dynamic rx buffer num: 40 I (717) wifi:Init management frame dynamic rx buffer num: 40 I (722) wifi:Init management short buffer num: 32 I (726) wifi:Init dynamic tx buffer num: 64 I (730) wifi:Init static rx buffer size: 1600 I (735) wifi:Init static rx buffer num: 16 I (738) wifi:Init dynamic rx buffer num: 40 I (743) wifi_init: rx ba win: 32 I (746) wifi_init: tcpip mbox: 32 I (750) wifi_init: udp mbox: 6 I (754) wifi_init: tcp mbox: 6 I (757) wifi_init: tcp tx win: 5744 I (762) wifi_init: tcp rx win: 5744 I (766) wifi_init: tcp mss: 1440 I (770) wifi_init: WiFi IRAM OP enabled I (774) wifi_init: WiFi RX IRAM OP enabled I (780) BTDM_INIT: BT controller compile version [946b762] I (786) BTDM_INIT: Bluetooth MAC: c8:f0:9e:08:bf:76 I (793) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07 I (1196) FW_MAIN: ESP Bluetooth MAC addr: c8-f0-9e- 8-bf-76  I (1196) FW_SPI: Using SPI interface I (1197) gpio: GPIO[2]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0  I (1205) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0  I (2217) FW_MAIN: Initial set up done I (2217) main_task: Returned from app_main() I (2335) FW_MAIN: INIT Interface command  I (2339) wifi:mode : sta (c8:f0:9e:08:bf:74) I (2340) wifi:enable tsf I (2340) FW_CMD: Wifi Sta mode set 

before v1.0.3, I have tried to download the released asset of v1.0.2, it could work. but it seemed to have a slow network speed. Because the released asset doesn't have raw throughput testing, so I upgrade v1.0.3, and compiled it . Then it doesn't work like above.

mantriyogesh commented 1 week ago

You need to always use same git commit for host and slave.

If you use 1.0.3 at slave, do you use same commit at host ng?

mantriyogesh commented 1 week ago

@kapilkedawat ++

mantriyogesh commented 1 week ago

What is the git commit you using at host and slave?

[ 69.604735] esp32_spi: wait_and_decode_cmd_resp: Command[0x1] timed out [ 69.611444] esp32_spi: cmd_init_interface: wait_and_decode_cmd_resp(priv, cmd_node) failure, ret: -22 [ 69.625454] esp32_spi: esp_add_card: esp_add_network_ifaces(adapter) failure, ret: -1 [ 69.633557] esp32_spi: process_event_esp_bootup: network iterface init failed

This possibly means you have issues while porting. Can you please try running spi only throughput test in Tx and Rx, both directions?

Also, please ensure that 'checksum' is enabled while flashing slave using 'idf.py menuconfig'.

hustzju commented 1 week ago
  1. I have download the latest code of your git , just modify handshake and ready pin number which is 1.0.3 version. And it occurs error like above. I'm sure 'checksum' is enabled while flashing slave using 'idf.py menuconfig'.
  2. when host and slave both on v1.0.1 ( also like v1.0.2 ), and the same hardware of esp32 and host, it could work, espsta0 appears. but throughput is very small. It seems that the speed was very fast at first, but later the response failed host_log.txt
kapilkedawat commented 1 week ago

Could you please try to run spi only throughput test b/w esp32 and host both side.

mantriyogesh commented 1 week ago

Only use laster master code at both ESP and host side.

You are trying to test iperf 3, which involves many variables, like wifi strength, interface, transport stability etc.

We are trying to isolate the transport performance first. Once transport is stable we can involve wifi etc. so spi only throughout test in either side is important to be tested with both side latest master.

hustzju commented 1 week ago

When use laster master code at both ESP and host side, something goes wrong. I have already talked about it above, this is log: spi_v1.0.3log.txt

mantriyogesh commented 1 week ago

yes,

https://github.com/espressif/esp-hosted/blob/b1422afc4fe0a2ea1ffd6b5459edddc4d968ee71/esp_hosted_ng/host/main.c#L324-L327

should be bypassed or optional if raw tp test ongoing.. @kapilkedawat

hustzju commented 1 week ago

when use v1.0.3, I load spi driver without raw_tp_mode parameter ,just "insmod esp32_spi_103.ko resetpin=44" . And Why don't the same errors occur on V1.0.2 and V1.0.1?

mantriyogesh commented 1 week ago

We understood, that is your main issue. https://github.com/espressif/esp-hosted/issues/409#issuecomment-2186086553 is also another issue, because of which raw tp is not working for you on 1.0.3

@kapilkedawat PTAL

hustzju commented 4 days ago

@mantriyogesh the issue of v1.0.3 , Will you still follow? Or could you give me source code with raw_tp_mode supported of v1.0.2? I can test the raw throughput on v1.0.2

kapilkedawat commented 4 days ago

@Shreyas0-7 could you please share raw tp on 1.0.2 once to verify?

Shreyas0-7 commented 4 days ago

Hey @hustzju can you please checkout to this commit 80193079 For this you have to follow these steps to setup raw throughput

hustzju commented 4 days ago

OK,tks,I will try

hustzju commented 4 days ago

I have two application related issues

  1. The connection between esp32 and the router may be disconnected sometimes, host side get logs: "Disconnect event for ssid Test wifi [reason:2]" or " [reason:3]". what is define of the error reason code?
  2. How to make the module automatically reconnect to WiFi if disconnected?