Setup ESP-IDF
ESP-IDF is an official Espressif SDK for ESP32 development. It contains latest features and provides full access to chip functionality and configuration. Almost any ESP32 framework (like ESP32 Arduino) is based on ESP-IDF, which provides required low-level drivers.
In combination, Totemmaker provides totem-bsp (Board Support Package) for RoboBoard development using ESP-IDF. It contains required drivers to control on board features (like motor drivers).
Step 1. Setup ESP-IDF
Visit Getting Started to setup ESP-IDF toolchain.
Manual setup (click to expand)
Clone esp-idf project:
mkdir ~/esp
cd ~/esp
git clone --recursive https://github.com/espressif/esp-idf.git
cd esp-idf
install.ps1
for PowerShell):./install.sh
export.ps1
for PowerShell):
./export.sh
idf.py build
Step 2. Create a project
- Create new ESP-IDF project or use command:
idf.py create-project roboboard_project
- Inside project create manifest file
main/idf_component.yml
or use command:
idf.py create-manifest
- Add
roboboard_x3
orroboboard_x4
as dependency:
## IDF Component Manager Manifest File
dependencies:
# Include roboboard_x3 component
roboboard_x3:
path: roboboard_x3
git: https://github.com/totemmaker/totem-bsp.git
## IDF Component Manager Manifest File
dependencies:
# Include roboboard_x4 component
roboboard_x4:
path: roboboard_x4
git: https://github.com/totemmaker/totem-bsp.git
RoboBoard X4
Update motor driver firmware to latest version. See driver update guide.
Step 3. Write firmware
Include totem-bsp.h
header and code into project main/roboboard_project.c
file:
#include "bsp/totem-bsp.h"
void app_main(void)
{
// Initialize board
bsp_board_init();
// Spin motor A at 100% power
bsp_dc_spin(BSP_PORT_A, 100);
// Spin servo A to 500us pulse
bsp_servo_spin(BSP_PORT_A, 500);
// RoboBoard X4 LED on
// bsp_board_set_led(1);
// bsp_rgb_color(BSP_PORT_ALL, 0xFF00FF00);
}
Step 4. Build project
Build project:
idf.py build
Flash to board:
idf.py flash monitor
Step 5. Using ESP-IDF
For more information read following topics:
Code documentation:
- RoboBoard X3
- roboboard_x3.h header file - RoboBoard X3 low-level API
- RoboBoard X3 imu.h - RoboBoard X3 accelerometer & gyroscope API
- RoboBoard X3 rgb.h - RoboBoard X3 RGB lights API
- RoboBoard X4
- roboboard_x4.h header file - RoboBoard X4 low-level API
- RoboBoard X4 imu.h - RoboBoard X4 accelerometer & gyroscope API
- ESP-IDF API Reference - ESP32 API Reference
- ESP-IDF API Guides - More details about ESP-IDF
Code examples:
- RoboBoard X3 - example of board feature control
- RoboBoard X4 - example of board feature control
Question
Visit Support page to find more information or help from our community.