board_common.h File Reference

Board definitions that are common for all ESP32 boards. More...

Detailed Description

Board definitions that are common for all ESP32 boards.

This file contains board configurations that are valid for all ESP32.

For detailed information about the configuration of ESP32 boards, see section Common Peripherals.

Author
Gunar Schorcht gunar.nosp@m.@sch.nosp@m.orcht.nosp@m..net

Definition in file board_common.h.

#include <stdint.h>
#include "cpu.h"
#include "periph_conf.h"
#include "arduino_pinmap.h"
#include "periph/gpio.h"
#include "sdk_conf.h"
+ Include dependency graph for board_common.h:

Go to the source code of this file.

Functions

void board_init_common (void)
 Initialize the hardware that is common for all ESP32 boards. More...
 
void print_board_config (void)
 Print the board configuration in a human readable format.
 

External clock crystal frequency (MHz)

Most boards use a 40MHz crystal, including all those based on Espressif's WROOM-32 and WROVER-32 modules.

Those that don't, like the SparkFun ESP32 Thing (26MHz), must define ESP32_XTAL_FREQ appropriately in their board configuration.

An obvious side effect of a mismatch is that the UART won't sync and the development terminal will show garbage instead of log output.

#define ESP32_XTAL_FREQ   (40)
 

LED configuration (three predefined LEDs at maximum)

Note
LEDx_ACTIVE value must be declared in board configuration.
#define LED0_MASK   (BIT(LED0_PIN))
 
#define LED0_ON   (gpio_write(LED0_PIN, LED0_ACTIVE))
 
#define LED0_OFF   (gpio_write(LED0_PIN, !LED0_ACTIVE))
 
#define LED0_TOGGLE   (gpio_toggle(LED0_PIN))
 
#define LED1_MASK   (BIT(LED1_PIN))
 
#define LED1_ON   (gpio_write(LED1_PIN, LED1_ACTIVE))
 
#define LED1_OFF   (gpio_write(LED1_PIN, !LED1_ACTIVE))
 
#define LED1_TOGGLE   (gpio_toggle(LED1_PIN))
 
#define LED2_MASK   (BIT(LED2_PIN))
 
#define LED2_ON   (gpio_write(LED2_PIN, LED2_ACTIVE))
 
#define LED2_OFF   (gpio_write(LED2_PIN, !LED2_ACTIVE))
 
#define LED2_TOGGLE   (gpio_toggle(LED2_PIN))
 

STDIO configuration

#define STDIO_UART_BAUDRATE   (115200)
 < Default baudrate of UART for stdio
 

MTD system drive configuration

Built-in SPI flash memory is used as MTD system drive.

#define SPI_FLASH_DRIVE_START   0
 MTD drive start address in SPI flash memory. More...
 
#define MTD_0   mtd0
 Default MTD drive definition.
 
mtd_dev_tmtd0
 Pointer to the default MTD drive structure.
 

SPIFFS configuration for the system MTD device

Configuration of the SPIFFS that can be used on the system MTD device.

#define SPIFFS_ALIGNED_OBJECT_INDEX_TABLES   1
 
#define SPIFFS_READ_ONLY   0
 
#define SPIFFS_SINGLETON   0
 
#define SPIFFS_HAL_CALLBACK_EXTRA   1
 
#define SPIFFS_CACHE   1
 

Macro Definition Documentation

◆ SPI_FLASH_DRIVE_START

#define SPI_FLASH_DRIVE_START   0

MTD drive start address in SPI flash memory.

Defines the start address of the MTD system device in the SPI flash memory. It can be overridden by application-specific board configuration

If the MTD start address is not defined or is 0, the first possible multiple of 0x100000 (1 MByte) is used in free SPI flash memory, which was determined from the partition table.

Definition at line 123 of file board_common.h.

Function Documentation

◆ board_init_common()

void board_init_common ( void  )

Initialize the hardware that is common for all ESP32 boards.

This function has to be called from the board specific board_init function.