Espressif: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Brian Wilson (talk | contribs)
 
(5 intermediate revisions by the same user not shown)
Line 51: Line 51:
=== VSCode + PlatformIO + Arduino framework ===
=== VSCode + PlatformIO + Arduino framework ===


When creating a project with PlatformIO you can pick Arduino as the Framework if you don't need the ESP-IDF platform.
When creating a project with PlatformIO you can pick Arduino as the Framework if you don't need the ESP-IDF platform.  
I put all my source code in ''~/source/platformio/''.


I cloned the M5Stack repo https://github.com/m5stack/M5Stack.git
'''<big>I put all my source code in ''~/source/platformio/''.</big>'''
The Examples/ are great.


I just built and uploaded a Blink program and it worked flawlessly on the first try.
I cloned the M5Stack repo https://github.com/m5stack/M5Stack.git The Examples/ are great. I just built and uploaded a Blink program and it worked flawlessly on the first try. In the blue bar there are build and upload tools.There is a "serial monitor" tool in the blue bar too; output goes to a Terminal window.
In the blue bar there are build and upload tools.
There is a "serial monitor" tool in the blue bar too. Output goes to a Terminal window.


So far I find this experience much better than using Arduino IDE, perhaps because I already use VS Code,
So far I find this experience much better than using Arduino IDE, perhaps because I already use VS Code, also partly because the project is organized more the way I'd want. I like having one window for everything, I've never liked how Arduino opens a new window for each "sketch". Also I never liked the word "sketch", lol.
also partly because the project is organized more the way I'd want. I like having one window for everything, I've never liked how Arduino opens a new window for each "sketch". Also I never liked the word "sketch", lol.


=== VSCode + PlatformIO + ESP-IDF framework ===
=== VSCode + PlatformIO + ESP-IDF framework ===
Line 74: Line 69:


PlatformIO has its own library manager and when you add a library, the library is downloaded and referenced in the platformio.ini in the current project.
PlatformIO has its own library manager and when you add a library, the library is downloaded and referenced in the platformio.ini in the current project.
So how do I do that?


== Projects ==
== Projects ==
Line 83: Line 76:
Called the "red box" because it's in a Hammond box that's translucent red.
Called the "red box" because it's in a Hammond box that's translucent red.


This project is VSCODE+PlatformIO
===== hello_world =====
This project is set to use VSCODE and esp-idf


I had to finagle the esp-idf extension's [https://docs.espressif.com/projects/vscode-esp-idf-extension/en/latest/settings.html settings] get the serial port selected. I changed the user profile setting '''idf.portWin''' on Pearl to be "COM6". This fixed both the programmer and the serial monitor.
I built and programmed the device with the icons in the bottom bar.
Output in the serial monitor looks like this. It counts to zero then reboots.
Hello world!
This is esp32 chip with 2 CPU core(s), WiFi/BT/BLE, silicon revision v3.0, 2MB external flash
Minimum free heap size: 300868 bytes
Restarting in 10 seconds...
Restarting in 9 seconds...
Restarting in 8 seconds...
Restarting in 7 seconds...
Okay, now convinced that I can program the board over the UART USB connection I can move on to a real program.
Note please, the '''ESP32-WROVER-IE''' has its own built in [https://docs.platformio.org/en/latest/boards/espressif32/esp-wrover-kit.html#debugging debugger] so no need for a separate ESP-PROG or other hardware.
===== blinky =====
Baby steps, just blink the red led. VSCODE + PlatformIO + Arduino
I disabled the ESP-IDF extension so its menu bar buttons disappeared. With PlaformIO the "check mark" icon is the build tool.
I added a target for esp32 and it won't build. The ones for esp8266 devices d1_mini and esp12e build fine.
Build output goes into .pio/build and there's a folder there for each target, esp32, d1_mini, and esp12e.
===== esp_motion =====
Source location, on Pearl at ~/Documents/source/platformio/esp_motion and it's in github here: brian32768/esp_motion.git
Source location, on Pearl at ~/Documents/source/platformio/esp_motion and it's in github here: brian32768/esp_motion.git


The current version right here in front of me currently has  
The project is VSCODE+PlatformIO+Arduino
 
When I opened the project in VSCode it figured out that it was platformio based and the bottom bar icons changed to show PlatformIO tools.
 
I really want to scrap the Arduino part of this. I wonder how hard that is. I am using some libraries, though. Sigh. Okay.
 
Also wonder why it complains about missing its gradle server. I disabled the gradle extension so it would stop. I don't use Java for anything.
 
Obviously this project used to build, it was running on the board when I powered it up. The program was wiped when I ran "hello_world" so I can't prove it. :-)
 
The current version right here in front of me currently has


* Espressif Wrover dev kit board
* Espressif Wrover dev kit board
Line 96: Line 128:
* I used to have a radar sensor on there too. Not sure why I removed it.
* I used to have a radar sensor on there too. Not sure why I removed it.
* I see a TO-92 on there. I think it's a Dallas 18B20 temperature sensor.
* I see a TO-92 on there. I think it's a Dallas 18B20 temperature sensor.
* IR receiver so that I can make this board read IR remote codes for a light fixture we got a few weeks ago,
* IR receiver so that I can make this board read IR remote codes for a light fixture we got a few weeks ago.
The build is failing to find "Arduino.h" and "Wifi.h" hmmm where'd it go?


== JTAG debugging ==
== JTAG debugging ==
Line 108: Line 141:
== Books and resources ==
== Books and resources ==


[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/modules-and-boards.html Espressif modules and boards]
Hardware: [https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/modules-and-boards.html Espressif modules and boards]
 
[https://learning.oreilly.com/library/view/developing-iot-projects/9781803237688/Text/Title_Pages.xhtml Developing IoT Projects with ESP32], Second Edition, by Vedat Ozan Oner "Unlock the full Potential of ESP32 in IoT development to create production-grade smart devices" PlatformIO + FreeRTOS The first edition is also still relevant. First edition covers Bluetooth (chapter 8). Second covers ML.


[https://leanpub.com/kolban-ESP32 Neil Kolban]
[https://leanpub.com/kolban-ESP32 Neil Kolban]


Random Nerd
Random Nerd Tutorials


[[Category: Espressif]]
[[Category: Espressif]]
[[Category: Embedded]]
[[Category: Embedded]]

Latest revision as of 16:06, 13 November 2024

See also ESP8266 and ESP-C3.

Hardware

ESP-C3-12F - These are in the old ESP12F form factor but have a RISC-V processor. I will put them in a page on the C3, here ESP-C3.

ESP12F and programmer, see docs at Amazon

Wemos D1 R1 - ESP8266 board in Arduino form factor. Purchased from MPJA for about $13, available on eBay for $7.

Espressif WROVER-DEVKITC-VIE boards (2) from Digikey ($11). Great except they are too wide to use on a breadboard. This device has 520KB RAM + 4MB Flash + 8MB PSRAM making it a good choice for Micropython.

I have a some Home control stuff deployed around my house that's based on ESP8266 chips including FEIT dimmers and Martin Jerry switches. I intend to reflash them all soon to get them off the IoT and onto the local network. There are more details on the ESP8266 page.

ESP-PROG / JTAG board. https://www.digikey.com/en/products/detail/espressif-systems/ESP-PROG/10259352 Flash download tools: https://www.espressif.com/en/support/download/other-tools There is no install step, you just run it.

M5 hardware

520 kB RAM, 4MB flash; really not enough RAM to mess around with Micropython.

M5 Atom Matrix grey with 5x5 Neopixel LED matrix and a 6-axis IMU

M5 Atom Echo white, with a speaker and microphone. It also has a Neopixel.

M5StickC

Toolchains

Right now it's a blob in my mind so I am here writing this to sort it out. I got some nRF52840's and that's just added to the confusion.

Arduino, Espressif IDF, FreeRTOS Visual Studio Code, PlatformIO

I have been using Arduino but I really want to try out working with RTOS and I want to use VSCode as my IDE, I am getting comfortable with it at work.

There is a tutorial here: https://randomnerdtutorials.com/vs-code-platformio-ide-esp32-esp8266-arduino/

  • Visual Studio Code (VSCode) is an IDE. It is far more useful than Arduino's IDE.
  • PlatformIO is an extension for VSCode.
  • There is also an Espressif IDF extension.
  • PlatformIO adds the "alien" icon in the left bar.
  • ESP-IDF adds a bunch of tools to the blue bar at the bottom.

VSCode + PlatformIO + Arduino framework

When creating a project with PlatformIO you can pick Arduino as the Framework if you don't need the ESP-IDF platform.

I put all my source code in ~/source/platformio/.

I cloned the M5Stack repo https://github.com/m5stack/M5Stack.git The Examples/ are great. I just built and uploaded a Blink program and it worked flawlessly on the first try. In the blue bar there are build and upload tools.There is a "serial monitor" tool in the blue bar too; output goes to a Terminal window.

So far I find this experience much better than using Arduino IDE, perhaps because I already use VS Code, also partly because the project is organized more the way I'd want. I like having one window for everything, I've never liked how Arduino opens a new window for each "sketch". Also I never liked the word "sketch", lol.

VSCode + PlatformIO + ESP-IDF framework

I followed this tutorial. https://docs.platformio.org/en/latest/tutorials/espressif32/espidf_debugging_unit_testing_analysis.html#

It worked fine, I tested it on an M5 Atom Matrix. I got a soft AP running.

2024-03-30 I am stumbling through the Stamp-C3 demo.

Libraries

PlatformIO has its own library manager and when you add a library, the library is downloaded and referenced in the platformio.ini in the current project.

Projects

I have done so many that they are scattered hither and thither. Herein I am trying to pull them together. Starting with this one.

ESP32 Red Box

Called the "red box" because it's in a Hammond box that's translucent red.

hello_world

This project is set to use VSCODE and esp-idf

I had to finagle the esp-idf extension's settings get the serial port selected. I changed the user profile setting idf.portWin on Pearl to be "COM6". This fixed both the programmer and the serial monitor.

I built and programmed the device with the icons in the bottom bar.

Output in the serial monitor looks like this. It counts to zero then reboots.

Hello world!
This is esp32 chip with 2 CPU core(s), WiFi/BT/BLE, silicon revision v3.0, 2MB external flash
Minimum free heap size: 300868 bytes
Restarting in 10 seconds...
Restarting in 9 seconds...
Restarting in 8 seconds...
Restarting in 7 seconds...

Okay, now convinced that I can program the board over the UART USB connection I can move on to a real program.


Note please, the ESP32-WROVER-IE has its own built in debugger so no need for a separate ESP-PROG or other hardware.

blinky

Baby steps, just blink the red led. VSCODE + PlatformIO + Arduino

I disabled the ESP-IDF extension so its menu bar buttons disappeared. With PlaformIO the "check mark" icon is the build tool.

I added a target for esp32 and it won't build. The ones for esp8266 devices d1_mini and esp12e build fine.

Build output goes into .pio/build and there's a folder there for each target, esp32, d1_mini, and esp12e.

esp_motion

Source location, on Pearl at ~/Documents/source/platformio/esp_motion and it's in github here: brian32768/esp_motion.git

The project is VSCODE+PlatformIO+Arduino

When I opened the project in VSCode it figured out that it was platformio based and the bottom bar icons changed to show PlatformIO tools.

I really want to scrap the Arduino part of this. I wonder how hard that is. I am using some libraries, though. Sigh. Okay.

Also wonder why it complains about missing its gradle server. I disabled the gradle extension so it would stop. I don't use Java for anything.

Obviously this project used to build, it was running on the board when I powered it up. The program was wiped when I ran "hello_world" so I can't prove it. :-)

The current version right here in front of me currently has

  • Espressif Wrover dev kit board
  • External WiFi antenna
  • PIR motion sensor
  • Piezo buzzer
  • Neopixel
  • I used to have a radar sensor on there too. Not sure why I removed it.
  • I see a TO-92 on there. I think it's a Dallas 18B20 temperature sensor.
  • IR receiver so that I can make this board read IR remote codes for a light fixture we got a few weeks ago.

The build is failing to find "Arduino.h" and "Wifi.h" hmmm where'd it go?

JTAG debugging

Example of JTAG debugging

JTAG debugging

https://mcuoneclipse.com/2019/10/20/jtag-debugging-the-esp32-with-ft2232-and-openocd/

Books and resources

Hardware: Espressif modules and boards

Developing IoT Projects with ESP32, Second Edition, by Vedat Ozan Oner "Unlock the full Potential of ESP32 in IoT development to create production-grade smart devices" PlatformIO + FreeRTOS The first edition is also still relevant. First edition covers Bluetooth (chapter 8). Second covers ML.

Neil Kolban

Random Nerd Tutorials