mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
boards/esp32-olimex-evb: add SDMMC support
This commit is contained in:
parent
a376b3c915
commit
7ba9cbe736
@ -17,8 +17,11 @@ config BOARD_ESP32_OLIMEX_EVB
|
|||||||
select HAS_PERIPH_ADC if USEMODULE_OLIMEX_ESP32_GATEWAY
|
select HAS_PERIPH_ADC if USEMODULE_OLIMEX_ESP32_GATEWAY
|
||||||
select HAS_PERIPH_I2C
|
select HAS_PERIPH_I2C
|
||||||
select HAS_PERIPH_PWM
|
select HAS_PERIPH_PWM
|
||||||
|
select HAS_PERIPH_SDMMC
|
||||||
select HAS_PERIPH_SPI
|
select HAS_PERIPH_SPI
|
||||||
select HAS_PERIPH_CAN
|
select HAS_PERIPH_CAN
|
||||||
select HAS_PERIPH_IR
|
select HAS_PERIPH_IR
|
||||||
|
|
||||||
|
select HAVE_MTD_SDMMC_DEFAULT
|
||||||
|
|
||||||
source "$(RIOTBOARD)/common/esp32/Kconfig"
|
source "$(RIOTBOARD)/common/esp32/Kconfig"
|
||||||
|
@ -4,3 +4,13 @@ include $(RIOTBOARD)/common/esp32/Makefile.dep
|
|||||||
ifneq (,$(filter netdev_default,$(USEMODULE)))
|
ifneq (,$(filter netdev_default,$(USEMODULE)))
|
||||||
USEMODULE += esp_eth
|
USEMODULE += esp_eth
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# default to using fatfs on SD card
|
||||||
|
ifneq (,$(filter vfs_default,$(USEMODULE)))
|
||||||
|
USEMODULE += fatfs_vfs
|
||||||
|
USEMODULE += mtd
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(filter mtd,$(USEMODULE)))
|
||||||
|
USEMODULE += mtd_sdmmc_default
|
||||||
|
endif
|
||||||
|
@ -3,13 +3,20 @@ CPU_MODEL = esp32-wroom_32
|
|||||||
# common board and CPU features
|
# common board and CPU features
|
||||||
include $(RIOTBOARD)/common/esp32/Makefile.features
|
include $(RIOTBOARD)/common/esp32/Makefile.features
|
||||||
|
|
||||||
# additional features provided by the board (no ADC and no DAC)
|
|
||||||
ifneq (,$(filter olimex_esp32_gateway,$(USEMODULE)))
|
ifneq (,$(filter olimex_esp32_gateway,$(USEMODULE)))
|
||||||
|
# additional features provided by Olimex ESP32 Gateway
|
||||||
FEATURES_PROVIDED += periph_adc
|
FEATURES_PROVIDED += periph_adc
|
||||||
|
else
|
||||||
|
# SPI interface is not available on Olimex ESP32 Gateway
|
||||||
|
FEATURES_PROVIDED += periph_spi
|
||||||
endif
|
endif
|
||||||
|
|
||||||
FEATURES_PROVIDED += periph_i2c
|
FEATURES_PROVIDED += periph_i2c
|
||||||
FEATURES_PROVIDED += periph_pwm
|
FEATURES_PROVIDED += periph_pwm
|
||||||
FEATURES_PROVIDED += periph_spi
|
FEATURES_PROVIDED += periph_sdmmc
|
||||||
|
|
||||||
|
FEATURES_CONFLICT += periph_sdmmc:periph_spi
|
||||||
|
FEATURES_CONFLICT_MSG += "SD/MMC and SPI cannot be used at the same time on this board."
|
||||||
|
|
||||||
# unique features of the board
|
# unique features of the board
|
||||||
FEATURES_PROVIDED += esp_eth # Ethernet MAC (EMAC)
|
FEATURES_PROVIDED += esp_eth # Ethernet MAC (EMAC)
|
||||||
|
@ -92,15 +92,15 @@ overridden by \ref esp32_application_specific_configurations
|
|||||||
<center>
|
<center>
|
||||||
Pin | Configuration\n ESP32-EVB | Configuration\n ESP32-GATEWAY | Remarks / Prerequisites | Configuration
|
Pin | Configuration\n ESP32-EVB | Configuration\n ESP32-GATEWAY | Remarks / Prerequisites | Configuration
|
||||||
:------|:------------------|:-----------------|-|-|
|
:------|:------------------|:-----------------|-|-|
|
||||||
GPIO13 | I2C_DEV(0):SDA | SDCARD_CS | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_i2c_interfaces "I2C Interfaces"
|
GPIO13 | I2C_DEV(0):SDA | SDMMC_DEV(0):DAT3 | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_i2c_interfaces "I2C Interfaces", \ref esp32_sdmmc_interfaces "SDMMC Interfaces"
|
||||||
GPIO16 | I2C_DEV(0):SCL | I2C_DEV(0):SCL | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_i2c_interfaces "I2C Interfaces"
|
GPIO16 | I2C_DEV(0):SCL | I2C_DEV(0):SCL | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_i2c_interfaces "I2C Interfaces"
|
||||||
GPIO14 | SPI_DEV(0):CLK | SDCARD_CLK | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_spi_interfaces "SPI Interfaces"
|
GPIO14 | SPI_DEV(0):CLK, SDMMC_DEV(0):CLK | SDMMC_DEV(0):CLK | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_spi_interfaces "SPI Interfaces", \ref esp32_sdmmc_interfaces "SDMMC Interfaces"
|
||||||
GPIO2 | SPI_DEV(0):MISO | SDCARD_MISO | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_spi_interfaces "SPI Interfaces"
|
GPIO2 | SPI_DEV(0):MISO, SDMMC_DEV(0):DAT0 | SDMMC_DEV(0):DAT0 | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_spi_interfaces "SPI Interfaces", \ref esp32_sdmmc_interfaces "SDMMC Interfaces"
|
||||||
GPIO15 | SPI_DEV(0):MOSI | SDCARD_MOSI | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_spi_interfaces "SPI Interfaces"
|
GPIO15 | SPI_DEV(0):MOSI, SDMMC_DEV(0):CMD | SDMMC_DEV(0):CMD | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_spi_interfaces "SPI Interfaces", \ref esp32_sdmmc_interfaces "SDMMC Interfaces"
|
||||||
GPIO17 | SPI_DEV(0):CS0 | I2C_DEV(0):SDA | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_spi_interfaces "SPI Interfaces"
|
GPIO17 | SPI_DEV(0):CS0 | I2C_DEV(0):SDA | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_spi_interfaces "SPI Interfaces"
|
||||||
GPIO1 | UART_DEV(0):TxD | UART_DEV(0):TxD | Console (cannot be changed) | \ref esp32_uart_interfaces "UART interfaces"
|
GPIO1 | UART_DEV(0):TxD | UART_DEV(0):TxD | Console (cannot be changed) | \ref esp32_uart_interfaces "UART interfaces"
|
||||||
GPIO3 | UART_DEV(0):RxD | UART_DEV(0):RxD | Console (cannot be changed) | \ref esp32_uart_interfaces "UART interfaces"
|
GPIO3 | UART_DEV(0):RxD | UART_DEV(0):RxD | Console (cannot be changed) | \ref esp32_uart_interfaces "UART interfaces"
|
||||||
GPIO4 | UART_DEV(1):TxD | N/A | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_uart_interfaces "UART interfaces"
|
GPIO4 | UART_DEV(1):TxD | SDMMC_DEV(0):DAT1 | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_uart_interfaces "UART interfaces", \ref esp32_sdmmc_interfaces "SDMMC Interfaces"
|
||||||
GPIO36 | UART_DEV(1):RxD | ADC_LINE(2) | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_uart_interfaces "UART interfaces"
|
GPIO36 | UART_DEV(1):RxD | ADC_LINE(2) | on ESP32-EVB available at [UEXT1](https://www.olimex.com/Products/Modules/UEXT) | \ref esp32_uart_interfaces "UART interfaces"
|
||||||
GPIO32 | Relais 1 | ADC_LINE(0) | | \ref esp32_adc_channels "ADC Channels"
|
GPIO32 | Relais 1 | ADC_LINE(0) | | \ref esp32_adc_channels "ADC Channels"
|
||||||
GPIO33 | Relais 2 | LED0 | | |
|
GPIO33 | Relais 2 | LED0 | | |
|
||||||
@ -109,7 +109,7 @@ GPIO9 | PWM_DEV(0):0 | PWM_DEV(0):0 | | \ref esp32_pwm_channels "PWM C
|
|||||||
GPIO10 | PWM_DEV(0):1 | PWM_DEV(0):1 | | \ref esp32_pwm_channels "PWM Channels"
|
GPIO10 | PWM_DEV(0):1 | PWM_DEV(0):1 | | \ref esp32_pwm_channels "PWM Channels"
|
||||||
GPIO5 | CAN_DEV(0):TX | | | \ref esp32_can_interfaces "CAN Interfaces"
|
GPIO5 | CAN_DEV(0):TX | | | \ref esp32_can_interfaces "CAN Interfaces"
|
||||||
GPIO35 | CAN_DEV(0):RX | ADC_LINE(1) | | \ref esp32_adc_channels "ADC Channels"
|
GPIO35 | CAN_DEV(0):RX | ADC_LINE(1) | | \ref esp32_adc_channels "ADC Channels"
|
||||||
GPIO12 | IR_DEV(0):TX | N/A | IR is not yet supported | |
|
GPIO12 | IR_DEV(0):TX | SDMMC_DEV(0):DAT2 | IR is not yet supported | \ref esp32_sdmmc_interfaces "SDMMC Interfaces" |
|
||||||
GPIO39 | IR_DEV(0):RX | ADC_LINE(3) | IR is not yet supported | \ref esp32_adc_channels "ADC Channels"
|
GPIO39 | IR_DEV(0):RX | ADC_LINE(3) | IR is not yet supported | \ref esp32_adc_channels "ADC Channels"
|
||||||
GPIO18 | EMAC_SMI:MDIO | EMAC_SMI:MDIO | LAN interface | \ref esp32_ethernet_network_interface "Ethernet MAC"
|
GPIO18 | EMAC_SMI:MDIO | EMAC_SMI:MDIO | LAN interface | \ref esp32_ethernet_network_interface "Ethernet MAC"
|
||||||
GPIO23 | EMAC_SMI:MDC | EMAC_SMI:MDC | LAN interface | \ref esp32_ethernet_network_interface "Ethernet MAC"
|
GPIO23 | EMAC_SMI:MDC | EMAC_SMI:MDC | LAN interface | \ref esp32_ethernet_network_interface "Ethernet MAC"
|
||||||
|
@ -36,6 +36,8 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "periph_cpu.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -139,6 +141,29 @@ extern "C" {
|
|||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name SD/MMC host controller configuration
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** SDMMC devices */
|
||||||
|
static const sdmmc_conf_t sdmmc_config[] = {
|
||||||
|
{
|
||||||
|
.slot = SDMMC_SLOT_1,
|
||||||
|
.cd = GPIO_UNDEF,
|
||||||
|
.wp = GPIO_UNDEF,
|
||||||
|
#if MODULE_OLIMEX_ESP32_GATEWAY
|
||||||
|
.bus_width = 4,
|
||||||
|
#else
|
||||||
|
.bus_width = 1,
|
||||||
|
#endif
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Number of configured SDMMC devices */
|
||||||
|
#define SDMMC_CONFIG_NUMOF 1
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name SPI configuration
|
* @name SPI configuration
|
||||||
* @{
|
* @{
|
||||||
@ -147,12 +172,7 @@ extern "C" {
|
|||||||
* @brief HSPI is used as SPI_DEV(0)
|
* @brief HSPI is used as SPI_DEV(0)
|
||||||
*
|
*
|
||||||
* It is available at the [UEXT] connector on Olimex ESP32-EVB.
|
* It is available at the [UEXT] connector on Olimex ESP32-EVB.
|
||||||
*
|
* If the SD Card/MMC interface is used, the SPI interface is not available.
|
||||||
* Although the SD card interface of the Olimex ESP32-EVB is also available at
|
|
||||||
* the `SPI_DEV(0)` interface, it does not have a CS signal. Therefore,
|
|
||||||
* it cannot be used in SPI mode with the `sdcard_spi` module. Olimex
|
|
||||||
* ESP32-GATEWAY uses the integrated SD card interface with another GPIO for
|
|
||||||
* the CS signal.
|
|
||||||
*
|
*
|
||||||
* @note The GPIOs listed in the configuration are first initialized as SPI
|
* @note The GPIOs listed in the configuration are first initialized as SPI
|
||||||
* signals when the corresponding SPI interface is used for the first time
|
* signals when the corresponding SPI interface is used for the first time
|
||||||
@ -160,6 +180,8 @@ extern "C" {
|
|||||||
* function. That is, they are not allocated as SPI signals before and can
|
* function. That is, they are not allocated as SPI signals before and can
|
||||||
* be used for other purposes as long as the SPI interface is not used.
|
* be used for other purposes as long as the SPI interface is not used.
|
||||||
*/
|
*/
|
||||||
|
#if !MODULE_PERIPH_SDMMC && !MODULE_OLIMEX_ESP32_GATEWAY
|
||||||
|
|
||||||
#ifndef SPI0_CTRL
|
#ifndef SPI0_CTRL
|
||||||
#define SPI0_CTRL HSPI
|
#define SPI0_CTRL HSPI
|
||||||
#endif
|
#endif
|
||||||
@ -173,14 +195,11 @@ extern "C" {
|
|||||||
#ifndef SPI0_MOSI
|
#ifndef SPI0_MOSI
|
||||||
#define SPI0_MOSI GPIO15 /**< MOSI [UEXT] / SD Card interface] */
|
#define SPI0_MOSI GPIO15 /**< MOSI [UEXT] / SD Card interface] */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SPI0_CS0
|
#ifndef SPI0_CS0
|
||||||
#ifndef MODULE_OLIMEX_ESP32_GATEWAY
|
|
||||||
#define SPI0_CS0 GPIO17 /**< CS0 [UEXT] */
|
#define SPI0_CS0 GPIO17 /**< CS0 [UEXT] */
|
||||||
#else /* MODULE_OLIMEX_ESP32_GATEWAY */
|
#endif
|
||||||
#define SPI0_CS0 GPIO13 /**< CS0 SD Card interface */
|
|
||||||
#endif /* MODULE_OLIMEX_ESP32_GATEWAY */
|
#endif /* !MODULE_PERIPH_SDMMC && !MODULE_OLIMEX_ESP32_GATEWAY */
|
||||||
#endif /* SPI0_CS0 */
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
@ -201,12 +220,16 @@ extern "C" {
|
|||||||
#define UART0_TXD GPIO1 /**< direct I/O pin for UART_DEV(0), can't be changed */
|
#define UART0_TXD GPIO1 /**< direct I/O pin for UART_DEV(0), can't be changed */
|
||||||
#define UART0_RXD GPIO3 /**< direct I/O pin for UART_DEV(0), can't be changed */
|
#define UART0_RXD GPIO3 /**< direct I/O pin for UART_DEV(0), can't be changed */
|
||||||
|
|
||||||
|
#if !MODULE_OLIMEX_ESP32_GATEWAY
|
||||||
|
|
||||||
#ifndef UART1_TXD
|
#ifndef UART1_TXD
|
||||||
#define UART1_TXD GPIO4 /**< UART_DEV(1) TxD */
|
#define UART1_TXD GPIO4 /**< UART_DEV(1) TxD */
|
||||||
#endif
|
#endif
|
||||||
#ifndef UART1_RXD
|
#ifndef UART1_RXD
|
||||||
#define UART1_RXD GPIO36 /**< UART_DEV(1) RxD */
|
#define UART1_RXD GPIO36 /**< UART_DEV(1) RxD */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* !MODULE_OLIMEX_ESP32_GATEWAY */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
Reference in New Issue
Block a user