ESP-32 Newbie Questions

GreyGnome
Posts: 2
Joined: Mon May 18, 2020 1:05 am

ESP-32 Newbie Questions

Postby GreyGnome » Mon May 18, 2020 3:51 am

I have purchased a couple of ESP-32 WROOM-32D boards and a 64x32 HUB75-interface LED matrix. I am programming it with the Arduino IDE. This is my first foray into 32-bit microcontrollers, and I have some questions.
  • Are my ESP-32 boards running FreeRTOS? Or is that uploaded automatically by Arduino, when I submit my sketch?
    • I didn't want an OS. I was looking forward to having full control over GPIO pin timings without worrying about other tasks, interrupts, etc. See below, about the PxMatrix library.
    • If I must have an OS, can I pin my task to processor 1 and have exclusive use of it? I don't want to yield(). Also see below.
  • Does this come with 4MB memory? I have read that online, but the data sheet says there's only about 500KB of flash, and on one of my programs, the Arduino IDE reports, "Sketch uses 225553 bytes (17%) of program storage space. Maximum is 1310720 bytes." Wikipedia says that the ESP32-WROOM-32D has 4MB flash.
  • How fast is my processor? Can I change its speed? I notice that it has a 40MHz crystal, but I think one of the cores is running at 80MHz and the other runs at 240MHz? Or am I confused?
PxMatrix Library findings:

I downloaded the PxMatrix library and have installed a simple "BananaDance" demo from https://github.com/witnessmenow/LED-Mat ... ce-Display. It loads 8 frames of a famous dancing banana, and loops over those frames.

I notice that every 11 frames or so, the display blanks for a half second. I presume that's because my task is preempted.

ESP_Sprite
Posts: 9739
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP-32 Newbie Questions

Postby ESP_Sprite » Mon May 18, 2020 6:55 am

Yes, your boards are running FreeRTOS. Your code is linked against it when you compile/upload your sketch. No, you cannot go without FreeRTOS as it is integral to Arduino. More in general, going without a RTOS on ESP* processors is more-or-less impossible as running WiFi/BT requires one. You can pin your task to CPU1 and have that CPU more-or-less exclusively to yourself, but for some things (NVS, timer tick, ...) the CPU still will be interrupted.

Yes, your modules come with 4MiB of flash. Datasheet says so as well: 'Flash: 32 Mbit'. You see less in Arduino as the flash is partitioned into different bits (bootloader, preferences OTA upgrade partition, ....)

Both cores can run at 240MHz and will do so by default. I think you can change the overall speed, but I don't know the Arduino call for that. ESP-IDF has automatic power saving by downclocking the system when it's not needed, but I'm not sure if Arduino turns that on.

In general, chips like this are not meant for direct low-level GPIO control; aside from software interrupts, there are all sorts of things that make the chip very fast but somewhat indeterministic wrt latency: shared paths to RAM, cache refills from flash, ... To compensate for this, there is a rich set of peripherals, amongst others an I2S interface that can read using DMA and can send over image data to a panel like yours without using any CPU at all. People also seem to have made libraries for the Arduino for that, take a look e.g. here.

GreyGnome
Posts: 2
Joined: Mon May 18, 2020 1:05 am

Re: ESP-32 Newbie Questions

Postby GreyGnome » Tue May 19, 2020 2:05 am

Great, thanks for the reply! I don't mind going to the I2S DMA subsystem- that's exactly the sort of thing that makes this entirely usable even for an LED display.

I'm excited to get started!

Who is online

Users browsing this forum: No registered users and 118 guests