Skip to content

Commit

Permalink
docu: added status
Browse files Browse the repository at this point in the history
  • Loading branch information
uhi22 committed Oct 9, 2023
1 parent 7f579e2 commit 73fec9f
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ Bridge between Wifi and CAN.
![image](doc/wifican_hardware_top.jpg)
![image](doc/wifican_hardware_bottom.jpg)

## News

### 2023-10-10

Receive path runs much more stable with the own TWAI FIFO driver. Transmit path not yet implemented.

## Motivation

SavvyCAN is a great open-source CAN tool, and the ESP32RET is assumingly a pretty good interface between the PC and multiple CANs.
Expand All @@ -17,28 +23,33 @@ The good old ESP32 board had the following issues:
- Using a more up-to-date ESP32s3 board reveals incompatibilites:
- The ESP32s3 does not support classic bluetooth, only BT low energy. This is not compatible with the ELM327 emulation, at least not out-of-the box.
- The ESP32_CAN driver hangs endless loop in a high-prio CAN driver task, maybe due to changes in the scheduling concept of the espressif twai driver.

Even when switching to the ESP32s3, there are stability issues with the original espressif TWAI driver, see doc/crashlog.md .

Out of this situation, the plan is create a minimal single channel device, which is a bridge between Wifi and CAN, and is still compatible to SavvyCAN.

## Solution

The better way would be to add fixes to the ESP32RET, but for experimentation the following approach was chosen:
The better way would be to add fixes to the ESP32RET and the espressif TWAI driver, but for experimentation the following approach was chosen:
- Instead of using the Libs which ESP32RET uses, copy the content directly into the project folder. This makes it easy to modify and develop, and to keep a consistent state.
- Single CAN channel: use the built-in TWAI of the ESP. No SPI, no MCP..., no FD support.
- One hard-coded configuration of the board. No EEPROM parameters.
- The only configuration option is the selection between Wifi-AP and Wifi-Station. The selection is done by a switch on a digital input.
- Kicked-out bluetooth completely.
- Kicked-out serial GVRET completely.
- Kicked-out the espressif TWAI driver (which has stability issue in the queue handling), and created a simple FIFO based receive path.

So we end-up with the following features for the moment:
- Single CAN channel. Configured to 500kBaud.
- Wifi connection to an existing wifi network (configured in the wifi_credentials.h file)
- Connection between PC and wifican runs over the existing wifi, using GVRET over wifi, which is in fact a telnet TCP connection.
- Wifi connection to an existing wifi network (configured in the wifi_credentials.h file) or providing an access point.
- Connection between PC and wifican runs over wifi, using GVRET over wifi, which is in fact a telnet TCP connection.
- The usb-serial-port is used just for debugging. No serial GVRET support.

## Quick Start Guide

- Install the Arduino IDE and the ESP32s3 board support.
- Solder a 3.3V CAN transceiver board to the ESP32s3 board. This needs just four wires: 3.3V, ground, CAN_RX (pin 4), CAN_TX (pin 5).
- Connect a switch, which connects the pin35 either to ground or to pin 47.
- Connect the ESP32s3 board at the "COM" USB (not the "USB"-USB) to the PC.
- Rename the wifi_credentials_template.h to wifi_credentials.h, and enter your wifi credentials there.
- Build and download the project in the Arduino IDE.
Expand All @@ -51,7 +62,7 @@ So we end-up with the following features for the moment:

## Results of reverse-engineering

### How does a CAN transmission work?
### How did a CAN transmission work?

- CANManager::sendFrame
- CAN_COMMON.sendFrame(...)
Expand All @@ -60,7 +71,7 @@ So we end-up with the following features for the moment:

The states and transitions of the ESP32S3 CAN driver are described here: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/twai.html

### How does the CAN reception work?
### How did the CAN reception work (in the old world with espressif TWAI driver?

- During startup, the task task_LowLevelRX is started.
- The task_LowLevelRX suspends in twai_receive().
Expand All @@ -79,7 +90,7 @@ The states and transitions of the ESP32S3 CAN driver are described here: https:/
- CANManager::displayFrame --> wifiGVRET.sendFrameToBuffer(frame, whichBus)


### How is the receive callback path configured?
### How was the receive callback path configured?
attachCANInterrupt() --> CAN_COMMON::setGeneralCallback() sets the cbGeneral.
canBuses[i]->watchFor() --> setRXFilter()
CAN_COMMON::attachCANInterrupt() --> CAN0.setCallback() -->
Expand Down

0 comments on commit 73fec9f

Please sign in to comment.