From cb990434f399f2126874772755c61390f61f988b Mon Sep 17 00:00:00 2001 From: nopnop2002 Date: Sat, 24 Jul 2021 09:43:56 +0900 Subject: [PATCH] Added support for ESP32-C3 --- README.md | 81 +++++++++++++++++++++++------------------- main/Kconfig.projbuild | 4 +-- sdkconfig.defaults | 5 --- 3 files changed, 47 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 134a5dc..400aa4c 100644 --- a/README.md +++ b/README.md @@ -14,18 +14,18 @@ Use twai(Two-Wire Automotive Interface) driver instead of can driver. # Hardware requirements 1. SN65HVD23x CAN-BUS Transceiver -|SN65HVD23x||ESP32|ESP32-S2|| -|:-:|:-:|:-:|:-:|:-:| -|D(CTX)|--|GPIO21|GPIO17|(*1)| -|GND|--|GND|GND|| -|Vcc|--|3.3V|3.3V|| -|R(CRX)|--|GPIO22|GPIO18|(*1)| -|Vref|--|N/C|N/C|| -|CANL|--|||To CAN Bus| -|CANH|--|||To CAN Bus| -|RS|--|GND|GND|(*2)| +|SN65HVD23x||ESP32|ESP32-S2|ESP32-C3|| +|:-:|:-:|:-:|:-:|:-:|:-:| +|D(CTX)|--|GPIO21|GPIO17|GPIO9|(*1)| +|GND|--|GND|GND|GND|| +|Vcc|--|3.3V|3.3V|3.3V|| +|R(CRX)|--|GPIO22|GPIO18|GPIO10|(*1)| +|Vref|--|N/C|N/C|N/C|| +|CANL|--||||To CAN Bus| +|CANH|--||||To CAN Bus| +|RS|--|GND|GND|GND|(*2)| -(*1) You can change using menuconfig. +(*1) You can change using menuconfig. But it may not work with other GPIOs. (*2) N/C for SN65HVD232 @@ -35,31 +35,31 @@ I used 150 ohms. # Test Circuit ``` - +-----------+ +-----------+ +-----------+ - | Atmega328 | | Atmega328 | | ESP32 | - | | | | | | - | Transmit | | Receive | | 21 22 | - +-----------+ +-----------+ +-----------+ - | | | | | | - +-----------+ +-----------+ | | - | | | | | | - | MCP2515 | | MCP2515 | | | - | | | | | | - +-----------+ +-----------+ | | - | | | | | | - +-----------+ +-----------+ +-----------+ - | | | | | D R | - | MCP2551 | | MCP2551 | | VP230 | - | H L | | H L | | H L | - +-----------+ +-----------+ +-----------+ - | | | | | | - +--^^^--+ | | +--^^^--+ - | R1 | | | | R2 | - |---+-------|-----+-------|-----+-------|---| BackBorn H - | | | - | | | - | | | - |-----------+-------------+-------------+---| BackBorn L + +-----------+ +-----------+ +-----------+ + | Atmega328 | | Atmega328 | | ESP32 | + | | | | | | + | Transmit | | Receive | | 21 22 | + +-----------+ +-----------+ +-----------+ + | | | | | | + +-----------+ +-----------+ | | + | | | | | | + | MCP2515 | | MCP2515 | | | + | | | | | | + +-----------+ +-----------+ | | + | | | | | | + +-----------+ +-----------+ +-----------+ + | | | | | D R | + | MCP2551 | | MCP2551 | | VP230 | + | H L | | H L | | H L | + +-----------+ +-----------+ +-----------+ + | | | | | | + +--^^^--+ | | +--^^^--+ + | R1 | | | | R2 | + |---+-------|-------+-------|-------+-------|---| BackBorn H + | | | + | | | + | | | + |-----------+---------------+---------------+---| BackBorn L +--^^^--+:Terminaror register R1:120 ohms @@ -89,6 +89,15 @@ idf.py menuconfig idf.py flash ``` +# Installation for ESP32-C3 +``` +git clone https://github.com/nopnop2002/esp-idf-can2http +cd esp-idf-can2http +idf.py set-target esp32c3 +idf.py menuconfig +idf.py flash +``` + # Configuration ![config-main](https://user-images.githubusercontent.com/6020549/123870635-92a6ce00-d96d-11eb-9b67-7b6a26e95fbd.jpg) ![config-app](https://user-images.githubusercontent.com/6020549/123870638-94709180-d96d-11eb-94da-b4860148be6a.jpg) diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild index 8f1dbec..7904ae3 100644 --- a/main/Kconfig.projbuild +++ b/main/Kconfig.projbuild @@ -44,7 +44,7 @@ menu "Application Configuration" config CTX_GPIO int "CTX GPIO number" range 0 34 - default 2 if IDF_TARGET_ESP32C3 + default 9 if IDF_TARGET_ESP32C3 default 17 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 default 21 if IDF_TARGET_ESP32 help @@ -55,7 +55,7 @@ menu "Application Configuration" config CRX_GPIO int "CRX GPIO number" range 0 34 - default 3 if IDF_TARGET_ESP32C3 + default 10 if IDF_TARGET_ESP32C3 default 18 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 default 22 if IDF_TARGET_ESP32 help diff --git a/sdkconfig.defaults b/sdkconfig.defaults index ac1f271..cf4711b 100644 --- a/sdkconfig.defaults +++ b/sdkconfig.defaults @@ -1,8 +1,3 @@ -# -# Serial flasher config -# -CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y - # # Partition Table #