Set different sdkconfig params in platformio.ini?

Hi there, this is my first post. :slight_smile:

I am working with different ESP32 boards (Heltec, DEVKITV1,…) some of them need different crystal speed. Heltec, for example, needs 26Mhz.

So when I change that in sdkconfig.h from

#define CONFIG_ESP32_XTAL_FREQ 40

to

#define CONFIG_ESP32_XTAL_FREQ 26

then this is only valid for Heltec boards. But not for the others which needs 40 MHz.

How can I solve that challenge?

Thank you in advance

If these boards always need a different CONFIG_ESP32_XTAL_FREQ I would rather open an issue at GitHub - platformio/platform-espressif32: Espressif 32: development platform for PlatformIO so that this error gets corrected.

Thank you for that, I created an issue:

Just remove this line from sdkconfig.h and use build_flags.

[env:Heltec]
...
build_flags = -D CONFIG_ESP32_XTAL_FREQ=26

[env:DEVKITV1]
...
build_flags = -D CONFIG_ESP32_XTAL_FREQ=99999
1 Like