New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for esp32 board "Heltec wifikit 32 v2" #8713
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi - great progress. I noted several things.
Check some existing ESP32 boards to see what they do, especially for mpconfigboard.mk.
CIRCUITPY_CREATOR_ID = 0x148E173C | ||
# TODO: What value should it be? | ||
CIRCUITPY_CREATION_ID = 0x00000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can go here: https://github.com/creationid/creators/blob/main/creations/heltec.md and propose a PR with a new creation ID. It doesn't matter much what it is - if there's a stock number you could use that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
/* Not available on esp32: | ||
{ MP_ROM_QSTR(MP_QSTR_IO24), MP_ROM_PTR(&pin_GPIO24) }, | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take out the commented-out pins.
Also only include pins that are accessible. If some are not connected at all to any accessible pads, take them away also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
/** Todo: Adapt for the Lora Version of the WifiKit 32 V2 board | ||
{ MP_ROM_QSTR(MP_QSTR_LORA_NSS), MP_ROM_PTR(&pin_GPIO8) }, | ||
{ MP_ROM_QSTR(MP_QSTR_LORA_SCK), MP_ROM_PTR(&pin_GPIO9) }, | ||
{ MP_ROM_QSTR(MP_QSTR_LORA_MOSI), MP_ROM_PTR(&pin_GPIO10) }, | ||
{ MP_ROM_QSTR(MP_QSTR_LORA_MISO), MP_ROM_PTR(&pin_GPIO11) }, | ||
{ MP_ROM_QSTR(MP_QSTR_LORA_RST), MP_ROM_PTR(&pin_GPIO12) }, | ||
{ MP_ROM_QSTR(MP_QSTR_LORA_BUSY), MP_ROM_PTR(&pin_GPIO13) }, | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove from this board.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
digitalio_digitalinout_obj_t display_on; | ||
|
||
static void display_init(void) { | ||
// Need to bring GPIO4 high or the screen doesn't get power : TODO: This is GPIO21 (OLED_RST) on Heltec Lora V3 on ESP32-S3, right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you address this to-do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
CIRCUITPY_ESP_USB_SERIAL_JTAG = 0 | ||
|
||
# Todo: qio or dio? | ||
CIRCUITPY_ESP_FLASH_MODE = dio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to tell this from the module or the schematic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has no influence to flashing process nor what debug output at startup reports: It's always mentioned "dio".
I set it to dio for now. Done.
# Todo: qio or dio? | ||
CIRCUITPY_ESP_FLASH_MODE = dio | ||
# esp-idf-config/sdkconfig-flash-26m.defaults does not exist in main branch | ||
CIRCUITPY_ESP_FLASH_FREQ = 26m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually the flash frequency, or just the crystal frequency? You can choose the flash frequency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I have no clue. This is what the flashing tool reports and I don't know where else to get the info from:
esptool.py v4.7.dev3
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP32-D0WDQ6 (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 26MHz
MAC: 24:0a:c4:5c:11:d8
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00155fff...
Compressed 1399360 bytes to 952771...
Wrote 1399360 bytes (952771 compressed) at 0x00000000 in 19.5 seconds (effective 575.6 kbit/s)...
Hash of data verified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most espressif boards that I know of run their flash chips at 40m or 80m.
You can try different settings and see what works.
Unless it's using a unique or absolutely ancient chip, it will probably work at 40m.
ports/espressif/boards/heltec_esp32_wifikit_32_v2/mpconfigboard.mk
Outdated
Show resolved
Hide resolved
ports/espressif/boards/heltec_esp32_wifikit_32_v2/mpconfigboard.mk
Outdated
Show resolved
Hide resolved
|
||
IDF_TARGET = esp32 | ||
|
||
DEBUG = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this affects the global CP build settings, but if it does, it should absolutely not be done.
# Todo: qio or dio? | ||
CIRCUITPY_ESP_FLASH_MODE = dio | ||
# esp-idf-config/sdkconfig-flash-26m.defaults does not exist in main branch | ||
CIRCUITPY_ESP_FLASH_FREQ = 26m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most espressif boards that I know of run their flash chips at 40m or 80m.
You can try different settings and see what works.
Unless it's using a unique or absolutely ancient chip, it will probably work at 40m.
|
||
CIRCUITPY_ESPCAMERA = 0 | ||
|
||
CIRCUITPY_DISPLAYIO = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be added.
Displayio is enabled by default.
The compile should fail if the user tries to disable displayio, not ignore the settings and succeed.
Have succesfully running Circuitpython on this board.