pixelmatix / AnimatedGIFs

MIT License
62 stars 34 forks source link

Need help : Guru Meditation Error: Core 1 panic'ed (InstrFetchProhibited). Exception was unhandled. #47

Open Jonahan06340 opened 3 months ago

Jonahan06340 commented 3 months ago

I wanted to try "AnimatedGIFs.ino" on an ESP32-WROOM-32 with an SD Card. The Led Matrix works very well with other example projects such as "FeatureDemo.ino". My SDCard test program works very well too, I can write and read from the SD card. But the "AnimatedGIFs.ino" project compiles well and uploads on the ESP32. When I don't insert an SD Card, it shows me scolling "No SD card" on the matrix led. But when I insert the SD Card, it crashes and restarts!

This is my setup : `

#define R1_PIN  GPIO_NUM_2
#define G1_PIN  GPIO_NUM_15
#define B1_PIN  GPIO_NUM_4
#define R2_PIN  GPIO_NUM_33 //16  RX2   Free

#define G2_PIN  GPIO_NUM_27
#define B2_PIN  GPIO_NUM_32 //17  TX2   Free
#define A_PIN   GPIO_NUM_13 //5   CS    Free
#define B_PIN   GPIO_NUM_3  //18  CLK   Free
#define C_PIN   GPIO_NUM_14 //19  MISO  Free
#define D_PIN   GPIO_NUM_21 
#define E_PIN   GPIO_NUM_12
#define LAT_PIN GPIO_NUM_26
#define OE_PIN  GPIO_NUM_25

#define CLK_PIN GPIO_NUM_22

`

I use this pins for the SdCard: MISO | GPIO_NUM_19 MOSI | GPIO_NUM_23 CLK | GPIO_NUM_18 CS | GPIO_NUM_5

To debug my program I use: U2_TXD | GPIO_NUM_17

This is what i receive form my uart: `Starting AnimatedGIFs Sketch

Starting SmartMatrix Mallocs Heap/32-bit Memory Available: 319316 bytes total, 110580 bytes largest free block 8-bit/DMA Memory Available : 253424 bytes total, 110580 bytes largest free block SmartMatrix Layers Allocated from Heap:

Heap/32-bit Memory Available: 304992 bytes total, 110580 bytes largest free block Starting SmartMatrix DMA Mallocs

sizeof framestruct: 00006000

DMA Memory Available before ptr1 alloc: 189116 bytes total, 110580 bytes largest free block matrixUpdateFrames[0] pointer: 3FFC950C

DMA Memory Available before ptr2 alloc: 189116 bytes total, 110580 bytes largest free block matrixUpdateFrames[1] pointer: 3FFCF51C

Frame Structs Allocated from Heap:

Heap/32-bit Memory Available: 255008 bytes total, 110580 bytes largest free block 8-bit/DMA Memory Available : 189116 bytes total, 110580 bytes largest free block Allocating refresh buffer:

lsbMsbTransitionBit of 0 requires 786432 RAM, 110580 available, leaving -675852 free:

lsbMsbTransitionBit of 1 requires 393216 RAM, 110580 available, leaving -282636 free:

lsbMsbTransitionBit of 2 requires 196608 RAM, 110580 available, leaving -86028 free:

lsbMsbTransitionBit of 3 requires 98304 RAM, 110580 available, leaving 12276 free:

lsbMsbTransitionBit of 4 requires 49152 RAM, 110580 available, leaving 61428 free:

Raised lsbMsbTransitionBit to 4/11 to fit in RAM

lsbMsbTransitionBit of 4 gives 75 Hz refresh, 120 requested:

lsbMsbTransitionBit of 5 gives 147 Hz refresh, 120 requested:

Raised lsbMsbTransitionBit to 5/11 to meet minimum refresh rate

Descriptors for lsbMsbTransitionBit 5/11 with 16 rows require 24576 bytes of DMA RAM

SmartMatrix Mallocs Complete

Heap/32-bit Memory Available: 230400 bytes total, 110580 bytes largest free block 8-bit/DMA Memory Available : 164508 bytes total, 110580 bytes largest free block Setting up parallel I2S bus at I2S1 1:chasm1.gif size:15036 README.txt Pathname: chasm1.gif Error opening GIF file Guru Meditation Error: Core 1 panic'ed (InstrFetchProhibited). Exception was unhandled.

Core 1 register dump: PC : 0x00000000 PS : 0x00060830 A0 : 0x800d1dc0 A1 : 0x3ffb2170
A2 : 0x3ffc1e84 A3 : 0x00000000 A4 : 0x00000000 A5 : 0x3ffc1ec8
A6 : 0xffffffff A7 : 0x00000000 A8 : 0x800d61f0 A9 : 0x3ffb2150
A10 : 0x3ffc1ec8 A11 : 0x00000000 A12 : 0x3ffb214d A13 : 0x0000002f
A14 : 0x00000000 A15 : 0x3f400d9c SAR : 0x0000000a EXCCAUSE: 0x00000014
EXCVADDR: 0x00000000 LBEG : 0x400844e9 LEND : 0x400844f1 LCOUNT : 0x00000026 Backtrace: 0xfffffffd:0x3ffb2170 0x400d1dbd:0x3ffb2240 0x400d315e:0x3ffb2270 0x400d99cd:0x3ffb2290

ELF file SHA256: bb5b888ee23e8755

Rebooting... ets Jul 29 2019 12:21:46

... ... ...

`

Thanks in advance for help.

Jonahan06340 commented 3 months ago

For those who encounter the same problem as me here is the solution. Replace the function as the following in the file "FilenameFunctions.cpp":

`

// Get the full path/filename of the GIF file with specified index void getGIFFilenameByIndex(const char directoryName, int index, char pnBuffer) { // Make sure index is in range if ((index < 0) || (index >= numberOfFiles)) return; File directory = SD.open(directoryName); if (!directory) return; while ((index >= 0)) { file = directory.openNextFile(); if (!file) break; if (isAnimationFile(file.name())) { index--; // Copy the directory name into the pathname buffer
strcpy(pnBuffer, directoryName); int len = strlen(pnBuffer); if (len == 0 || pnBuffer[len - 1] != '/') strcat(pnBuffer, "/"); // Append the filename to the pathname strcat(pnBuffer, file.name()); } file.close(); } file.close(); directory.close(); }

`

embedded-creations commented 3 months ago

Thanks for the fix. Let’s leave this open in case it’s something that needs to be fixed in the main repo. Not sure if the SD or other library changed breaking AnimatedGIFs