Skip to content
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

[BUG] ESP32C6 WIFI stop work after enable GPIO Interrupt #13303

Closed
1 task done
FelipeMdeO opened this issue Sep 5, 2024 · 10 comments · Fixed by #13368
Closed
1 task done

[BUG] ESP32C6 WIFI stop work after enable GPIO Interrupt #13303

FelipeMdeO opened this issue Sep 5, 2024 · 10 comments · Fixed by #13368
Labels
Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Area: Drivers Drivers issues OS: Linux Issues related to Linux (building system, etc) Type: Bug Something isn't working

Comments

@FelipeMdeO
Copy link
Contributor

Description / Steps to reproduce the issue

Hello All,

I am using esp32c6-devkitc. After enable SPI 2 in slave mode, WIFI feature stopped work.

Steps to reproduce:
1: Run esp32c6-devkitc wifi defconfig
2: Build and Flash, run in nuttx: wapi scan wlan0 - I will get wifi available list
3: Enable SPI2 peripheral and configure it as slave.
4: Run step 2 again, now no one wifi will be available

This is my nxdiag:

nsh> nxdiag --all
Nxdiag Report:

NuttX RTOS info:
        Hostname: 
        Release: 12.6.0-RC1
        Build: da6ddea8d4 Sep  5 2024 13:03:53
        Arch: risc-v
        Defconfig: esp32c6-devkitc:wifi-dirty

Host system OS:
        Ubuntu 24.04 LTS Linux felipe-moura 6.8.0-41-generic #41-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug  2 20:41:06 UTC 2024 x86_64 x86_64

Espressif specific information:

Bootloader version:
        esp32: Bootloader image not found
        esp32s2: Bootloader image not found
        esp32s3: Bootloader image not found
        esp32c2: Bootloader image not found
        esp32c3: Bootloader image not found
        esp32c6: Bootloader image not found
        esp32h2: Bootloader image not found

Toolchain version:
        clang: Not found
        gcc: gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
        xtensa-esp32-elf-gcc: xtensa-esp32-elf-gcc (crosstool-NG esp-2020r2) 8.2.0
        xtensa-esp32s2-elf-gcc: Not found
        xtensa-esp32s3-elf-gcc: Not found
        riscv32-esp-elf-gcc: Not found
        riscv64-unknown-elf-gcc: Not found

Esptool version: 4.8.dev4

HAL version: sync/release_v5.1.c-nuttx-20230814-1568-g51770f0c97

And my defconfig:

#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NDEBUG is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ALLOW_BSD_COMPONENTS=y
CONFIG_ARCH="risc-v"
CONFIG_ARCH_BOARD="esp32c6-devkitc"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32C6_DEVKITC=y
CONFIG_ARCH_CHIP="esp32c6"
CONFIG_ARCH_CHIP_ESP32C6=y
CONFIG_ARCH_CHIP_ESP32C6WROOM1=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_RISCV=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=15000
CONFIG_BUILTIN=y
CONFIG_DEV_ZERO=y
CONFIG_DRIVERS_IEEE80211=y
CONFIG_DRIVERS_WIRELESS=y
CONFIG_ESPRESSIF_ESP32C6=y
CONFIG_ESPRESSIF_SPI2=y
CONFIG_ESPRESSIF_SPI2_SLAVE=y
CONFIG_ESPRESSIF_SPIFLASH=y
CONFIG_ESPRESSIF_SPIFLASH_SPIFFS=y
CONFIG_ESPRESSIF_WIFI=y
CONFIG_EXAMPLES_RANDOM=y
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=8192
CONFIG_INTELHEX_BINARY=y
CONFIG_IOB_THROTTLE=24
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETDEV_LATEINIT=y
CONFIG_NETDEV_PHY_IOCTL=y
CONFIG_NETDEV_WIRELESS_IOCTL=y
CONFIG_NETDEV_WORK_THREAD=y
CONFIG_NETUTILS_CJSON=y
CONFIG_NET_BROADCAST=y
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_TCP=y
CONFIG_NET_TCP_DELAYED_ACK=y
CONFIG_NET_TCP_WRITE_BUFFERS=y
CONFIG_NET_UDP=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_NSH_STRERROR=y
CONFIG_PREALLOC_TIMERS=0
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_BACKTRACE=y
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SIG_DEFAULT=y
CONFIG_SPI_SLAVE=y
CONFIG_SPI_SLAVE_DRIVER=y
CONFIG_START_DAY=29
CONFIG_START_MONTH=11
CONFIG_START_YEAR=2019
CONFIG_SYSTEM_DHCPC_RENEW=y
CONFIG_SYSTEM_DUMPSTACK=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_NXDIAG=y
CONFIG_SYSTEM_NXDIAG_ESPRESSIF=y
CONFIG_SYSTEM_PING=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_TLS_TASK_NELEM=4
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_WIRELESS=y
CONFIG_WIRELESS_WAPI=y
CONFIG_WIRELESS_WAPI_CMDTOOL=y
CONFIG_WIRELESS_WAPI_INITCONF=y

@tmedicci can you check this behavior in your side, please?

On which OS does this issue occur?

[Linux]

What is the version of your OS?

Ubuntu 24.0

NuttX Version

master

Issue Architecture

[risc-v]

Issue Area

[Drivers]

Verification

  • I have verified before submitting the report.
@FelipeMdeO FelipeMdeO added the Type: Bug Something isn't working label Sep 5, 2024
@github-actions github-actions bot added Area: Drivers Drivers issues OS: Linux Issues related to Linux (building system, etc) Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture labels Sep 5, 2024
@FelipeMdeO FelipeMdeO changed the title [BUG] ESP32C6 WIFI stop work after enable spi 2 in slave mode [BUG] ESP32C6 WIFI stop work after enable GPIO Interrupt Sep 5, 2024
@FelipeMdeO
Copy link
Contributor Author

Hello All,

I changed the title because during investigation I was able to see that the issue is related enable GPIO interrupt when we are using wifi.

So, another way to reproduce is:

1: ./tools/configure.sh esp32c6-devkitc:wifi
2: make menuconfig
3: System Type -> Peripheral Support -> enable GPIO pin interrupts.
4: Test wapi scan wlan 0
it won't work.

@acassis acassis assigned acassis and unassigned acassis Sep 5, 2024
@acassis
Copy link
Contributor

acassis commented Sep 5, 2024

@tmedicci did you see this issue before?

@acassis
Copy link
Contributor

acassis commented Sep 5, 2024

@tmedicci did you see this issue before? Any idea why GPIO interrupt enable is breaking WiFi?

I think we should remove the option to disable INT for GPIO, because all MCUs on NuttX support it by default.

@acassis acassis closed this as completed Sep 5, 2024
@acassis acassis reopened this Sep 5, 2024
@acassis
Copy link
Contributor

acassis commented Sep 5, 2024

@FelipeMdeO @tmedicci I confirmed the issue:

nsh> ls /dev
/dev:
 console
 espflash
 gpio0
 gpio1
 gpio2
 null
 random
 rtc0
 ttyS0
 zero
nsh> wapi scan wlan0
nsh>

Before enabling the GPIO INT the scan was working!

@acassis
Copy link
Contributor

acassis commented Sep 6, 2024

@fdcavalcanti could you please help to investigate this issue?

@tmedicci
Copy link
Contributor

tmedicci commented Sep 6, 2024

Hi @FelipeMdeO and @acassis , we will investigate it internally soon.

@tmedicci
Copy link
Contributor

tmedicci commented Sep 6, 2024

Hi @FelipeMdeO,

Can you please test using another version of the HAL, just set the following env variables before running the make command. For instance:

ESP_HAL_3RDPARTY_VERSION=eff2dab80ce352018159d7fe67c437e505e12f0a ESP_HAL_3RDPARTY_URL="[email protected]:tmedicci/esp-hal-3rdparty.git" make flash ESPTOOL_PORT=/dev/ttyUSB0

Just to let you know: I just reserved some CPU interrupts that are specific for some peripherals and this probably is the reason for this issue. I was able to make it work with this new HAL. If it works for you too, I'll create the PR. Please let me know.

@FelipeMdeO
Copy link
Contributor Author

Hi @FelipeMdeO,

Can you please test using another version of the HAL, just set the following env variables before running the make command. For instance:

ESP_HAL_3RDPARTY_VERSION=eff2dab80ce352018159d7fe67c437e505e12f0a ESP_HAL_3RDPARTY_URL="[email protected]:tmedicci/esp-hal-3rdparty.git" make flash ESPTOOL_PORT=/dev/ttyUSB0

Just to let you know: I just reserved some CPU interrupts that are specific for some peripherals and this probably is the reason for this issue. I was able to make it work with this new HAL. If it works for you too, I'll create the PR. Please let me know.

Let me test it properly and I update you as soon as possible.

@FelipeMdeO
Copy link
Contributor Author

Hello @tmedicci,

Thank you for fix this behavior. I did some tests and all is good now. Let's open a PR.

@tmedicci
Copy link
Contributor

tmedicci commented Sep 9, 2024

Hello @tmedicci,

Thank you for fix this behavior. I did some tests and all is good now. Let's open a PR.

Alright, I just need to wait for the internal tests to pass and I will open it soon. Thanks for testing.

tmedicci added a commit to tmedicci/incubator-nuttx that referenced this issue Sep 10, 2024
This commit updates the HAL version used by NuttX to fix the bug
reported in apache#13303
xiaoxiang781216 pushed a commit that referenced this issue Sep 11, 2024
This commit updates the HAL version used by NuttX to fix the bug
reported in #13303
medexs pushed a commit to medexs/nuttx that referenced this issue Sep 19, 2024
This commit updates the HAL version used by NuttX to fix the bug
reported in apache#13303
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Area: Drivers Drivers issues OS: Linux Issues related to Linux (building system, etc) Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants