Added support for ESP32-C3

This commit is contained in:
nopnop2002
2021-07-24 09:43:56 +09:00
parent 01facafda0
commit cb990434f3
3 changed files with 47 additions and 43 deletions
+45 -36
View File
@@ -14,18 +14,18 @@ Use twai(Two-Wire Automotive Interface) driver instead of can driver.
# Hardware requirements # Hardware requirements
1. SN65HVD23x CAN-BUS Transceiver 1. SN65HVD23x CAN-BUS Transceiver
|SN65HVD23x||ESP32|ESP32-S2|| |SN65HVD23x||ESP32|ESP32-S2|ESP32-C3||
|:-:|:-:|:-:|:-:|:-:| |:-:|:-:|:-:|:-:|:-:|:-:|
|D(CTX)|--|GPIO21|GPIO17|(*1)| |D(CTX)|--|GPIO21|GPIO17|GPIO9|(*1)|
|GND|--|GND|GND|| |GND|--|GND|GND|GND||
|Vcc|--|3.3V|3.3V|| |Vcc|--|3.3V|3.3V|3.3V||
|R(CRX)|--|GPIO22|GPIO18|(*1)| |R(CRX)|--|GPIO22|GPIO18|GPIO10|(*1)|
|Vref|--|N/C|N/C|| |Vref|--|N/C|N/C|N/C||
|CANL|--|||To CAN Bus| |CANL|--||||To CAN Bus|
|CANH|--|||To CAN Bus| |CANH|--||||To CAN Bus|
|RS|--|GND|GND|(*2)| |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 (*2) N/C for SN65HVD232
@@ -35,31 +35,31 @@ I used 150 ohms.
# Test Circuit # Test Circuit
``` ```
+-----------+ +-----------+ +-----------+ +-----------+ +-----------+ +-----------+
| Atmega328 | | Atmega328 | | ESP32 | | Atmega328 | | Atmega328 | | ESP32 |
| | | | | | | | | | | |
| Transmit | | Receive | | 21 22 | | Transmit | | Receive | | 21 22 |
+-----------+ +-----------+ +-----------+ +-----------+ +-----------+ +-----------+
| | | | | | | | | | | |
+-----------+ +-----------+ | | +-----------+ +-----------+ | |
| | | | | | | | | | | |
| MCP2515 | | MCP2515 | | | | MCP2515 | | MCP2515 | | |
| | | | | | | | | | | |
+-----------+ +-----------+ | | +-----------+ +-----------+ | |
| | | | | | | | | | | |
+-----------+ +-----------+ +-----------+ +-----------+ +-----------+ +-----------+
| | | | | D R | | | | | | D R |
| MCP2551 | | MCP2551 | | VP230 | | MCP2551 | | MCP2551 | | VP230 |
| H L | | H L | | H L | | H L | | H L | | H L |
+-----------+ +-----------+ +-----------+ +-----------+ +-----------+ +-----------+
| | | | | | | | | | | |
+--^^^--+ | | +--^^^--+ +--^^^--+ | | +--^^^--+
| R1 | | | | R2 | | R1 | | | | R2 |
|---+-------|-----+-------|-----+-------|---| BackBorn H |---+-------|-------+-------|-------+-------|---| BackBorn H
| | | | | |
| | | | | |
| | | | | |
|-----------+-------------+-------------+---| BackBorn L |-----------+---------------+---------------+---| BackBorn L
+--^^^--+:Terminaror register +--^^^--+:Terminaror register
R1:120 ohms R1:120 ohms
@@ -89,6 +89,15 @@ idf.py menuconfig
idf.py flash 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 # Configuration
![config-main](https://user-images.githubusercontent.com/6020549/123870635-92a6ce00-d96d-11eb-9b67-7b6a26e95fbd.jpg) ![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) ![config-app](https://user-images.githubusercontent.com/6020549/123870638-94709180-d96d-11eb-94da-b4860148be6a.jpg)
+2 -2
View File
@@ -44,7 +44,7 @@ menu "Application Configuration"
config CTX_GPIO config CTX_GPIO
int "CTX GPIO number" int "CTX GPIO number"
range 0 34 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 17 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 21 if IDF_TARGET_ESP32 default 21 if IDF_TARGET_ESP32
help help
@@ -55,7 +55,7 @@ menu "Application Configuration"
config CRX_GPIO config CRX_GPIO
int "CRX GPIO number" int "CRX GPIO number"
range 0 34 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 18 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 22 if IDF_TARGET_ESP32 default 22 if IDF_TARGET_ESP32
help help
-5
View File
@@ -1,8 +1,3 @@
#
# Serial flasher config
#
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
# #
# Partition Table # Partition Table
# #