mirror of
https://github.com/apache/nuttx.git
synced 2026-05-24 07:46:16 +08:00
esp32[c3|h2|c6]: Add support to TWAI/CANBus controller
This commit is contained in:
committed by
Xiang Xiao
parent
7e30d38558
commit
891d67bb5e
@@ -175,6 +175,25 @@ To test it, just run the following::
|
||||
|
||||
Where x in the timer instance.
|
||||
|
||||
twai
|
||||
----
|
||||
|
||||
This configuration enables the support for the TWAI (Two-Wire Automotive Interface) driver.
|
||||
You can test it by connecting TWAI RX and TWAI TX pins which are GPIO0 and GPIO2 by default
|
||||
to an external transceiver or connecting TWAI RX to TWAI TX pin by enabling
|
||||
the `CONFIG_CAN_LOOPBACK` option (``Device Drivers -> CAN Driver Support -> CAN loopback mode``)
|
||||
and running the ``can`` example::
|
||||
|
||||
nsh> can
|
||||
nmsgs: 0
|
||||
min ID: 1 max ID: 2047
|
||||
Bit timing:
|
||||
Baud: 1000000
|
||||
TSEG1: 15
|
||||
TSEG2: 4
|
||||
SJW: 3
|
||||
ID: 1 DLC: 1
|
||||
|
||||
usbconsole
|
||||
----------
|
||||
|
||||
|
||||
@@ -148,6 +148,7 @@ Peripheral Support NOTES
|
||||
ADC No
|
||||
AES No
|
||||
Bluetooth No
|
||||
CAN/TWAI Yes
|
||||
CDC Console Yes Rev.3
|
||||
DMA No
|
||||
eFuse No
|
||||
|
||||
@@ -210,6 +210,25 @@ To test it, just run the following::
|
||||
|
||||
Where x in the timer instance.
|
||||
|
||||
twai
|
||||
----
|
||||
|
||||
This configuration enables the support for the TWAI (Two-Wire Automotive Interface) driver.
|
||||
You can test it by connecting TWAI RX and TWAI TX pins which are GPIO0 and GPIO2 by default
|
||||
to an external transceiver or connecting TWAI RX to TWAI TX pin by enabling
|
||||
the `CONFIG_CAN_LOOPBACK` option (``Device Drivers -> CAN Driver Support -> CAN loopback mode``)
|
||||
and running the ``can`` example::
|
||||
|
||||
nsh> can
|
||||
nmsgs: 0
|
||||
min ID: 1 max ID: 2047
|
||||
Bit timing:
|
||||
Baud: 1000000
|
||||
TSEG1: 15
|
||||
TSEG2: 4
|
||||
SJW: 3
|
||||
ID: 1 DLC: 1
|
||||
|
||||
usbconsole
|
||||
----------
|
||||
|
||||
|
||||
@@ -210,6 +210,25 @@ To test it, just run the following::
|
||||
|
||||
Where x in the timer instance.
|
||||
|
||||
twai
|
||||
----
|
||||
|
||||
This configuration enables the support for the TWAI (Two-Wire Automotive Interface) driver.
|
||||
You can test it by connecting TWAI RX and TWAI TX pins which are GPIO0 and GPIO2 by default
|
||||
to an external transceiver or connecting TWAI RX to TWAI TX pin by enabling
|
||||
the `CONFIG_CAN_LOOPBACK` option (``Device Drivers -> CAN Driver Support -> CAN loopback mode``)
|
||||
and running the ``can`` example::
|
||||
|
||||
nsh> can
|
||||
nmsgs: 0
|
||||
min ID: 1 max ID: 2047
|
||||
Bit timing:
|
||||
Baud: 1000000
|
||||
TSEG1: 15
|
||||
TSEG2: 4
|
||||
SJW: 3
|
||||
ID: 1 DLC: 1
|
||||
|
||||
usbconsole
|
||||
----------
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ Peripheral Support
|
||||
ADC No
|
||||
AES No
|
||||
Bluetooth No
|
||||
CAN/TWAI No
|
||||
CAN/TWAI Yes
|
||||
DMA No
|
||||
ECC No
|
||||
eFuse No
|
||||
|
||||
@@ -209,6 +209,25 @@ To test it, just run the following::
|
||||
|
||||
Where x in the timer instance.
|
||||
|
||||
twai
|
||||
----
|
||||
|
||||
This configuration enables the support for the TWAI (Two-Wire Automotive Interface) driver.
|
||||
You can test it by connecting TWAI RX and TWAI TX pins which are GPIO0 and GPIO2 by default
|
||||
to an external transceiver or connecting TWAI RX to TWAI TX pin by enabling
|
||||
the `CONFIG_CAN_LOOPBACK` option (``Device Drivers -> CAN Driver Support -> CAN loopback mode``)
|
||||
and running the ``can`` example::
|
||||
|
||||
nsh> can
|
||||
nmsgs: 0
|
||||
min ID: 1 max ID: 2047
|
||||
Bit timing:
|
||||
Baud: 1000000
|
||||
TSEG1: 15
|
||||
TSEG2: 4
|
||||
SJW: 3
|
||||
ID: 1 DLC: 1
|
||||
|
||||
usbconsole
|
||||
----------
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ Peripheral Support
|
||||
ADC No
|
||||
AES No
|
||||
Bluetooth No
|
||||
CAN/TWAI No
|
||||
CAN/TWAI Yes
|
||||
DMA No
|
||||
ECC No
|
||||
eFuse No
|
||||
|
||||
@@ -269,6 +269,27 @@ config ESPRESSIF_UART1
|
||||
select UART1_SERIALDRIVER
|
||||
select ARCH_HAVE_SERIAL_TERMIOS
|
||||
|
||||
config ESPRESSIF_TWAI
|
||||
bool "TWAI (CAN)"
|
||||
default n
|
||||
select ARCH_HAVE_CAN_ERRORS
|
||||
select CAN
|
||||
|
||||
config ESPRESSIF_TWAI0
|
||||
bool "TWAI0 (CAN)"
|
||||
default n
|
||||
select ESPRESSIF_TWAI
|
||||
select ARCH_HAVE_CAN_ERRORS
|
||||
select CAN
|
||||
|
||||
config ESPRESSIF_TWAI1
|
||||
bool "TWAI1 (CAN)"
|
||||
default n
|
||||
depends on ESPRESSIF_ESP32C6
|
||||
select ESPRESSIF_TWAI
|
||||
select ARCH_HAVE_CAN_ERRORS
|
||||
select CAN
|
||||
|
||||
config ESPRESSIF_USBSERIAL
|
||||
bool "USB-Serial-JTAG Driver"
|
||||
default n
|
||||
@@ -395,6 +416,104 @@ endif # ESPRESSIF_UART1
|
||||
|
||||
endmenu # UART Configuration
|
||||
|
||||
menu "TWAI driver options"
|
||||
depends on ESPRESSIF_TWAI
|
||||
|
||||
if ESPRESSIF_TWAI0
|
||||
|
||||
config ESPRESSIF_TWAI0_TXPIN
|
||||
int "TWAI0 TX Pin"
|
||||
default 2
|
||||
|
||||
config ESPRESSIF_TWAI0_RXPIN
|
||||
int "TWAI0 RX Pin"
|
||||
default 3
|
||||
|
||||
choice ESPRESSIF_TWAI0_TIMING
|
||||
prompt "TWAI0 Timing config"
|
||||
default TWAI0_TIMING_100KBITS
|
||||
---help---
|
||||
These options control timing of TWAI0.
|
||||
|
||||
config TWAI0_TIMING_100KBITS
|
||||
bool "100 KBits"
|
||||
|
||||
config TWAI0_TIMING_125KBITS
|
||||
bool "125 KBits"
|
||||
|
||||
config TWAI0_TIMING_250KBITS
|
||||
bool "250 KBits"
|
||||
|
||||
config TWAI0_TIMING_500KBITS
|
||||
bool "500 KBits"
|
||||
|
||||
config TWAI0_TIMING_800KBITS
|
||||
bool "800 KBits"
|
||||
|
||||
endchoice # ESPRESSIF_TWAI0_TIMING
|
||||
|
||||
config ESPRESSIF_TWAI0_SAM
|
||||
bool "TWAI0 sampling"
|
||||
default n
|
||||
---help---
|
||||
The bus is sampled 3 times (recommended for low to medium speed buses
|
||||
to spikes on the bus-line).
|
||||
|
||||
endif # ESPRESSIF_TWAI0
|
||||
|
||||
if ESPRESSIF_TWAI1
|
||||
|
||||
config ESPRESSIF_TWAI1_TXPIN
|
||||
int "TWAI1 TX Pin"
|
||||
default 4
|
||||
|
||||
config ESPRESSIF_TWAI1_RXPIN
|
||||
int "TWAI1 RX Pin"
|
||||
default 5
|
||||
|
||||
choice ESPRESSIF_TWAI1_TIMING
|
||||
prompt "TWAI1 Timing config"
|
||||
default TWAI1_TIMING_100KBITS
|
||||
---help---
|
||||
These options control timing of TWAI1.
|
||||
|
||||
config TWAI1_TIMING_100KBITS
|
||||
bool "100 KBits"
|
||||
|
||||
config TWAI1_TIMING_125KBITS
|
||||
bool "125 KBits"
|
||||
|
||||
config TWAI1_TIMING_250KBITS
|
||||
bool "250 KBits"
|
||||
|
||||
config TWAI1_TIMING_500KBITS
|
||||
bool "500 KBits"
|
||||
|
||||
config TWAI1_TIMING_800KBITS
|
||||
bool "800 KBits"
|
||||
|
||||
endchoice # ESPRESSIF_TWAI1_TIMING
|
||||
|
||||
config ESPRESSIF_TWAI1_SAM
|
||||
bool "TWAI1 sampling"
|
||||
default n
|
||||
---help---
|
||||
The bus is sampled 3 times (recommended for low to medium speed buses
|
||||
to spikes on the bus-line).
|
||||
|
||||
endif # ESPRESSIF_TWAI1
|
||||
|
||||
config ESPRESSIF_TWAI_TEST_MODE
|
||||
bool "TWAI character driver loopback test mode (for testing only)"
|
||||
default n
|
||||
depends on CAN_LOOPBACK
|
||||
---help---
|
||||
This enables a loopback test mode that attaches the transmitter
|
||||
to the receiver internally, being able to test the TWAI
|
||||
peripheral without any external connection.
|
||||
|
||||
endmenu #ESPRESSIF_TWAI
|
||||
|
||||
menu "SPI Flash Configuration"
|
||||
|
||||
choice ESPRESSIF_FLASH_MODE
|
||||
|
||||
@@ -65,6 +65,10 @@ ifeq ($(CONFIG_ESPRESSIF_HR_TIMER),y)
|
||||
CHIP_CSRCS += esp_hr_timer.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESPRESSIF_TWAI),y)
|
||||
CHIP_CSRCS += esp_twai.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESPRESSIF_LEDC),y)
|
||||
CHIP_CSRCS += esp_ledc.c
|
||||
endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,76 @@
|
||||
/****************************************************************************
|
||||
* arch/risc-v/src/common/espressif/esp_twai.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 __ARCH_RISCV_SRC_COMMON_ESPRESSIF_ESP_TWAI_H
|
||||
#define __ARCH_RISCV_SRC_COMMON_ESPRESSIF_ESP_TWAI_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/can/can.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_twaiinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize CAN port
|
||||
*
|
||||
* Input Parameters:
|
||||
* port - Port number (for hardware that has multiple TWAI interfaces)
|
||||
*
|
||||
* Returned Value:
|
||||
* Valid TWAI device structure reference on success; a NULL on failure
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_CAN) && defined(CONFIG_ESPRESSIF_TWAI)
|
||||
struct can_dev_s *esp_twaiinitialize(int port);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* __ARCH_RISCV_SRC_COMMON_ESPRESSIF_ESP_TWAI_H */
|
||||
@@ -51,6 +51,7 @@ INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/compone
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/components/soc/$(CHIP_SERIES)/include
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/components/spi_flash/include
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/components/spi_flash/include/spi_flash
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/components/driver/twai/include
|
||||
|
||||
ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/components/bootloader_support/include
|
||||
@@ -146,6 +147,8 @@ ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_rom/patches/esp_rom_spiflash.c
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/efuse/src/esp_efuse_fields.c
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/hal/twai_hal.c
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/hal/twai_hal_iram.c
|
||||
|
||||
LDFLAGS += --wrap=bootloader_print_banner
|
||||
endif
|
||||
|
||||
@@ -51,6 +51,7 @@ INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/compone
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/components/soc/$(CHIP_SERIES)/include
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/components/spi_flash/include
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/components/spi_flash/include/spi_flash
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/components/driver/twai/include
|
||||
|
||||
ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/components/bootloader_support/include
|
||||
@@ -127,6 +128,8 @@ CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/riscv/interrupt.c
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/soc/$(CHIP_SERIES)/gpio_periph.c
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/soc/$(CHIP_SERIES)/ledc_periph.c
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/soc/$(CHIP_SERIES)/rmt_periph.c
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/hal/twai_hal_iram.c
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/hal/twai_hal.c
|
||||
|
||||
ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/nuttx/src/bootloader_banner_wrap.c
|
||||
|
||||
@@ -51,6 +51,7 @@ INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/compone
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/components/soc/$(CHIP_SERIES)/include
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/components/spi_flash/include
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/components/spi_flash/include/spi_flash
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/components/driver/twai/include
|
||||
|
||||
ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)/chip/$(ESP_HAL_3RDPARTY_REPO)/components/bootloader_support/include
|
||||
@@ -152,6 +153,8 @@ ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_rom/patches/esp_rom_spiflash.c
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/efuse/src/esp_efuse_fields.c
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/hal/twai_hal.c
|
||||
CHIP_CSRCS += chip/$(ESP_HAL_3RDPARTY_REPO)/components/hal/twai_hal_iram.c
|
||||
|
||||
LDFLAGS += --wrap=bootloader_print_banner
|
||||
endif
|
||||
|
||||
@@ -32,6 +32,10 @@ ifeq ($(CONFIG_ESPRESSIF_SPIFLASH),y)
|
||||
CSRCS += esp_board_spiflash.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESPRESSIF_TWAI),y)
|
||||
CSRCS += esp_board_twai.c
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path src
|
||||
VPATH += :src
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
/****************************************************************************
|
||||
* boards/risc-v/esp32c3/common/src/esp_board_twai.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 <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/can/can.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "espressif/esp_twai.h"
|
||||
|
||||
#ifdef CONFIG_CAN
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define TWAI_PORT 0
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_twai_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize TWAI and register the TWAI device
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; A negated errno value is returned on
|
||||
* any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_twai_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI
|
||||
struct can_dev_s *twai;
|
||||
int ret;
|
||||
|
||||
/* Call esp_twaiinitialize() to get an instance of the TWAI
|
||||
* interface
|
||||
* */
|
||||
|
||||
twai = esp_twaiinitialize(TWAI_PORT);
|
||||
if (twai == NULL)
|
||||
{
|
||||
canerr("ERROR: Failed to get TWAI interface\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Register the TWAI driver at "/dev/can0" */
|
||||
|
||||
ret = can_register("/dev/can0", twai);
|
||||
if (ret < 0)
|
||||
{
|
||||
canerr("ERROR: TWAI0 register failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return OK;
|
||||
#else
|
||||
return -ENODEV;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* CONFIG_CAN */
|
||||
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# 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_TWAI0=y
|
||||
CONFIG_EXAMPLES_CAN=y
|
||||
CONFIG_FS_PROCFS=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_NSH=y
|
||||
CONFIG_TESTING_GETPRIME=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
@@ -81,6 +81,25 @@
|
||||
|
||||
int esp_bringup(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_twai_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize TWAI and register the TWAI device
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; A negated errno value is returned on
|
||||
* any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI
|
||||
int board_twai_setup(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_gpio_init
|
||||
*
|
||||
|
||||
@@ -184,6 +184,17 @@ int esp_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI
|
||||
|
||||
/* Initialize TWAI and register the TWAI driver. */
|
||||
|
||||
ret = board_twai_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: board_twai_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEV_GPIO
|
||||
ret = esp_gpio_init();
|
||||
if (ret < 0)
|
||||
|
||||
@@ -32,6 +32,10 @@ ifeq ($(CONFIG_ESPRESSIF_SPIFLASH),y)
|
||||
CSRCS += esp_board_spiflash.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESPRESSIF_TWAI),y)
|
||||
CSRCS += esp_board_twai.c
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path src
|
||||
VPATH += :src
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
/****************************************************************************
|
||||
* boards/risc-v/esp32c6/common/src/esp_board_twai.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 <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/can/can.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "espressif/esp_twai.h"
|
||||
|
||||
#ifdef CONFIG_CAN
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_twai_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize TWAI and register the TWAI device
|
||||
*
|
||||
* Input Parameters:
|
||||
* port - Port number (for hardware that has multiple TWAI interfaces)
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; A negated errno value is returned on
|
||||
* any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_twai_setup(int port)
|
||||
{
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI
|
||||
struct can_dev_s *twai;
|
||||
int ret;
|
||||
|
||||
/* Call esp_twaiinitialize() to get an instance of the TWAI
|
||||
* interface
|
||||
* */
|
||||
|
||||
twai = esp_twaiinitialize(port);
|
||||
if (twai == NULL)
|
||||
{
|
||||
canerr("ERROR: Failed to get TWAI interface\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI0
|
||||
/* Register the TWAI driver at "/dev/can0" */
|
||||
|
||||
ret = can_register("/dev/can0", twai);
|
||||
if (ret < 0)
|
||||
{
|
||||
canerr("ERROR: TWAI0 register failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_ESPRESSIF_TWAI0 */
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI1
|
||||
/* Register the TWAI driver at "/dev/can1" */
|
||||
|
||||
ret = can_register("/dev/can1", twai);
|
||||
if (ret < 0)
|
||||
{
|
||||
canerr("ERROR: TWAI1 register failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_ESPRESSIF_TWAI1 */
|
||||
|
||||
return OK;
|
||||
#else
|
||||
return -ENODEV;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* CONFIG_CAN */
|
||||
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# 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_TWAI0=y
|
||||
CONFIG_EXAMPLES_CAN=y
|
||||
CONFIG_FS_PROCFS=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_NSH=y
|
||||
CONFIG_TESTING_GETPRIME=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
@@ -81,6 +81,25 @@
|
||||
|
||||
int esp_bringup(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_twai_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize TWAI and register the TWAI device
|
||||
*
|
||||
* Input Parameters:
|
||||
* port - Port number (for hardware that has multiple TWAI interfaces)
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; A negated errno value is returned on
|
||||
* any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI
|
||||
int board_twai_setup(int port);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_gpio_init
|
||||
*
|
||||
|
||||
@@ -184,6 +184,28 @@ int esp_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI0
|
||||
|
||||
/* Initialize TWAI and register the TWAI driver. */
|
||||
|
||||
ret = board_twai_setup(0);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: TWAI0 board_twai_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI1
|
||||
|
||||
/* Initialize TWAI and register the TWAI driver. */
|
||||
|
||||
ret = board_twai_setup(1);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: TWAI1 board_twai_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEV_GPIO
|
||||
ret = esp_gpio_init();
|
||||
if (ret < 0)
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# 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_TWAI0=y
|
||||
CONFIG_EXAMPLES_CAN=y
|
||||
CONFIG_FS_PROCFS=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_NSH=y
|
||||
CONFIG_TESTING_GETPRIME=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
@@ -81,6 +81,25 @@
|
||||
|
||||
int esp_bringup(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_twai_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize TWAI and register the TWAI device
|
||||
*
|
||||
* Input Parameters:
|
||||
* port - Port number (for hardware that has multiple TWAI interfaces)
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; A negated errno value is returned on
|
||||
* any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI
|
||||
int board_twai_setup(int port);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_gpio_init
|
||||
*
|
||||
|
||||
@@ -184,6 +184,28 @@ int esp_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI0
|
||||
|
||||
/* Initialize TWAI and register the TWAI driver. */
|
||||
|
||||
ret = board_twai_setup(0);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: board_twai_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI1
|
||||
|
||||
/* Initialize TWAI and register the TWAI driver. */
|
||||
|
||||
ret = board_twai_setup(1);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: board_twai_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEV_GPIO
|
||||
ret = esp_gpio_init();
|
||||
if (ret < 0)
|
||||
|
||||
@@ -32,6 +32,10 @@ ifeq ($(CONFIG_ESPRESSIF_SPIFLASH),y)
|
||||
CSRCS += esp_board_spiflash.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESPRESSIF_TWAI),y)
|
||||
CSRCS += esp_board_twai.c
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path src
|
||||
VPATH += :src
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
/****************************************************************************
|
||||
* boards/risc-v/esp32h2/common/src/esp_board_twai.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 <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/can/can.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "espressif/esp_twai.h"
|
||||
|
||||
#ifdef CONFIG_CAN
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define TWAI_PORT 0
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_twai_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize TWAI and register the TWAI device
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; A negated errno value is returned on
|
||||
* any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_twai_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI
|
||||
struct can_dev_s *twai;
|
||||
int ret;
|
||||
|
||||
/* Call esp_twaiinitialize() to get an instance of the TWAI
|
||||
* interface
|
||||
* */
|
||||
|
||||
twai = esp_twaiinitialize(TWAI_PORT);
|
||||
if (twai == NULL)
|
||||
{
|
||||
canerr("ERROR: Failed to get TWAI interface\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Register the TWAI driver at "/dev/can0" */
|
||||
|
||||
ret = can_register("/dev/can0", twai);
|
||||
if (ret < 0)
|
||||
{
|
||||
canerr("ERROR: TWAI0 register failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return OK;
|
||||
#else
|
||||
return -ENODEV;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* CONFIG_CAN */
|
||||
@@ -0,0 +1,49 @@
|
||||
#
|
||||
# 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_TWAI0=y
|
||||
CONFIG_EXAMPLES_CAN=y
|
||||
CONFIG_FS_PROCFS=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_NSH=y
|
||||
CONFIG_TESTING_GETPRIME=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
@@ -81,6 +81,25 @@
|
||||
|
||||
int esp_bringup(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_twai_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize TWAI and register the TWAI device
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; A negated errno value is returned on
|
||||
* any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI
|
||||
int board_twai_setup(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_gpio_init
|
||||
*
|
||||
|
||||
@@ -184,6 +184,17 @@ int esp_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI
|
||||
|
||||
/* Initialize TWAI and register the TWAI driver. */
|
||||
|
||||
ret = board_twai_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: board_twai_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEV_GPIO
|
||||
ret = esp_gpio_init();
|
||||
if (ret < 0)
|
||||
|
||||
Reference in New Issue
Block a user