pixelmatix / AnimatedGIFs

MIT License
62 stars 34 forks source link

Unhandled Exception #31

Open DerArtz opened 5 years ago

DerArtz commented 5 years ago

I am unable to get this sketch to work due to Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled. Currently I have the panel connected as outlined in the MatrixHardware_ESP32_V0.h with the SD card connected HSPI gpio pins (12,13,14,33). In order to do this I modified the setup function to initialize SPI on these pins and also modified initSdCard to take in a SPIClass argument. From the output, it looks like the enumerateGIFFiles function completes without issue but there is a problem when calling openGifFilenameByIndex.

Output:

Starting AnimatedGIFs Sketch

Starting SmartMatrix Mallocs
Heap Memory Available: 356196 bytes total, 113792 bytes largest free block: 
8-bit Accessible Memory Available: 269824 bytes total, 113792 bytes largest free block: 
32-bit Memory Available: 356196 bytes total, 113792 bytes largest free block: 
DMA Memory Available: 269824 bytes total, 113792 bytes largest free block: 
SmartMatrix Layers Allocated from Heap:
Heap Memory Available: 348536 bytes total, 113792 bytes largest free block: 
Starting SmartMatrix DMA Mallocs
sizeof framestruct: 00003000
matrixUpdateFrames[0] pointer: 3FFB2C78
matrixUpdateFrames[1] pointer: 3FFC60AC
Frame Structs Allocated from Heap:
Heap Memory Available: 323512 bytes total, 113792 bytes largest free block: 
8-bit Accessible Memory Available: 237140 bytes total, 113792 bytes largest free block: 
32-bit Memory Available: 323512 bytes total, 113792 bytes largest free block: 
DMA Memory Available: 237140 bytes total, 113792 bytes largest free block: 
Allocating refresh buffer:
DMA Memory Available: 237140 bytes total, 113792 bytes largest free block: 
lsbMsbTransitionBit of 0 requires 786432 RAM, 113792 available, leaving -672640 free: 
lsbMsbTransitionBit of 1 requires 393216 RAM, 113792 available, leaving -279424 free: 
lsbMsbTransitionBit of 2 requires 196608 RAM, 113792 available, leaving -82816 free: 
lsbMsbTransitionBit of 3 requires 98304 RAM, 113792 available, leaving 15488 free: 
lsbMsbTransitionBit of 4 requires 49152 RAM, 113792 available, leaving 64640 free: 
Raised lsbMsbTransitionBit to 4/11 to fit in RAM
lsbMsbTransitionBit of 4 gives 150 Hz refresh, 120 requested: 
Raised lsbMsbTransitionBit to 4/11 to meet minimum refresh rate
Descriptors for lsbMsbTransitionBit 4/11 with 16 rows require 49152 bytes of DMA RAM
SmartMatrix Mallocs Complete
Heap Memory Available: 274328 bytes total, 113792 bytes largest free block: 
8-bit Accessible Memory Available: 187956 bytes total, 113792 bytes largest free block: 
32-bit Memory Available: 274328 bytes total, 113792 bytes largest free block: 
DMA Memory Available: 187956 bytes total, 113792 bytes largest free block: 
Setting up parallel I2S bus at I2S1
[E][vfs_api.cpp:39] open(): /sd/gifs check
[E][vfs_api.cpp:43] open(): Freeing
[E][vfs_api.cpp:46] open(): Right mode
bigbuck1.gif
bigbuck2.gif
chasm1.gif
explode2.gif
fight2.gif
star.gif
wifi.gif
[E][vfs_api.cpp:39] open(): /sd/gifs check
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x400f4ba5  PS      : 0x00060d30  A0      : 0x800d592e  A1      : 0x3ffb1880  
A2      : 0x00000021  A3      : 0x3ffb1c74  A4      : 0x3ffb1c20  A5      : 0x3ffd6138  
A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x800dc29d  A9      : 0x3ffb19a0  
A10     : 0x3ffb1bec  A11     : 0x3ffd50fc  A12     : 0x00000000  A13     : 0x00000000  
A14     : 0x3ffb5efb  A15     : 0x00000000  SAR     : 0x00000004  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000021  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xfffffffe  

Backtrace: 0x400f4ba5:0x3ffb1880 0x400d592b:0x3ffb18a0 0x400d3d01:0x3ffb18d0 0x400d4205:0x3ffb1900 0x400d9c36:0x3ffb1940 0x400d9f7d:0x3ffb1960 0x400db2ba:0x3ffb1980 0x400db409:0x3ffb19a0 0x400dc29a:0x3ffb19d0 0x400dd608:0x3ffb1c40 0x400df4cd:0x3ffb1db0 0x4000bcc5:0x3ffb1dd0 0x400e0171:0x3ffb1df0 0x400d56e1:0x3ffb1e10 0x400d4bc7:0x3ffb1e90 0x400d32d7:0x3ffb1ec0 0x400d33cf:0x3ffb1f30 0x400d257f:0x3ffb1f90 0x400d7959:0x3ffb1fb0 0x400871ad:0x3ffb1fd0

Rebooting...

Decoded Backtrace

PC: 0x400f4ba5: spiGetClockDiv at D:\sterl\Projects\ESP32Panel\arduino-1.8.8\portable\packages\esp32\hardware\esp32\1.0.1\cores\esp32\esp32-hal-spi.c line 291
EXCVADDR: 0x00000021

Decoding stack results
0x400f4ba5: spiGetClockDiv at D:\sterl\Projects\ESP32Panel\arduino-1.8.8\portable\packages\esp32\hardware\esp32\1.0.1\cores\esp32\esp32-hal-spi.c line 291
0x400d592b: SPIClass::beginTransaction(SPISettings) at D:\sterl\Projects\ESP32Panel\arduino-1.8.8\portable\packages\esp32\hardware\esp32\1.0.1\libraries\SPI\src\SPI.cpp line 130
0x400d3d01: (anonymous namespace)::AcquireSPI::AcquireSPI(ardu_sdcard_t*) at D:\sterl\Projects\ESP32Panel\arduino-1.8.8\portable\packages\esp32\hardware\esp32\1.0.1\libraries\SD\src\sd_diskio.cpp line 429
0x400d4205: ff_sd_read(unsigned char, unsigned char*, unsigned long, unsigned int) at D:\sterl\Projects\ESP32Panel\arduino-1.8.8\portable\packages\esp32\hardware\esp32\1.0.1\libraries\SD\src\sd_diskio.cpp line 584
0x400d9c36: ff_disk_read at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/fatfs/src/diskio.c line 69
0x400d9f7d: move_window at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/fatfs/src/ff.c line 1067
0x400db2ba: dir_find at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/fatfs/src/ff.c line 2465
0x400db409: follow_path at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/fatfs/src/ff.c line 3090
0x400dc29a: f_stat at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/fatfs/src/ff.c line 4579
0x400dd608: vfs_fat_stat at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/fatfs/src/vfs_fat.c line 466
0x400df4cd: esp_vfs_stat at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/vfs/vfs.c line 492
0x400e0171: stat at ../../../.././newlib/libc/syscalls/sysstat.c line 12
0x400d56e1: VFSImpl::open(char const*, char const*) at D:\sterl\Projects\ESP32Panel\arduino-1.8.8\portable\packages\esp32\hardware\esp32\1.0.1\libraries\FS\src\vfs_api.cpp line 42
0x400d4bc7: fs::FS::open(char const*, char const*) at D:\sterl\Projects\ESP32Panel\arduino-1.8.8\portable\packages\esp32\hardware\esp32\1.0.1\libraries\FS\src\FS.cpp line 191
0x400d32d7: getGIFFilenameByIndex(char const*, int, char*) at C:\Users\sterl\AppData\Local\Temp\arduino_build_529506\sketch\FilenameFunctions.cpp line 108
0x400d33cf: openGifFilenameByIndex(char const*, int) at C:\Users\sterl\AppData\Local\Temp\arduino_build_529506\sketch\FilenameFunctions.cpp line 140
0x400d257f: loop() at C:\Users\sterl\AppData\Local\Temp\arduino_modified_sketch_998226/AnimatedGIFs.ino line 244
0x400d7959: loopTask(void*) at D:\sterl\Projects\ESP32Panel\arduino-1.8.8\portable\packages\esp32\hardware\esp32\1.0.1\cores\esp32\main.cpp line 25
0x400871ad: vPortTaskWrapper at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/port.c line 143
embedded-creations commented 5 years ago

I haven't seen this before. It could be that an update to the SD library is requiring more RAM free. Try increasing the value that's passed to matrix.begin(), which tells SmartMatrix Library how much RAM to leave free (in this case for the SD library's mallocs) when it allocating buffers for refreshing the panels.

DerArtz commented 5 years ago

I have tried that with no luck. Went as high as 64000 with no improvement.

embedded-creations commented 5 years ago

pin 33 is used for generating a PWM signal. It's a feature that's not being used at the moment and can be removed without losing any existing functionality. I think just removing the call to setupTimer() is enough to disable this and free up that pin. Give it a try.

DerArtz commented 5 years ago

Still having the same issue. Also then tried to move the CS to pin 23 and got the same result.

embedded-creations commented 5 years ago

I'm stumped... Can you try the same SD card pins as the SmartLED Shield ESP32 prototype uses?

https://github.com/pixelmatix/SmartMatrix/blob/teensylc/extras/hardware/SmartLEDShield_ESP32_V0_sch.pdf

DerArtz commented 5 years ago

Well I am stumped too. Maybe I need to clean up any confusion with my setup. I do not have the latching circuitry setup as described in the schematic you are referring to.

Panel Setup

As described in MatrixHardware_ESP32_V0.h

Name Pin
R1_PIN 2
G1_PIN 15
B1_PIN 4
R2_PIN 16
G2_PIN 27
B2_PIN 17
A_PIN 5
B_PIN 18
C_PIN 19
D_PIN 21
E_PIN 12
LAT_PIN 26
OE_PIN 25
CLK_PIN 22

SD Card Setup

As described in SmartLEDShield_ESP32_THT_V0_sch.pdf

SD Card ESP32S Desc ESP32S Pin
DATA_OUT MISO 19
DATA_IN MOSI 23
SCLK SCK 18
CS CS 5

The problem from here is the dual use of the pins 18 & 19. Am I wrong in assuming that I do not need the extra circuitry of the the multiplexer/latch? I have no plans on adding the APA102 stuff to the project.

embedded-creations commented 5 years ago

You’ll have to move some pins around, you can’t share the SD pins with the HUB75 pins

DerArtz commented 5 years ago

Understand that. I have also used the following for the SD card wiring with the same result.

SD Card ESP32S Desc ESP32S Pin
DATA_OUT MISO 33
DATA_IN MOSI 13
SCLK SCK 14
CS CS 23
DerArtz commented 5 years ago

Can you give a suggestion of a viable pinout?

embedded-creations commented 5 years ago

The only pinout I know is working with the SD card is the one used in the SmartLED Shield ESP32 V0, requiring external parts.

You can move the HUB75 pins to any free GPIO that supports output mode. Make sure you're not using the same pins for SD and HUB75. I'm not sure about disabling the PWM pins as we talked about before, I haven't tried disabling them.