platformio / platform-espressif32

Espressif 32: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/espressif32
Apache License 2.0
938 stars 636 forks source link

Board request: ESP8684-DevKitM-1 #1151

Open Kuenlun opened 1 year ago

Kuenlun commented 1 year ago

Please, could someone add or help me add this board based on the ESP-C2? Or just give a quick fix so I (and many of us) can program this devkit.

https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp8684/esp8684-devkitm-1/user_guide.html

Thank you!

Jason2866 commented 1 year ago

To add the board is not the only needed change. See provided PR for supporting C6. The change for the C2 is similar.

Kuenlun commented 1 year ago

Great, I will wait patiently. I decided to create this Issue since there seems to be a lack of information regarding the ESP8684-DevKitM-1 board and the ESP-C2 microcontroller on the platform. Considering that the ESP-C2 is quite commonly used nowadays and was released earlier than the ESP-C6, it strikes me as odd that there is no board support available in Platformio.

Thank you so much!

Jason2866 commented 1 year ago

@Kuenlun Did the needed changes in Platformio and added the c2 board (esp32-c2-devkitm-1) The C2 board is only supported with IDF! There is no Arduino Support The fork is here https://github.com/Jason2866/platform-espressif32/tree/C2_IDF50

You can use with

platform = https://github.com/Jason2866/platform-espressif32.git#C2_IDF50

Since i dont have a C2, i cant test if it does work in real life. The CI C2 example "Blink" does compile successful

Kuenlun commented 1 year ago

Thank you very much, @Jason2866, for your contribution and especially for your promptness. I've tested it on an ESP8684-DevKitM-1 board and it's working properly. Just for those who are going to use this board, please remember that it has a quartz crystal operating at 26 MHz, not 40 MHz as most of Espressif's boards do, so you need to configure the corresponding option in menuconfig (https://github.com/espressif/esp-idf/issues/10782#issuecomment-1484390947). Also, to properly view the serial monitor, I had to set the baud rate to 74800. I'm leaving the "platformio.ini" file I'm using here for reference:

[platformio]
default_envs = ESP8684_Debug

[env]
platform = https://github.com/Jason2866/platform-espressif32.git#C2_IDF50
framework = espidf
board = esp32-c2-devkitm-1
monitor_speed = 74800
monitor_raw = yes
build_flags =
  -Wall
  -Wextra
  -Werror

[env:ESP8684_Debug]
build_type = debug
build_flags =
  -D configUSE_TRACE_FACILITY=1
  -D configGENERATE_RUN_TIME_STATS=1
  -D configUSE_STATS_FORMATTING_FUNCTIONS=1

[env:ESP8684_Release]
build_type = release

It's odd that when "env" is named "mydebug" in the "platformio.ini" file, it triggers an error:

[env:mydebug]
platform = https://github.com/Jason2866/platform-espressif32.git#C2_IDF50
framework = espidf
board = esp32-c2-devkitm-1
Building .pio\build\mydebug\firmware.bin
esptool.py v4.6.2
Creating esp32c2 image...
Merged 2 ELF sections

A fatal error occurred: Contents of segment at SHA256 digest offset 0xb0 are not all zero. Refusing to overwrite.
*** [.pio\build\mydebug\firmware.bin] Error 2
Jason2866 commented 1 year ago

@Kuenlun To avoid to forget to set the correct XTAL frequency, adding a sdkconfig.defaults file in the project folder is a safe way. This can be done MCU specific. See the example here

Jason2866 commented 1 year ago

With a hack from @stintel linking of IDF5.1 is now successfully. In this fork the C2 (and all other ESP32 MCUs) can be used with IDF5.1 and the alpha WiP Arduino 3.0 build based on IDF 5.1

platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5
Jason2866 commented 1 year ago

Solved with PR https://github.com/platformio/platform-espressif32/pull/1203

soufiane707 commented 7 months ago

Thank you very much, @Jason2866, for your contribution and especially for your promptness. I've tested it on an ESP8684-DevKitM-1 board and it's working properly. Just for those who are going to use this board, please remember that it has a quartz crystal operating at 26 MHz, not 40 MHz as most of Espressif's boards do, so you need to configure the corresponding option in menuconfig (espressif/esp-idf#10782 (comment)). Also, to properly view the serial monitor, I had to set the baud rate to 74800. I'm leaving the "platformio.ini" file I'm using here for reference:

[platformio]
default_envs = ESP8684_Debug

[env]
platform = https://github.com/Jason2866/platform-espressif32.git#C2_IDF50
framework = espidf
board = esp32-c2-devkitm-1
monitor_speed = 74800
monitor_raw = yes
build_flags =
  -Wall
  -Wextra
  -Werror

[env:ESP8684_Debug]
build_type = debug
build_flags =
  -D configUSE_TRACE_FACILITY=1
  -D configGENERATE_RUN_TIME_STATS=1
  -D configUSE_STATS_FORMATTING_FUNCTIONS=1

[env:ESP8684_Release]
build_type = release

It's odd that when "env" is named "mydebug" in the "platformio.ini" file, it triggers an error:

[env:mydebug]
platform = https://github.com/Jason2866/platform-espressif32.git#C2_IDF50
framework = espidf
board = esp32-c2-devkitm-1
Building .pio\build\mydebug\firmware.bin
esptool.py v4.6.2
Creating esp32c2 image...
Merged 2 ELF sections

A fatal error occurred: Contents of segment at SHA256 digest offset 0xb0 are not all zero. Refusing to overwrite.
*** [.pio\build\mydebug\firmware.bin] Error 2

hi please , were you able to use the arduino framework

Jason2866 commented 7 months ago

@soufiane707 My fork (not fully compatible to original!) does support the C2 with Arduino Can be used with

platform = https://github.com/Jason2866/platform-espressif32.git

Do NOT open an issue here when you encounter problems.