hideakitai / ESP32DMASPI

SPI library for ESP32 which use DMA buffer to send/receive transactions
MIT License
170 stars 36 forks source link

Something wrong #9

Closed L10N37 closed 2 years ago

L10N37 commented 2 years ago

This totally broke my ESP32, Uploading any of your examples caused a reset boot loop. I spent hours trying to fix the board using different methods of erasing the flash and trying every firmware you could possibly find. At one stage I bought it back to life, and was able to use the SD example for my VSPI SD card, then I uploaded your example again and it went back to a bootloop. Been up all night and EVERYTHING boot loops, except micropython FW.

ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x12 (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:5656 load:0x40078000,len:12696 load:0x40080400,len:4292 entry 0x400806b0 MicroPython v1.17 on 2021-09-02; ESP32 module with ESP32 Type "help()" for more information.

I'm not blaming you, just a little confused as to how it's happening. I can't seem to get anything working now other than this.

hideakitai commented 2 years ago

@L10N37 Hi, have you installed micropython FW? This is the library for Arduino.

L10N37 commented 2 years ago

Yeah, it's a duinotech wroom32 and the guide says ESP32 dev for the board. I've had nothing but trouble with it. First it wouldn't upload at all, not even holding boot. I did the capacitor on EN to GND and that didn't work but that allowed holding boot while uploading to kick it into upload. After this I discovered having a wife from GPIO0 (I/O zero) and tapping to ground during upload permanently fixed the issue. I removed the cap and now it uploads on its own without intervention.

The issue now, none of the normal ESP firmwares work..everything gets stuck in a reset boot loop! I only installed micropython to see if that worked and it did (tried the Mario music example on a speaker)

Going back to any other firmware now boot loops.

I will try a different brand of ESP32 board later and upload your code and see what happens. It's probably just a dud board?

L10N37 commented 2 years ago

So I uploaded your simple slave polling example and this other ESP is completely bricked. I can't do anything with it. Maybe I got unlucky with my boards.

L10N37 commented 2 years ago

Threw the other one in the bin and went back to the Duinotech. I lost access to the other one completely no matter what I did. I'm very sorry if this has nothing to do with your library, but it happened as soon as i flashed your code to both of them.

So here's the original ESP32, with a working FW - when I try to use Python to upload the factory FW it reports that there's not enough room in flash and it can't fit (xxxxxxxx) in flash storage size of (xxxxxxxx), only (xxxxxxxx) is the same value in both statements.

So here's the serial monitor with a working FW:

ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x12 (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:0x3fff0018,len:4 load:0x3fff001c,len:5008 ho 0 tail 12 room 4 load:0x40078000,len:10600 ho 0 tail 12 room 4 load:0x40080400,len:5684 entry 0x400806bc MicroPython v1.14 on 2021-02-02; ESP32 module with ESP32 Type "help()" for more information.

here are the flash success details in Arduino (I couldn't get it to work in Platform IO on visual code)

esptool.py v3.0-dev Serial port COM10 Connecting..... Chip is ESP32-D0WDQ6 (revision 1) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None Crystal is 40MHz MAC: 84:cc:a8:54:7b:14 Uploading stub... Running stub... Stub running... Changing baud rate to 921600 Changed. Configuring flash size... Auto-detected Flash size: 4MB Compressed 8192 bytes to 47... Writing at 0x0000e000... (100 %) Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 13107.5 kbit/s)... Hash of data verified. Compressed 18624 bytes to 12073... Writing at 0x00001000... (100 %) Wrote 18624 bytes (12073 compressed) at 0x00001000 in 0.2 seconds (effective 818.6 kbit/s)... Hash of data verified. Compressed 285728 bytes to 115542... Writing at 0x00010000... (12 %) Writing at 0x00014000... (25 %) Writing at 0x00018000... (37 %) Writing at 0x0001c000... (50 %) Writing at 0x00020000... (62 %) Writing at 0x00024000... (75 %) Writing at 0x00028000... (87 %) Writing at 0x0002c000... (100 %) Wrote 285728 bytes (115542 compressed) at 0x00010000 in 3.0 seconds (effective 752.4 kbit/s)... Hash of data verified. Compressed 3072 bytes to 128... Writing at 0x00008000... (100 %) Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.0 seconds (effective 4915.1 kbit/s)... Hash of data verified.

Leaving... Hard resetting via RTS pin...

and finally the serial monitor result after flash which is infinite loop:

rst:0x3 (SW_RESET),boot:0x12 (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:0x3fff0018,len:4 load:0x3fff001c,len:1216 ho 0 tail 12 room 4 load:0x40078000,len:10944 load:0x40080400,len:6360 entry 0x400806b4 ets Jun 8 2016 00:22:57

rst:0x3 (SW_RESET),boot:0x12 (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:0x3fff0018,len:4 load:0x3fff001c,len:1216 ho 0 tail 12 room 4 load:0x40078000,len:10944 load:0x40080400,len:6360 entry 0x400806b4 ets Jun 8 2016 00:22:57

rst:0x3 (SW_RESET),boot:0x12 (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:0x3fff0018,len:4 load:0x3fff001c,len:1216 ho 0 tail 12 room 4 load:0x40078000,len:10944 load:0x40080400,len:6360 entry 0x400806b4 ets Jun 8 2016 00:22:57

rst:0x3 (SW_RESET),boot:0x12 (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:0x3fff0018,len:4 load:0x3fff001c,len:1216 ho 0 tail 12 room 4 load:0x40078000,len:10944 load:0x40080400,len:6360 entry 0x400806b4 ets Jun 8 2016 00:22:57

rst:0x3 (SW_RESET),boot:0x12 (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:0x3fff0018,len:4 load:0x3fff001c,len:1216 ho 0 tail 12 room 4 load:0x40078000,len:10944 load:0x40080400,len:6360 entry 0x400806b4 ets Jun 8 2016 00:22:57

L10N37 commented 2 years ago

Here's a reflash of a random factory FW, with address changed from 0x1000 to 0x00 so I don't get the "not fitting" error.

c:\PYTHON>esptool.py --port COM10 --baud 512000 write_flash --flash_size=detect 0x00 factory.bin esptool.py v3.2-dev Serial port COM10 Connecting.... Detecting chip type... Unsupported detection protocol, switching and trying again... Connecting.... Detecting chip type... ESP32 Chip is ESP32-D0WDQ6 (revision 1) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None Crystal is 40MHz MAC: 84:cc:a8:54:7b:14 Uploading stub... Running stub... Stub running... Changing baud rate to 512000 Changed. Configuring flash size... Auto-detected Flash size: 4MB Flash will be erased from 0x00000000 to 0x003fffff... Compressed 4194304 bytes to 731375... Wrote 4194304 bytes (731375 compressed) at 0x00000000 in 34.4 seconds (effective 975.6 kbit/s)... Hash of data verified.

Leaving... Hard resetting via RTS pin...

and my new serial output, with nothing but the FW flashed:

Guru Meditation Error: Core 0 panic'ed (IllegalInstruction) . Exception was unhandled. Register dump: PC : 0x401040e0 PS : 0x00060230 A0 : 0x80101bc7 A1 : 0x3ffde9f0
A2 : 0x3ffc59b0 A3 : 0x3ffca334 A4 : 0x00100000 A5 : 0x0af300d7
A6 : 0x008d2018 A7 : 0x0000002a A8 : 0x801040dd A9 : 0x3ffde9b0
A10 : 0x00000000 A11 : 0x00000041 A12 : 0x00000037 A13 : 0x3ffc0d68
A14 : 0x3ffca334 A15 : 0x00000037 SAR : 0x00000006 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000

Backtrace: 0x401040e0:0x3ffde9f0 0x40101bc4:0x3ffdea10 0x40102852:0x3ffdea40 0x40181399:0x3ffdeaf0 0x401815d2:0x3ffdeb10 0x400da021:0x3ffdeb30 0x400da098:0x3ffdeb60 0x400da8ab:0x3ffdeb90 0x400ecf86:0x3ffdebb0

Rebooting... ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x12 (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:0x3fff0018,len:4 load:0x3fff001c,len:5564 load:0x40078000,len:0 load:0x40078000,len:13756 entry 0x40078fb4 I (28) boot: ESP-IDF v3.0.3 2nd stage bootloader I (29) boot: compile time 08:53:32 I (29) boot: Enabling RNG early entropy source... I (33) boot: SPI Speed : 40MHz I (37) boot: SPI Mode : DIO I (41) boot: SPI Flash Size : 4MB I (46) boot: Partition Table: I (49) boot: ## Label Usage Type ST Offset Length I (56) boot: 0 phy_init RF data 01 01 0000f000 00001000 I (64) boot: 1 otadata OTA data 01 00 00010000 00002000 I (71) boot: 2 nvs WiFi data 01 02 00012000 0000e000 I (79) boot: 3 at_customize unknown 40 00 00020000 000e0000 I (86) boot: 4 ota_0 OTA app 00 10 00100000 00180000 I (94) boot: 5 ota_1 OTA app 00 11 00280000 00180000 I (101) boot: End of partition table I (106) boot: No factory image, trying OTA 0 I (110) esp_image: segment 0: paddr=0x00100020 vaddr=0x3f400020 size=0x200f4 (131316) map I (165) esp_image: segment 1: paddr=0x0012011c vaddr=0x3ffc0000 size=0x02d6c ( 11628) load I (170) esp_image: segment 2: paddr=0x00122e90 vaddr=0x40080000 size=0x00400 ( 1024) load I (173) esp_image: segment 3: paddr=0x00123298 vaddr=0x40080400 size=0x0cd78 ( 52600) load I (203) esp_image: segment 4: paddr=0x00130018 vaddr=0x400d0018 size=0xdf390 (914320) map I (523) esp_image: segment 5: paddr=0x0020f3b0 vaddr=0x4008d178 size=0x01f14 ( 7956) load I (527) esp_image: segment 6: paddr=0x002112cc vaddr=0x400c0000 size=0x00064 ( 100) load I (539) boot: Loaded app from partition at offset 0x100000 I (539) boot: Disabling RNG early entropy source... Bin version(Wroom32):1.1.2

I (651) wifi: wifi firmware version: de47fad I (651) wifi: config NVS flash: enabled I (651) wifi: config nano formating: disabled I (661) wifi: Init dynamic tx buffer num: 32 I (661) wifi: Init data frame dynamic rx buffer num: 32 I (662) wifi: Init management frame dynamic rx buffer num: 32 I (667) wifi: wifi driver task: 3ffdec60, prio:23, stack:3584 I (672) wifi: Init static rx buffer num: 10 I (675) wifi: Init dynamic rx buffer num: 32 I (680) wifi: wifi power manager task: 0x3ffdfd2c prio: 21 stack: 2560

flashing anything after this, goes back to the bootloop from the above post.

L10N37 commented 2 years ago

Hi again,

I found my mistake, sorry about this issue. Getting another ESP32 today as I can't be bothered waiting for others to arrive! I have looking into a memory card for the playstation from pins 1:8 and wired it on the back of the controller board in reverse i.e. I've got it as 8:1, so fried 2 ESP32's! silly mistake. Thanks for the library. It should get me started...!

hideakitai commented 2 years ago

@L10N37 Great to hear that! Can I close this issue?

L10N37 commented 2 years ago

Oh yeah man of course. I had the VSPI hooked to an SD card properly but as mentioned I did the HSPI yours uses by default wrong. It was totally my mistake. Your examples are working perfectly. Thanks :)