SmartMatrix Library ESP32 Port


#21

Hey Louis, quick question. How did you get the sketch to work with the ESP8266Wifi.h file? I thought that was only available on the ESP8266.


#22

I don’t know anything about that file, is it a part of Jason’s ESP32 FastLED Web Server sketch?


#23

Yes, it’s one of the included libraries in your fork of Jason’s Webserver. It’s on line 36 in the esp32-fastled-webserver.ino file. Am I looking in the wrong place?


#24

Check out the README that Jason wrote for the sketch. It says he uses https://github.com/bbx10/WebServer_tng which has support for both ESP8266 and ESP32


#25

Hi Louis! Thanks for the port to ESP32! Really helpful! Will you be releasing the ESP32 interface board or possibly the gerber files so we can have it fabed?


#26

Hi Rich, the board design in Eagle and gerber files are available in the repo already:

Check out the “Hardware” section in the README as well. I’m not working on bringing the ESP32 shield to production at this point, so getting them made yourself is the only option.


#27

Hi Louis,

Thanks for the quick response! I just see the brd file and schematics in the repo for the ESP32 board. Will you be releasing the gerbers or should I just generate them from the brd file? Been some time since I ordered PCBs so please forgive me if gerbers are easy to generate…


#28

Oops, I just glanced at the folder before and assumed there were gerbers there. I suggest ordering from oshpark.com, and you can use the Eagle .brd file directly, plus they make quality boards. Google and a free copy of Eagle can help you make gerber files, but let me know if you need a hand.


#29

Hi,

I tried using a P2 64x128 matrix with the ESP32 and cannot get it working with 128x64 pixel because the DMA malloc fails. However it works fine with 64x64 pixel. Does anyone know how to solve this?


#30

Actually I can get the 128x64 matrix working by changing the line 192 of SmartMatrixMultiplexedRefreshEsp32_Impl.h
from:
matrixUpdateFrames[1] = (frameStruct *)heap_caps_malloc(sizeof(frameStruct), MALLOC_CAP_DMA);
to:
matrixUpdateFrames[1] = matrixUpdateFrames[0];

Everything looks fine, does anyone know why we need the matrixUpdateFrames[1] at all?


#31

You’re likely out of RAM. You can try to reduce RAM by using 24 instead of 36 bit color:

kRefreshDepth = 24;

If you get rid of the second frame buffer, you’ll be drawing and refreshing from the same buffer, and artifacts may show up on the screen while you are in the middle of drawing a new frame, or other weird stuff may happen. If it works for you and you don’t notice any issues, then may as well keep using it that way.

Also I just pushed a bugfix that had been sitting in my local git repo, that had to do with a malloc calculation that could fail when there’s small amounts of RAM free. Try with the latest code, and that may also fix the issue for you.


#32

Ok, thank you @Louis

I have edited the code to show the single mallocs and it looks like there is no block large enough for the second matrixUpdateFrames malloc.

Starting SmartMatrix DMA Mallocs
Step 0: Heap Memory Available: 260076 bytes total, 113792 bytes largest free block: 
Step 0: 8-bit Accessible Memory Available: 167400 bytes total, 113792 bytes largest free block: 
Step 0: 32-bit Memory Available: 260076 bytes total, 113792 bytes largest free block: 
Try to allocate: 65536 bytes... Done.

Step 1: Heap Memory Available: 194524 bytes total, 92676 bytes largest free block: 
Step 1: 8-bit Accessible Memory Available: 101848 bytes total, 48240 bytes largest free block: 
Step 1: 32-bit Memory Available: 194524 bytes total, 92676 bytes largest free block: 
Try to allocate: 65536 bytes... 
assertion "matrixUpdateFrames[1] != NULL" failed: file "lib\SmartMatrix-teensylc\src/SmartMatrixMultiplexedRefreshEsp32_Impl.h"

It already uses kRefreshDepth = 24. 65536 bytes would be 8 bytes per pixel. Is that correct?

I will try it with the new code soon.


#33

65536 bytes would be 8 bytes per pixel. Is that correct?

Yes, that’s correct. I believe on the ESP32 the way I implemented the code you need one byte of RAM per pixel times the number of bits of colordepth (kRefreshDepth/3).