Skip to content

Instantly share code, notes, and snippets.

@bahorn
Last active March 6, 2020 18:20
Show Gist options
  • Save bahorn/f9d113b44f810b63df1c5a4f28cc8048 to your computer and use it in GitHub Desktop.
Save bahorn/f9d113b44f810b63df1c5a4f28cc8048 to your computer and use it in GitHub Desktop.
PlatformIO board config for the TTGO LoRa32 OLED V2. Have tested with a simple LoRaWAN example. Do need to double check the settings before upstreaming.
{
"build": {
"core": "esp32",
"extra_flags": "-DARDUINO_TTGO_LoRa32_V2",
"f_cpu": "240000000L",
"f_flash": "40000000L",
"flash_mode": "dio",
"ldscript": "esp32_out.ld",
"mcu": "esp32",
"variant": "ttgo-lora32-v2"
},
"connectivity": [
"wifi",
"bluetooth",
"ethernet",
"can"
],
"debug": {
"openocd_board": "esp-wroom-32.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "TTGO LoRa32-OLED V2",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 532480,
"maximum_size": 4194304,
"require_upload_port": true,
"speed": 921600
},
"url": "https://www.google.com/search?q=TTGO+LoRa32-OLED+V2",
"vendor": "TTGO"
}
@macpelos
Copy link

macpelos commented Mar 6, 2020

Nice work!!
I tried with this one and the only problem is that terminal says: [E][esp32-hal-cpu.c:148] setCpuFrequencyMhz(): Bad frequency: 400 MHz! Options are: 240, 160, 80, 40, 20 and 10 MHz.
Changing "f_cpu" to "240000000L" took out the error, but I don't know if this is the best way to avoid it.
Thanks!!

@bahorn
Copy link
Author

bahorn commented Mar 6, 2020

Hi @macpelos!

Had a quick check into it and it seems it was a misunderstanding on my end. 240000000L should be correct. Worked on my machine when I posted this (and when I just checked now).

Seems my dev project was using the espidf framework which is why I didn't encounter the issue. The arduino-esp32 framework includes that error message and seems to actually validate the frequency.

The SOC on this board is an ESP32-PICO-D4 which has an internal 40MHz oscillator[1], which is where I got the value for the frequency from. (with an extra 0 for some reason) Apparently this isn't the actual clock rate, which is where my confusion came from, as the CPU only comes in 240MHz or 160MHz.

Thanks for pointing this out to me!

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