espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.44k stars 7.38k forks source link

[esp32S3] USBMSC example crash #7236

Closed chegewara closed 2 years ago

chegewara commented 2 years ago

Board

esp32 s3 devkit

Device Description

devkit

Hardware Configuration

-

Version

v2.0.4

IDE Name

arduino IDE

Operating System

linux

Flash frequency

40

PSRAM enabled

no

Upload speed

115200

Description

When i am trying to perform benchmark on firmware MSC disk app crash (stack canary). It happen only on write benchmark, read benchmark is fine.

Sketch

https://github.com/espressif/arduino-esp32/tree/master/libraries/USB/examples/USBMSC

Debug Message

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
Octal Flash Mode Enabled
For OPI Flash, Use Default Flash Boot Mode
mode:SLOW_RD, clock div:1
load:0x3fcd0108,len:0x43c
load:0x403b6000,len:0xbd0
load:0x403ba000,len:0x29c8
entry 0x403b61d8
Guru Meditation Error: Core  0 panic'ed (Unhandled debug exception). 
Debug exception reason: Stack canary watchpoint triggered (usbd)

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

PS all USB examples are crashing on S3 due to empty loop() (WDT crash); there should be added delay() at least; it is not a problem on S2

Jason2866 commented 2 years ago

Your flash mode for OPI flash is not (wrong?) set.

For OPI Flash, Use Default Flash Boot Mode

So writing to flash is not working correctly. Typical issue when flash mode is false.

chegewara commented 2 years ago

The problem is not with flash, OPI type etc. It is Stack canary watchpoint triggered (usbd) which requires to be increased. Other than that example works fine with both OPI and QIO mode, depending on flash supported.

SuGlider commented 2 years ago

@chegewara - Could you please describe better how to reproduce the issue? I'm using Win11 and I get no error so far.

chegewara commented 2 years ago

I have no idea how to describe it better. I am using vanilla example, with just delay() in loop to avoid WDT. The only difference between my test and yours test is the fact i am using Ubuntu 20.04 and disk's benchmark test.

Example screen: Screenshot from 2022-09-19 16-08-07

SuGlider commented 2 years ago

The vanilla example sketch creates a Mass Storage Drive with just 6KB available space. In Win11, this drive is labled ESP32S2 MSC and it has a single file README.TXT. I'm (over)writing a new file of another 2KB to the drive several times and I get no error.

@chegewara - if possible, please turn on Debug messages and post here this output when the issue occurs.

chegewara commented 2 years ago

Sorry, ive been sick and i had no time to confirm it, but it is still not solved to me. I am not using arduino examples, so its not important to me to fix it, but if you dont care, well i dont care either.