Skip to content

Support ESP32 C3, S3 and possibly H2 variants - #1320

Merged
samguyer merged 4 commits into
FastLED:masterfrom
projects-land:new_esp32_types
Nov 30, 2021
Merged

samguyer merged 4 commits into
FastLED:masterfrom
projects-land:new_esp32_types

Conversation

@projects-land

@projects-land projects-land commented Nov 17, 2021 •

Copy link
Copy Markdown
Contributor

Adding support required for ESP32 C3 & S3 variants, and possibly H2 variant (not able to compile for H2 yet)

  • Updated pin mapping mechanism to support multiple variants based on valid output pin defines provide by the ESP-IDF, should automatically support any new chip variants with up to 64 pins. This also fixes incorrectly masked out pins on ESP32-S2
  • Updated FastPin to support chip variants that only have a single output retister
  • Fix compile error on RISC-V based variants
  • Updated clockless_rmt_esp32 to support all upcoming variants. Tested on ESP32, ESP32-C3, & ESP32-S2 under Arduino. ESP32-S3 tested using esp-idf and a small shim to replace some missing Arduino library functions. ESP32-H2 not yet functional in ESP-IDF so can't compile test yet.

Fixes #1255
Fixes #1232

* Add support for C3, S3, and H2
* Update pin definition mechanism to be to support multiple variants
* Fix S2 mapping that were excluding base ESP32 pin masking
* Tested on ESPC3 hardware, not yet tested on ESPS3 or H2
@projects-land

Copy link
Copy Markdown
Contributor Author

@samguyer It would definitely be useful to have your eyes on this change, especially the clockless_rmt portions. I pulled over a lot of new drive code based largely on what I had seen alreayd brought over for the base ESP32.

Not sure if any of the hardware difference will cause any issues. The ones that stood out are:

  • 48 words per RMT channel for ESP32S3, ESP32C3, ESP32H2 vs 64
  • 2 RMT TX channels for ESP32C3 & ESP32H2 vs. 4 or 8
  • 40MHz RMT/APB clock for ESP32H2 vs 80MHz

@samguyer

Copy link
Copy Markdown
Contributor

@maddogjt Wow, this looks like amazing work. Thank you! I just want to look it over a little bit, but I will try to merge it in the next couple of days. I know that people are champing at the bit to use all the new ESP32 variants.

@samguyer

Copy link
Copy Markdown
Contributor

@maddogjt Have you been able to test your driver changes on these platforms?

@projects-land

Copy link
Copy Markdown
Contributor Author

@samguyer I've tested on all platforms other than H2 with a short 8 LED strip. Hope to find time in the next few days to test some longer and multi-strip setups.

For testing S3 boards, I setup a small shim to run under esp-idf since their arduino core isn't ready yet. https://github.com/maddogjt/fastled_espidf_s3

@9Rune5 9Rune5 mentioned this pull request Nov 28, 2021
@samguyer

Copy link
Copy Markdown
Contributor

@maddogjt Fantastic. Do you think it's read to merge? Are you happy with it?

@projects-land

Copy link
Copy Markdown
Contributor Author

@samguyer I'm happy with it, and I think it's ready to merge.

@samguyer
samguyer merged commit 1547b93 into FastLED:master Nov 30, 2021
@samguyer

Copy link
Copy Markdown
Contributor

@maddogjt Thank you so much for your contribution -- it is officially merged!

@Jueff

Jueff commented Dec 15, 2021 •

Copy link
Copy Markdown
Contributor

when replacing my current 3.4.0 release with the current master branch I'm facing some build issues.
The changes break the build on Arduino platform

error message:
In file included from ...\Arduino\LIBRARIES\FastLED\src/platforms/esp/32/fastled_esp32.h:12:0,
....\Arduino\LIBRARIES\FastLED\src/platforms/esp/32/clockless_rmt_esp32.h:174:43:

error: missing binary operator before token "("
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)

seems that ESP_IDF_VERSION_VAL is not defined.

adding

#ifndef ESP_IDF_VERSION_VAL
#define ESP_IDF_VERSION_VAL(major, minor, patch) ((major << 16) | (minor << 8) | (patch))
#endif

in clockless_rmt_esp32.h may workaround the problem.

But also CONFIG_IDF_TARGET_ESP32 is undefined, leading to another error
Not yet implemented for unknown ESP32 target

Could be please check?

@projects-land

Copy link
Copy Markdown
Contributor Author

@Jueff Which version of the ESP32 board package are you using? I tested this change with 1.06 and 2.0.1. It's possible that older versions may no longer be compatible with this change.

@Jueff

Jueff commented Dec 15, 2021 •

Copy link
Copy Markdown
Contributor

@maddogjt I'm using 1.0.4, and currently I'm not able to upgrade.

I added this code as a workaround in fastled_esp32.h

#ifndef ESP_IDF_VERSION_VAL
  #define ESP_IDF_VERSION_VAL(major, minor, patch) ((major << 16) | (minor << 8) | (patch))
  #ifndef CONFIG_IDF_TARGET_ESP32
    #define CONFIG_IDF_TARGET_ESP32 1
  #endif
#endif

maybe that could also be part of the official release.

@mariusmotea

Copy link
Copy Markdown

There are still issues with ESP32-C3, #1349

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request support for ESP32-C3-DevKitM-1 too. Is there any plan to support newer ESP32-S2, S3, C2, C3 chip?

4 participants