esp32[c3|c6|h2]: Add I2C master support

This commit is contained in:
Eren Terzioglu 2024-06-20 16:21:06 +03:00 committed by Xiang Xiao
parent 63375bf9cd
commit dda55419f9
31 changed files with 2554 additions and 3 deletions

View File

@ -84,6 +84,14 @@ We can use the interrupt pin to send a signal when the interrupt fires::
The pin is configured as a rising edge interrupt, so after issuing the The pin is configured as a rising edge interrupt, so after issuing the
above command, connect it to 3.3V. above command, connect it to 3.3V.
i2c
---
This configuration can be used to scan and manipulate I2C devices.
You can scan for all I2C devices using the following command::
nsh> i2c dev 0x00 0x7f
nsh nsh
--- ---

View File

@ -165,7 +165,7 @@ CDC Console Yes Rev.3
DMA No DMA No
eFuse No eFuse No
GPIO Yes GPIO Yes
I2C No I2C Yes
LED_PWM Yes LED_PWM Yes
RNG No RNG No
RSA No RSA No

View File

@ -119,6 +119,14 @@ We can use the interrupt pin to send a signal when the interrupt fires::
The pin is configured as a rising edge interrupt, so after issuing the The pin is configured as a rising edge interrupt, so after issuing the
above command, connect it to 3.3V. above command, connect it to 3.3V.
i2c
---
This configuration can be used to scan and manipulate I2C devices.
You can scan for all I2C devices using the following command::
nsh> i2c dev 0x00 0x7f
nsh nsh
--- ---

View File

@ -119,6 +119,14 @@ We can use the interrupt pin to send a signal when the interrupt fires::
The pin is configured as a rising edge interrupt, so after issuing the The pin is configured as a rising edge interrupt, so after issuing the
above command, connect it to 3.3V. above command, connect it to 3.3V.
i2c
---
This configuration can be used to scan and manipulate I2C devices.
You can scan for all I2C devices using the following command::
nsh> i2c dev 0x00 0x7f
nsh nsh
--- ---

View File

@ -147,7 +147,7 @@ ECC No
eFuse No eFuse No
GPIO Yes GPIO Yes
HMAC No HMAC No
I2C No I2C Yes
I2S No I2S No
Int. Temp. No Int. Temp. No
LED No LED No

View File

@ -118,6 +118,14 @@ We can use the interrupt pin to send a signal when the interrupt fires::
The pin is configured as a rising edge interrupt, so after issuing the The pin is configured as a rising edge interrupt, so after issuing the
above command, connect it to 3.3V. above command, connect it to 3.3V.
i2c
---
This configuration can be used to scan and manipulate I2C devices.
You can scan for all I2C devices using the following command::
nsh> i2c dev 0x00 0x7f
nsh nsh
--- ---

View File

@ -147,7 +147,7 @@ ECC No
eFuse No eFuse No
GPIO Yes GPIO Yes
HMAC No HMAC No
I2C No I2C Yes
I2S No I2S No
Int. Temp. No Int. Temp. No
LED No LED No

View File

@ -11,16 +11,19 @@ choice ESPRESSIF_CHIP_SERIES
config ESPRESSIF_ESP32C3 config ESPRESSIF_ESP32C3
bool "ESP32-C3" bool "ESP32-C3"
select ARCH_HAVE_I2CRESET
---help--- ---help---
ESP32-C3 chip with a single RISC-V IMC core, no embedded Flash memory ESP32-C3 chip with a single RISC-V IMC core, no embedded Flash memory
config ESPRESSIF_ESP32C6 config ESPRESSIF_ESP32C6
bool "ESP32-C6" bool "ESP32-C6"
select ARCH_HAVE_I2CRESET
---help--- ---help---
Espressif ESP32-C6 (RV32IMAC). Espressif ESP32-C6 (RV32IMAC).
config ESPRESSIF_ESP32H2 config ESPRESSIF_ESP32H2
bool "ESP32-H2" bool "ESP32-H2"
select ARCH_HAVE_I2CRESET
---help--- ---help---
Espressif ESP32-H2 (RV32IMC). Espressif ESP32-H2 (RV32IMC).
@ -314,6 +317,23 @@ config ESPRESSIF_LEDC
select PWM select PWM
select ARCH_HAVE_PWM_MULTICHAN select ARCH_HAVE_PWM_MULTICHAN
config ESPRESSIF_I2C
bool
default n
config ESPRESSIF_I2C0
bool "I2C 0"
default n
select ESPRESSIF_I2C
select I2C
config ESPRESSIF_I2C1
bool "I2C 1"
default n
depends on ARCH_CHIP_ESP32H2
select ESPRESSIF_I2C
select I2C
config ESPRESSIF_SPI config ESPRESSIF_SPI
bool bool
default n default n
@ -1208,6 +1228,47 @@ endif # PWM_MULTICHAN && PWM_NCHANNELS > 1
endmenu # LEDC configuration endmenu # LEDC configuration
menu "I2C Configuration"
depends on ESPRESSIF_I2C
if ESPRESSIF_I2C0
config ESPRESSIF_I2C0_SCLPIN
int "I2C0 SCL Pin"
default 6
range 0 21
config ESPRESSIF_I2C0_SDAPIN
int "I2C0 SDA Pin"
default 5
range 0 21
endif # ESPRESSIF_I2C0
if ESPRESSIF_I2C1
config ESPRESSIF_I2C1_SCLPIN
int "I2C1 SCL Pin"
default 2
range 0 21
config ESPRESSIF_I2C1_SDAPIN
int "I2C1 SDA Pin"
default 1
range 0 21
endif # ESPRESSIF_I2C1
config ESPRESSIF_I2CTIMEOSEC
int "Timeout seconds"
default 0
config ESPRESSIF_I2CTIMEOMS
int "Timeout milliseconds"
default 500
endmenu # I2C configuration
menu "High Resolution Timer" menu "High Resolution Timer"
depends on ESPRESSIF_HR_TIMER depends on ESPRESSIF_HR_TIMER

View File

@ -84,6 +84,10 @@ ifeq ($(CONFIG_ESP_RMT),y)
endif endif
endif endif
ifeq ($(CONFIG_ESPRESSIF_I2C),y)
CHIP_CSRCS += esp_i2c.c
endif
ifeq ($(CONFIG_ESPRESSIF_SPI),y) ifeq ($(CONFIG_ESPRESSIF_SPI),y)
CHIP_CSRCS += esp_spi.c CHIP_CSRCS += esp_spi.c
ifeq ($(CONFIG_SPI_SLAVE),y) ifeq ($(CONFIG_SPI_SLAVE),y)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,91 @@
/****************************************************************************
* arch/risc-v/src/common/espressif/esp_i2c.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#ifndef __ARCH_RISCV_SRC_COMMON_ESPRESSIF_ESP_I2C_H
#define __ARCH_RISCV_SRC_COMMON_ESPRESSIF_ESP_I2C_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/i2c/i2c_master.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifndef __ASSEMBLY__
#ifdef CONFIG_ESPRESSIF_I2C0
# define ESPRESSIF_I2C0 0
#endif
#ifdef CONFIG_ESPRESSIF_I2C1
# define ESPRESSIF_I2C1 1
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: esp_i2cbus_initialize
*
* Description:
* Initialize the selected I2C port. And return a unique instance of struct
* struct i2c_master_s. This function may be called to obtain multiple
* instances of the interface, each of which may be set up with a
* different frequency and slave address.
*
* Input Parameters:
* port - Port number (for hardware that has multiple I2C interfaces)
*
* Returned Value:
* Valid I2C device structure reference on success; a NULL on failure
*
****************************************************************************/
struct i2c_master_s *esp_i2cbus_initialize(int port);
/****************************************************************************
* Name: esp_i2cbus_uninitialize
*
* Description:
* De-initialize the selected I2C port, and power down the device.
*
* Input Parameters:
* dev - Device structure as returned by the esp_i2cbus_initialize()
*
* Returned Value:
* OK on success, ERROR when internal reference count mismatch or dev
* points to invalid hardware device.
*
****************************************************************************/
int esp_i2cbus_uninitialize(struct i2c_master_s *dev);
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_RISCV_SRC_COMMON_ESPRESSIF_ESP_I2C_H */

View File

@ -125,6 +125,7 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)mpu_hal.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)mpu_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)mmu_hal.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)mmu_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)rmt_hal.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)rmt_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)i2c_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)spi_hal.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)spi_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)spi_hal_iram.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)spi_hal_iram.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)twai_hal.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)twai_hal.c
@ -144,6 +145,7 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)gpio_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)gpio_periph.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)ledc_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)ledc_periph.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)rmt_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)rmt_periph.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)i2c_periph.c
ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y) ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)bootloader_banner_wrap.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)bootloader_banner_wrap.c

View File

@ -125,6 +125,7 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)ledc_hal_iram.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)ledc_hal_iram.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)lp_timer_hal.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)lp_timer_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)rmt_hal.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)rmt_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)i2c_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)spi_hal.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)spi_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)spi_hal_iram.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)spi_hal_iram.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)timer_hal.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)timer_hal.c
@ -149,6 +150,7 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)gpio_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)gpio_periph.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)ledc_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)ledc_periph.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)rmt_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)rmt_periph.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)i2c_periph.c
ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y) ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)bootloader_banner_wrap.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)bootloader_banner_wrap.c

View File

@ -111,6 +111,7 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)ledc_hal_iram.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)ledc_hal_iram.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)lp_timer_hal.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)lp_timer_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)rmt_hal.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)rmt_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)i2c_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)spi_hal.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)spi_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)spi_hal_iram.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)spi_hal_iram.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)timer_hal.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)timer_hal.c
@ -132,6 +133,7 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)gpio_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)gpio_periph.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)ledc_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)ledc_periph.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)rmt_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)rmt_periph.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)i2c_periph.c
ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y) ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)bootloader_banner_wrap.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)bootloader_banner_wrap.c

View File

@ -0,0 +1,74 @@
/****************************************************************************
* boards/risc-v/esp32c3/common/include/esp_board_i2c.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP_BOARD_I2C_H
#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP_BOARD_I2C_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: board_i2c_init
*
* Description:
* Configure the I2C driver.
*
* Input Parameters:
* None.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned
* to indicate the nature of any failure.
*
****************************************************************************/
#ifdef CONFIG_I2C_DRIVER
int board_i2c_init(void);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP_BOARD_I2C_H */

View File

@ -40,6 +40,10 @@ ifeq ($(CONFIG_SPI_SLAVE_DRIVER),y)
CSRCS += esp_board_spislavedev.c CSRCS += esp_board_spislavedev.c
endif endif
ifeq ($(CONFIG_I2C_DRIVER),y)
CSRCS += esp_board_i2c.c
endif
ifeq ($(CONFIG_ESPRESSIF_SPIFLASH),y) ifeq ($(CONFIG_ESPRESSIF_SPIFLASH),y)
CSRCS += esp_board_spiflash.c CSRCS += esp_board_spiflash.c
endif endif

View File

@ -0,0 +1,82 @@
/****************************************************************************
* boards/risc-v/esp32c3/common/src/esp_board_i2c.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <errno.h>
#include <sys/types.h>
#include <nuttx/i2c/i2c_master.h>
#include "espressif/esp_i2c.h"
/****************************************************************************
* Public Functions
****************************************************************************/
static int i2c_driver_init(int bus)
{
struct i2c_master_s *i2c;
int ret;
i2c = esp_i2cbus_initialize(bus);
if (i2c == NULL)
{
i2cerr("Failed to get I2C%d interface\n", bus);
return -ENODEV;
}
ret = i2c_register(i2c, bus);
if (ret < 0)
{
i2cerr("Failed to register I2C%d driver: %d\n", bus, ret);
esp_i2cbus_uninitialize(i2c);
}
return ret;
}
/****************************************************************************
* Name: board_i2c_init
*
* Description:
* Configure the I2C driver.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned
* to indicate the nature of any failure.
*
****************************************************************************/
int board_i2c_init(void)
{
int ret = OK;
#ifdef CONFIG_ESPRESSIF_I2C0
ret = i2c_driver_init(ESPRESSIF_I2C0);
#endif
return ret;
}

View File

@ -0,0 +1,52 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="risc-v"
CONFIG_ARCH_BOARD="esp32c3-generic"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32C3_GENERIC=y
CONFIG_ARCH_CHIP="esp32c3"
CONFIG_ARCH_CHIP_ESP32C3_GENERIC=y
CONFIG_ARCH_INTERRUPTSTACK=1536
CONFIG_ARCH_RISCV=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_LOOPSPERMSEC=15000
CONFIG_BUILTIN=y
CONFIG_DEV_ZERO=y
CONFIG_ESPRESSIF_I2C0=y
CONFIG_FS_PROCFS=y
CONFIG_I2CTOOL_DEFFREQ=100000
CONFIG_I2CTOOL_MAXBUS=1
CONFIG_I2C_RESET=y
CONFIG_I2C_TRACE=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_NSH_STRERROR=y
CONFIG_PREALLOC_TIMERS=0
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_BACKTRACE=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=29
CONFIG_START_MONTH=11
CONFIG_START_YEAR=2019
CONFIG_SYSTEM_DUMPSTACK=y
CONFIG_SYSTEM_I2CTOOL=y
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART0_SERIAL_CONSOLE=y

View File

@ -36,6 +36,7 @@
#include "esp_board_ledc.h" #include "esp_board_ledc.h"
#include "esp_board_spiflash.h" #include "esp_board_spiflash.h"
#include "esp_board_i2c.h"
#ifdef CONFIG_WATCHDOG #ifdef CONFIG_WATCHDOG
# include "espressif/esp_wdt.h" # include "espressif/esp_wdt.h"
@ -257,6 +258,17 @@ int esp_bringup(void)
} }
#endif #endif
#if defined(CONFIG_I2C_DRIVER)
/* Configure I2C peripheral interfaces */
ret = board_i2c_init();
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize I2C driver: %d\n", ret);
}
#endif
#ifdef CONFIG_ESPRESSIF_TWAI #ifdef CONFIG_ESPRESSIF_TWAI
/* Initialize TWAI and register the TWAI driver. */ /* Initialize TWAI and register the TWAI driver. */

View File

@ -0,0 +1,74 @@
/****************************************************************************
* boards/risc-v/esp32c6/common/include/esp_board_i2c.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_RISCV_ESP32C6_COMMON_INCLUDE_ESP_BOARD_I2C_H
#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP_BOARD_I2C_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: board_i2c_init
*
* Description:
* Configure the I2C driver.
*
* Input Parameters:
* None.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned
* to indicate the nature of any failure.
*
****************************************************************************/
#ifdef CONFIG_I2C_DRIVER
int board_i2c_init(void);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_RISCV_ESP32C6_COMMON_INCLUDE_ESP_BOARD_I2C_H */

View File

@ -40,6 +40,10 @@ ifeq ($(CONFIG_SPI_SLAVE_DRIVER),y)
CSRCS += esp_board_spislavedev.c CSRCS += esp_board_spislavedev.c
endif endif
ifeq ($(CONFIG_I2C_DRIVER),y)
CSRCS += esp_board_i2c.c
endif
ifeq ($(CONFIG_ESPRESSIF_SPIFLASH),y) ifeq ($(CONFIG_ESPRESSIF_SPIFLASH),y)
CSRCS += esp_board_spiflash.c CSRCS += esp_board_spiflash.c
endif endif

View File

@ -0,0 +1,82 @@
/****************************************************************************
* boards/risc-v/esp32c6/common/src/esp_board_i2c.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <errno.h>
#include <sys/types.h>
#include <nuttx/i2c/i2c_master.h>
#include "espressif/esp_i2c.h"
/****************************************************************************
* Public Functions
****************************************************************************/
static int i2c_driver_init(int bus)
{
struct i2c_master_s *i2c;
int ret;
i2c = esp_i2cbus_initialize(bus);
if (i2c == NULL)
{
i2cerr("Failed to get I2C%d interface\n", bus);
return -ENODEV;
}
ret = i2c_register(i2c, bus);
if (ret < 0)
{
i2cerr("Failed to register I2C%d driver: %d\n", bus, ret);
esp_i2cbus_uninitialize(i2c);
}
return ret;
}
/****************************************************************************
* Name: board_i2c_init
*
* Description:
* Configure the I2C driver.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned
* to indicate the nature of any failure.
*
****************************************************************************/
int board_i2c_init(void)
{
int ret = OK;
#ifdef CONFIG_ESPRESSIF_I2C0
ret = i2c_driver_init(ESPRESSIF_I2C0);
#endif
return ret;
}

View File

@ -0,0 +1,54 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="risc-v"
CONFIG_ARCH_BOARD="esp32c6-devkitc"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32C6_DEVKITC=y
CONFIG_ARCH_CHIP="esp32c6"
CONFIG_ARCH_CHIP_ESP32C6=y
CONFIG_ARCH_CHIP_ESP32C6WROOM1=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_RISCV=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_LOOPSPERMSEC=15000
CONFIG_BUILTIN=y
CONFIG_DEV_ZERO=y
CONFIG_ESPRESSIF_ESP32C6=y
CONFIG_ESPRESSIF_I2C0=y
CONFIG_FS_PROCFS=y
CONFIG_I2CTOOL_DEFFREQ=100000
CONFIG_I2CTOOL_MAXBUS=1
CONFIG_I2C_RESET=y
CONFIG_I2C_TRACE=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_NSH_STRERROR=y
CONFIG_PREALLOC_TIMERS=0
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_BACKTRACE=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=29
CONFIG_START_MONTH=11
CONFIG_START_YEAR=2019
CONFIG_SYSTEM_DUMPSTACK=y
CONFIG_SYSTEM_I2CTOOL=y
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART0_SERIAL_CONSOLE=y

View File

@ -36,6 +36,7 @@
#include "esp_board_ledc.h" #include "esp_board_ledc.h"
#include "esp_board_spiflash.h" #include "esp_board_spiflash.h"
#include "esp_board_i2c.h"
#ifdef CONFIG_WATCHDOG #ifdef CONFIG_WATCHDOG
# include "espressif/esp_wdt.h" # include "espressif/esp_wdt.h"
@ -226,6 +227,17 @@ int esp_bringup(void)
} }
#endif #endif
#if defined(CONFIG_I2C_DRIVER)
/* Configure I2C peripheral interfaces */
ret = board_i2c_init();
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize I2C driver: %d\n", ret);
}
#endif
#ifdef CONFIG_ESPRESSIF_TWAI0 #ifdef CONFIG_ESPRESSIF_TWAI0
/* Initialize TWAI and register the TWAI driver. */ /* Initialize TWAI and register the TWAI driver. */

View File

@ -0,0 +1,54 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="risc-v"
CONFIG_ARCH_BOARD="esp32c6-devkitm"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32C6_DEVKITM=y
CONFIG_ARCH_CHIP="esp32c6"
CONFIG_ARCH_CHIP_ESP32C6=y
CONFIG_ARCH_CHIP_ESP32C6MINI1=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_RISCV=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_LOOPSPERMSEC=15000
CONFIG_BUILTIN=y
CONFIG_DEV_ZERO=y
CONFIG_ESPRESSIF_ESP32C6=y
CONFIG_ESPRESSIF_I2C0=y
CONFIG_FS_PROCFS=y
CONFIG_I2CTOOL_DEFFREQ=100000
CONFIG_I2CTOOL_MAXBUS=1
CONFIG_I2C_RESET=y
CONFIG_I2C_TRACE=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_NSH_STRERROR=y
CONFIG_PREALLOC_TIMERS=0
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_BACKTRACE=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=29
CONFIG_START_MONTH=11
CONFIG_START_YEAR=2019
CONFIG_SYSTEM_DUMPSTACK=y
CONFIG_SYSTEM_I2CTOOL=y
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART0_SERIAL_CONSOLE=y

View File

@ -36,6 +36,7 @@
#include "esp_board_ledc.h" #include "esp_board_ledc.h"
#include "esp_board_spiflash.h" #include "esp_board_spiflash.h"
#include "esp_board_i2c.h"
#ifdef CONFIG_WATCHDOG #ifdef CONFIG_WATCHDOG
# include "espressif/esp_wdt.h" # include "espressif/esp_wdt.h"
@ -226,6 +227,17 @@ int esp_bringup(void)
} }
#endif #endif
#if defined(CONFIG_I2C_DRIVER)
/* Configure I2C peripheral interfaces */
ret = board_i2c_init();
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize I2C driver: %d\n", ret);
}
#endif
#ifdef CONFIG_ESPRESSIF_TWAI0 #ifdef CONFIG_ESPRESSIF_TWAI0
/* Initialize TWAI and register the TWAI driver. */ /* Initialize TWAI and register the TWAI driver. */

View File

@ -0,0 +1,74 @@
/****************************************************************************
* boards/risc-v/esp32h2/common/include/esp_board_i2c.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_RISCV_ESP32H2_COMMON_INCLUDE_ESP_BOARD_I2C_H
#define __BOARDS_RISCV_ESP32H2_COMMON_INCLUDE_ESP_BOARD_I2C_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: board_i2c_init
*
* Description:
* Configure the I2C driver.
*
* Input Parameters:
* None.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned
* to indicate the nature of any failure.
*
****************************************************************************/
#ifdef CONFIG_I2C_DRIVER
int board_i2c_init(void);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_RISCV_ESP32H2_COMMON_INCLUDE_ESP_BOARD_I2C_H */

View File

@ -40,6 +40,10 @@ ifeq ($(CONFIG_SPI_SLAVE_DRIVER),y)
CSRCS += esp_board_spislavedev.c CSRCS += esp_board_spislavedev.c
endif endif
ifeq ($(CONFIG_I2C_DRIVER),y)
CSRCS += esp_board_i2c.c
endif
ifeq ($(CONFIG_ESPRESSIF_SPIFLASH),y) ifeq ($(CONFIG_ESPRESSIF_SPIFLASH),y)
CSRCS += esp_board_spiflash.c CSRCS += esp_board_spiflash.c
endif endif

View File

@ -0,0 +1,90 @@
/****************************************************************************
* boards/risc-v/esp32h2/common/src/esp_board_i2c.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <errno.h>
#include <sys/types.h>
#include <nuttx/i2c/i2c_master.h>
#include "espressif/esp_i2c.h"
/****************************************************************************
* Public Functions
****************************************************************************/
static int i2c_driver_init(int bus)
{
struct i2c_master_s *i2c;
int ret;
i2c = esp_i2cbus_initialize(bus);
if (i2c == NULL)
{
i2cerr("Failed to get I2C%d interface\n", bus);
return -ENODEV;
}
ret = i2c_register(i2c, bus);
if (ret < 0)
{
i2cerr("Failed to register I2C%d driver: %d\n", bus, ret);
esp_i2cbus_uninitialize(i2c);
}
return ret;
}
/****************************************************************************
* Name: board_i2c_init
*
* Description:
* Configure the I2C driver.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned
* to indicate the nature of any failure.
*
****************************************************************************/
int board_i2c_init(void)
{
int ret = OK;
#ifdef CONFIG_ESPRESSIF_I2C0
ret = i2c_driver_init(ESPRESSIF_I2C0);
if (ret != OK)
{
return ret;
}
#endif
#ifdef CONFIG_ESPRESSIF_I2C1
ret = i2c_driver_init(ESPRESSIF_I2C1);
#endif
return ret;
}

View File

@ -0,0 +1,54 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="risc-v"
CONFIG_ARCH_BOARD="esp32h2-devkit"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32H2_DEVKIT=y
CONFIG_ARCH_CHIP="esp32h2"
CONFIG_ARCH_CHIP_ESP32H2=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_RISCV=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_LOOPSPERMSEC=15000
CONFIG_BUILTIN=y
CONFIG_DEV_ZERO=y
CONFIG_ESPRESSIF_ESP32H2=y
CONFIG_ESPRESSIF_I2C0=y
CONFIG_ESPRESSIF_I2C1=y
CONFIG_FS_PROCFS=y
CONFIG_I2CTOOL_DEFFREQ=100000
CONFIG_I2CTOOL_MAXBUS=1
CONFIG_I2C_RESET=y
CONFIG_I2C_TRACE=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_NSH_STRERROR=y
CONFIG_PREALLOC_TIMERS=0
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_BACKTRACE=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=29
CONFIG_START_MONTH=11
CONFIG_START_YEAR=2019
CONFIG_SYSTEM_DUMPSTACK=y
CONFIG_SYSTEM_I2CTOOL=y
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART0_SERIAL_CONSOLE=y

View File

@ -36,6 +36,7 @@
#include "esp_board_ledc.h" #include "esp_board_ledc.h"
#include "esp_board_spiflash.h" #include "esp_board_spiflash.h"
#include "esp_board_i2c.h"
#ifdef CONFIG_WATCHDOG #ifdef CONFIG_WATCHDOG
# include "espressif/esp_wdt.h" # include "espressif/esp_wdt.h"
@ -218,6 +219,17 @@ int esp_bringup(void)
} }
#endif #endif
#if defined(CONFIG_I2C_DRIVER)
/* Configure I2C peripheral interfaces */
ret = board_i2c_init();
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize I2C driver: %d\n", ret);
}
#endif
#ifdef CONFIG_ESPRESSIF_TWAI #ifdef CONFIG_ESPRESSIF_TWAI
/* Initialize TWAI and register the TWAI driver. */ /* Initialize TWAI and register the TWAI driver. */