Coder Social home page Coder Social logo

esp32ret's Introduction

ESP32RET

Reverse Engineering Tool running on ESP32 based hardware. Supports both EVTV ESP32 and Macchina A0

Requirements:

You will need the following to be able to compile the run this project:

  • Arduino IDE Tested on 1.8.13
  • Arduino-ESP32 - Allows for programming the ESP32 with the Arduino IDE
  • esp32_can - A unified CAN library that supports the built-in CAN plus MCP2515 and MCP2517FD
  • can_common - Common structures and functionality for CAN libraries

PLEASE NOTE: The Macchina A0 uses a WRover ESP32 module which includes PSRAM. But, do NOT use the WRover board in the Arduino IDE nor try to enable PSRAM. Doing so causes a fatal crash bug.

The EVTV board has no PSRAM anyway.

This program is larger than the default partitioning scheme. You will need to use a larger scheme. The recommended way to do this: Tools -> Partition Scheme -> Minimal SPIFFS

All libraries belong in %USERPROFILE%\Documents\Arduino\hardware\esp32\libraries (Windows) or ~/Arduino/hardware/esp32/libraries (Linux/Mac).

The canbus is supposed to be terminated on both ends of the bus. This should not be a problem as this firmware will be used to reverse engineer existing buses. However, do note that CAN buses should have a resistance from CAN_H to CAN_L of 60 ohms. This is affected by placing a 120 ohm resistor on both sides of the bus. If the bus resistance is not fairly close to 60 ohms then you may run into trouble.

The firmware is a work in progress. What works:

  • CAN0 / CAN1 reading and writing
  • Preferences are saved and loaded
  • Text console is active (configuration and CAN capture display)
  • Can connect as a GVRET device with SavvyCAN
  • LAWICEL support (somewhat tested. Still experimental)
  • Bluetooth works to create an ELM327 compatible interface (tested with Torque app)

What does not work:

  • Digital and Analog I/O

License:

This software is MIT licensed:

Copyright (c) 2014-2020 Collin Kidder, Michael Neuweiler

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

esp32ret's People

Contributors

bcran avatar collin80 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp32ret's Issues

ESP32RET communications problems

I have recently moved from using the DUE to ESP32 and have had problems with the fast 1,000,000 baud rate which is used on ESP32RET. I have solved my difficulties and the information might save others some head scratching. Using ESP32 modules from various online sources, I managed to program the code ok but it failed to connect to Savvycan and showed a lot of errors in the Arduino serial terminal. I basically got garbage on the display. The problem turned out to be the CP2102 USB/serial adapter used on all my units and indeed the majority of ebay units. These did not produce the correct baud rate when set to 1M baud. They in fact produce about 900,000 Kbaud! No good! I shopped around for an ESP32 which had a CH340G USB/serial chip and that worked perfectly. So beware which units you run this code on.

EVTV ESP32 CANDue Board with Enclosure

I purchased this board in 2019 and tried to compile the ESP2RET program. In reading the readme file I changed the board as suggested. Below is the end of the compiling message.

Can someone assist on what I am missing. I have successfully loaded the companion CANTestESP32_both in the same IDE
Below are some of the details
Thanks

Arduino: 1.8.15 (Windows 10), Board: "ESP32 Dev Module, Disabled, Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"

Using library WiFi at version 1.0 in folder: C:\Users\Harry\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\WiFi
Using library ESPmDNS at version 1.0 in folder: C:\Users\Harry\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\ESPmDNS
Using library ArduinoOTA at version 1.0 in folder: C:\Users\Harry\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\ArduinoOTA
Using library Update at version 1.0 in folder: C:\Users\Harry\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\Update
Using library EEPROM at version 1.0.3 in folder: C:\Users\Harry\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\EEPROM
exit status 1
Error compiling for board ESP32 Dev Module.

Compilation errors

Arduino 1.8.13/VisualMicro 2021.917.5
Suddenly I began to get errors:

In file included from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can_builtin.h:35:0,
from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can.h:1,
from C:\Temp\arduino_build_544023\sketch\config.h:35,
from C:\Temp\arduino_build_544023\sketch\Logger.h:31,
from C:\Temp\arduino_build_544023\sketch\Logger.cpp:27:
D:\Arduino\Proj\libraries\can_common\src/can_common.h:93:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
D:\Arduino\Proj\libraries\can_common\src/can_common.h:120:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
In file included from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can_builtin.h:35:0,
from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can.h:1,
from C:\Temp\arduino_build_544023\sketch\config.h:35,
from C:\Temp\arduino_build_544023\sketch\lawicel.cpp:6:
D:\Arduino\Proj\libraries\can_common\src/can_common.h:93:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
D:\Arduino\Proj\libraries\can_common\src/can_common.h:120:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
In file included from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can_builtin.h:35:0,
from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can.h:1,
from C:\Temp\arduino_build_544023\sketch\config.h:35,
from C:\Temp\arduino_build_544023\sketch\commbuffer.h:3,
from C:\Temp\arduino_build_544023\sketch\commbuffer.cpp:1:
D:\Arduino\Proj\libraries\can_common\src/can_common.h:93:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
D:\Arduino\Proj\libraries\can_common\src/can_common.h:120:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
In file included from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can_builtin.h:35:0,
from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can.h:1,
from C:\Temp\arduino_build_544023\sketch\config.h:35,
from C:\Temp\arduino_build_544023\sketch\gvret_comm.h:3,
from C:\Temp\arduino_build_544023\sketch\gvret_comm.cpp:5:
D:\Arduino\Proj\libraries\can_common\src/can_common.h:93:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
C:\Temp\arduino_build_544023\sketch\Logger.cpp: In static member function 'static void Logger::log(Logger::LogLevel, const char*, va_list)':
Logger.cpp:175:12: error: enumeration value 'Off' not handled in switch [-Werror=switch]
switch (level) {
^
D:\Arduino\Proj\libraries\can_common\src/can_common.h:120:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
C:\Temp\arduino_build_544023\sketch\Logger.cpp: In static member function 'static void Logger::logMessage(const char*, va_list)':
Logger.cpp:264:85: error: conversion lacks type at end of format [-Werror=format=]
writeLen = sprintf((char*)&buffer[buffLen], "%l", va_arg(args, long));
^
Logger.cpp:264:85: error: too many arguments for format [-Werror=format-extra-args]
Logger.cpp:264:85: error: conversion lacks type at end of format [-Werror=format=]
Logger.cpp:264:85: error: too many arguments for format [-Werror=format-extra-args]
C:\Temp\arduino_build_544023\sketch\lawicel.cpp: In member function 'void LAWICELHandler::handleLongCmd(char*)':
C:\Temp\arduino_build_544023\sketch\lawicel.cpp:89:29: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if (outFrame.length < 0) outFrame.length = 0;
^
C:\Temp\arduino_build_544023\sketch\lawicel.cpp:101:29: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if (outFrame.length < 0) outFrame.length = 0;
^
C:\Temp\arduino_build_544023\sketch\lawicel.cpp:79:10: warning: unused variable 'buff' [-Wunused-variable]
char buff[80];
^
C:\Temp\arduino_build_544023\sketch\lawicel.cpp: In member function 'void LAWICELHandler::sendFrameToBuffer(CAN_FRAME&, int)':
C:\Temp\arduino_build_544023\sketch\lawicel.cpp:299:13: warning: unused variable 'writtenBytes' [-Wunused-variable]
uint8_t writtenBytes;
^
C:\Temp\arduino_build_544023\sketch\lawicel.cpp:300:13: warning: unused variable 'temp' [-Wunused-variable]
uint8_t temp;
^
C:\Temp\arduino_build_544023\sketch\lawicel.cpp:301:14: warning: unused variable 'now' [-Wunused-variable]
uint32_t now = micros();
^
In file included from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can_builtin.h:35:0,
from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can.h:1,
from C:\Temp\arduino_build_544023\sketch\config.h:35,
from C:\Temp\arduino_build_544023\sketch\can_manager.h:2,
from C:\Temp\arduino_build_544023\sketch\can_manager.cpp:2:
D:\Arduino\Proj\libraries\can_common\src/can_common.h:93:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
D:\Arduino\Proj\libraries\can_common\src/can_common.h:120:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
C:\Temp\arduino_build_544023\sketch\commbuffer.cpp: In member function 'void CommBuffer::sendFrameToBuffer(CAN_FRAME&, int)':
commbuffer.cpp:82:108: error: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Werror=format=]
writtenBytes = sprintf((char *)&transmitBuffer[transmitBufferLength], "%d - %x", micros(), frame.id);
^
commbuffer.cpp:82:108: error: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Werror=format=]
C:\Temp\arduino_build_544023\sketch\commbuffer.cpp: In member function 'void CommBuffer::sendFrameToBuffer(CAN_FRAME_FD&, int)':
commbuffer.cpp:125:108: error: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Werror=format=]
writtenBytes = sprintf((char *)&transmitBuffer[transmitBufferLength], "%d - %x", micros(), frame.id);
^
commbuffer.cpp:125:108: error: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Werror=format=]
In file included from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can_builtin.h:35:0,
from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can.h:1,
from C:\Temp\arduino_build_544023\sketch\config.h:35,
from C:\Temp\arduino_build_544023\sketch\SerialConsole.h:30,
from C:\Temp\arduino_build_544023\sketch\SerialConsole.cpp:29:
D:\Arduino\Proj\libraries\can_common\src/can_common.h:93:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
D:\Arduino\Proj\libraries\can_common\src/can_common.h:120:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
In file included from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can_builtin.h:35:0,
from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can.h:1,
from C:\Temp\arduino_build_544023\sketch\config.h:35,
from C:\Temp\arduino_build_544023\sketch\sys_io.h:34,
from C:\Temp\arduino_build_544023\sketch\sys_io.cpp:33:
D:\Arduino\Proj\libraries\can_common\src/can_common.h:93:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
C:\Temp\arduino_build_544023\sketch\SerialConsole.cpp: In member function 'void SerialConsole::printMenu()':
C:\Temp\arduino_build_544023\sketch\SerialConsole.cpp:55:10: warning: unused variable 'buff' [-Wunused-variable]
char buff[80];
^
D:\Arduino\Proj\libraries\can_common\src/can_common.h:120:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
C:\Temp\arduino_build_544023\sketch\SerialConsole.cpp: In member function 'void SerialConsole::handleShortCmd()':
C:\Temp\arduino_build_544023\sketch\SerialConsole.cpp:145:13: warning: unused variable 'val' [-Wunused-variable]
uint8_t val;
^
In file included from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can_builtin.h:35:0,
from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can.h:1,
from C:\Temp\arduino_build_544023\sketch\config.h:35,
from C:\Temp\arduino_build_544023\sketch\commbuffer.h:3,
from C:\Temp\arduino_build_544023\sketch\ELM327_Emulator.h:56,
from C:\Temp\arduino_build_544023\sketch\ELM327_Emulator.cpp:33:
D:\Arduino\Proj\libraries\can_common\src/can_common.h:93:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
D:\Arduino\Proj\libraries\can_common\src/can_common.h:120:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
C:\Temp\arduino_build_544023\sketch\SerialConsole.cpp: In member function 'void SerialConsole::handleConfigCmd()':
C:\Temp\arduino_build_544023\sketch\SerialConsole.cpp:182:10: warning: unused variable 'writeDigEE' [-Wunused-variable]
bool writeDigEE = false;
^
C:\Temp\arduino_build_544023\sketch\SerialConsole.cpp:183:11: warning: unused variable 'dataTok' [-Wunused-variable]
char dataTok;
^
C:\Temp\arduino_build_544023\sketch\SerialConsole.cpp:190:19: warning: unused variable 'whichEntry' [-Wunused-variable]
unsigned char whichEntry = '0';
^
C:\Temp\arduino_build_544023\sketch\SerialConsole.cpp: In member function 'bool SerialConsole::handleFilterSet(uint8_t, uint8_t, char
)':
C:\Temp\arduino_build_544023\sketch\SerialConsole.cpp:447:16: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if (filter < 0 || filter > 7) return false;
^
C:\Temp\arduino_build_544023\sketch\SerialConsole.cpp:448:13: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if (bus < 0 || bus > 1) return false;
^
In file included from C:\Temp\arduino_build_544023\sketch\sys_io.cpp:34:0:
D:\Arduino\Proj\libraries\FastLED\src/FastLED.h:14:21: note: #pragma message: FastLED version 3.004.000

pragma message "FastLED version 3.004.000"

                 ^

In file included from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can_builtin.h:35:0,
from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can.h:1,
from C:\Temp\arduino_build_544023\sketch\config.h:35,
from C:\Temp\arduino_build_544023\sketch\wifi_manager.cpp:1:
D:\Arduino\Proj\libraries\can_common\src/can_common.h:93:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
D:\Arduino\Proj\libraries\can_common\src/can_common.h:120:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
In file included from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can_builtin.h:35:0,
from D:\Arduino\Proj\libraries\esp32_can\src/esp32_can.h:1,
from C:\Temp\arduino_build_544023\sketch\config.h:35,
from D:\Arduino\Proj\esp32\CAN\ESP32RET1\ESP32RET\ESP32RET.ino:28:
D:\Arduino\Proj\libraries\can_common\src/can_common.h:93:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
D:\Arduino\Proj\libraries\can_common\src/can_common.h:120:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const bool operator[]( int pos ) const
^
In file included from D:\Arduino\Proj\libraries\FastLED\src/FastLED.h:65:0,
from C:\Temp\arduino_build_544023\sketch\sys_io.cpp:34:
D:\Arduino\Proj\libraries\FastLED\src/fastspi.h:135:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output

pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"

                   ^

In file included from D:\Arduino\Proj\esp32\CAN\ESP32RET1\ESP32RET\ESP32RET.ino:32:0:
D:\Arduino\Proj\libraries\FastLED\src/FastLED.h:14:21: note: #pragma message: FastLED version 3.004.000

pragma message "FastLED version 3.004.000"

                 ^

C:\Temp\arduino_build_544023\sketch\sys_io.cpp: In function 'void sys_early_setup()':
C:\Temp\arduino_build_544023\sketch\sys_io.cpp:54:13: warning: unused variable 'i' [-Wunused-variable]
uint8_t i;
^
C:\Temp\arduino_build_544023\sketch\sys_io.cpp: In function 'void setup_sys_io()':
C:\Temp\arduino_build_544023\sketch\sys_io.cpp:62:13: warning: unused variable 'i' [-Wunused-variable]
uint8_t i;
^
In file included from C:\Temp\arduino_build_544023\sketch\wifi_manager.cpp:8:0:
D:\Arduino\Proj\libraries\FastLED\src/FastLED.h:14:21: note: #pragma message: FastLED version 3.004.000

pragma message "FastLED version 3.004.000"

                 ^

cc1plus.exe: some warnings being treated as errors
cc1plus.exe: some warnings being treated as errors
In file included from D:\Arduino\Proj\libraries\FastLED\src/FastLED.h:65:0,
from C:\Temp\arduino_build_544023\sketch\wifi_manager.cpp:8:
D:\Arduino\Proj\libraries\FastLED\src/fastspi.h:135:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output

pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"

                   ^

In file included from D:\Arduino\Proj\libraries\FastLED\src/FastLED.h:65:0,
from D:\Arduino\Proj\esp32\CAN\ESP32RET1\ESP32RET\ESP32RET.ino:32:
D:\Arduino\Proj\libraries\FastLED\src/fastspi.h:135:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output

pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"

                   ^

C:\Temp\arduino_build_544023\sketch\wifi_manager.cpp: In lambda function:
wifi_manager.cpp:36:32: error: 'union system_event_info_t' has no member named 'wifi_sta_disconnected'
Serial.println(info.wifi_sta_disconnected.reason);
^
wifi_manager.cpp:38:23: error: 'union system_event_info_t' has no member named 'wifi_sta_disconnected'
if ( (info.wifi_sta_disconnected.reason == 202) || (info.wifi_sta_disconnected.reason == 3))
^
wifi_manager.cpp:38:69: error: 'union system_event_info_t' has no member named 'wifi_sta_disconnected'
if ( (info.wifi_sta_disconnected.reason == 202) || (info.wifi_sta_disconnected.reason == 3))
^
C:\Temp\arduino_build_544023\sketch\wifi_manager.cpp: In member function 'void WiFiManager::setup()':
wifi_manager.cpp:45:12: error: 'ARDUINO_EVENT_WIFI_STA_DISCONNECTED' was not declared in this scope
}, ARDUINO_EVENT_WIFI_STA_DISCONNECTED);
^
C:\Temp\arduino_build_544023\sketch\wifi_manager.cpp:28:23: warning: unused variable 'eventID' [-Wunused-variable]
WiFiEventId_t eventID = WiFi.onEvent([](WiFiEvent_t event, WiFiEventInfo_t info)
^
D:\Arduino\Proj\esp32\CAN\ESP32RET1\ESP32RET\ESP32RET.ino: In function 'void loop()':
D:\Arduino\Proj\esp32\CAN\ESP32RET1\ESP32RET\ESP32RET.ino:321:10: warning: variable 'isConnected' set but not used [-Wunused-but-set-variable]
bool isConnected = false;
^

GVRET Protocol Documentation

Is there any proper documentation for the GVRET protocol aside from the gvret_comm source files?

I am designing a few ESP32 based modules with Quad CAN functionality (1x ESP TWAI, 3x MCP25625). I have already modified all of my internal libraries to utilize the can_common CAN_FRAME struct. For debugging, I would like to write and implement a custom GVRET task so that I can connect to my module and monitor the CAN bus activity or quickly script new tests without a firmware flash.

If not, I would be happy to write some documentation after I implement my own - I just wanted to check if there was any already.

MCP2515 not working

Even I fixed the MCP2515 library. It isn't working in the context of ESP32RET. I spend many hours on investigations and can't find the reason.
Internal CAN is working as it should. For the MCP2515 for whatever reason the "polling task" does not get any computation time. I played with many parameters like task priority. When you disable the CAN0 and put in MCP2515:handleint a Serial.print(). then it at least gets computation.

There must be some interference with CAN0 and something else in ESP32RET regarding task priority. However I am wondering, as the MCP2515 tasks are completly the same as for MCP2517FD.

SavvyCan says connected but no CAN frames

So i have gotten me a SuperB for my Macchina M2. I flashed the Macchina M2 with the M2RET and using a USB Cable, everything works flawlessly.

I have modified the ESP32RET.ino so it runs as an AP with my configured name and psk. That works well, i can connect to the WiFi and SavvyCan also reports connected and shows me some kind of ping data on the console output.

However, i only get CAN frames when i am connected to the M2 via Cable, i am not getting anything when connected to WiFi on the SuperB.

Does the m2 need a different Firmware when i am using the SuperB? I am not quite sure what the problem here is.

Any help is appreciated.

Compilaton errors

wifi_manager.cpp: 36:32: error: 'union system_event_info_t' has no member named 'wifi_sta_disconnected

wifi_manager.cpp: 45:12: error: 'ARDUINO_EVENT_WIFI_STA_DISCONNECTED' was not declared in this scope

What could be done.
Please, do not suggest to use binary from savvycan.com. I have different can pins and could not change them in HW.

Wifi reliability

I've managed to get 3 devices working with esp32RET and 2 Due's using GVRET.
I am testing nearly all the devices on one car, started with the Dues.
The reliability of the Due's is really good I had no issues with them.

For the esp32 it is somewhat a different story.
I started a prototype board with the "ESP32 Devkit v1" which uses the ESP32-WROOM-32.
The distance from where I am standing to my car where the device is located is around 4,5 - 5 meters, which should be nothing for wifi.
It seems I was wrong, I had no signal at all from where I was standing.
So went into the car near the device and I managed to get a connection and started testing, which didn't fail and was quite reliable.
But the fact the wifi didn't reach that far was frustrating and seems to be a different issue for the board itself.

So the next board I tried was "TTGO LoRa32 v1 OLED" which was somewhere laying around at home.
This board had a nice wifi antenna on the bottom so I hoped it would perform better.
I managed to get the sketch working, it communicated on a test CAN networking using the two Due's and it worked.
But the antenna was near some pins from the board itself and I wasn't really satisfied after all before even testing in the car.

The last board I tried was "TTGO Tbeam v1" this board had the same antenna but freely located on the board and had better power supply options.
Then again I got the sketch working I only had to change the can pin to pin 4 & 0, pin 5 was used for a Lora module.
( This board has PSRAM as well but as said on the main page, I disabled it )
The wifi signal was significantly better than the other two boards.
This board went into the car and I tried it again from 4,5 - 5 meter.
Surprisingly the signal dropped enormously but I managed to set up a connection.
Savvycan works but only for a minute on a loaded bus, then the bus starts to stutter by looking at the receiving frames and eventually results into "Connected to 0 busses" and the wifi dropped as well.

My actual question is: How is the wifi reliability for the Macchina A0 ? because I am trying to figure out what the problem could be.

is this still maintained?

I'm wondering if this Repo is still maintained? There are a lot of open issues and this wont compile with a ESP32-S3.

What is WIFI for?

Did not find any description nor instruction
I could connect to ESP32RETSSID AP with my phone and that is all.
Nothing more.
My Win10 notebook could not even connect.

Wifi breaks serial mode

If you've got wifi enabled in ESP32RET then you will no longer be able to connect to that board through the serial port (from within SavvyCAN). The reason is that it turns off a lot of the serial output so that it can handle a higher transfer rate over wifi. But, this makes it silently fail. There should be a way for the serial console to at least temporarily route around this while SavvyCAN is connected over serial.

Peak System support

Hi, can the esp32 with this software be recognized as a Peak Can to USB adapter?
Thank you in advance

Unable to connect EVTV ESP32 Board to SavvyCAN after flashing with ESP32RET

I have successfully flashed the EVTV ESP32 board with the ESP32RET Firmware Updater. But when I add a new connection to SavvyCAN, using the GVRET option, it is never able to establish a connection.

I tried re flashing multiple times and also tried on Windows and MacOS, but same issue.

Please check screenshot, and help me with what I am missing.

image

ESP32 Keeps on crashing ("Core 1 panic'd")

First of all I am very pleased to say that I like this project.
I am able to successfully compile and upload the project to ESP32 boards and test it together with SavvyCAN software to receive the frames. However, the frames kept on halting after a few seconds which had been a little frustrating. In the beginning I didn't know the exact problem but later with little more testing on Arduino's serial monitor I realized that the ESP32 boards keep on rebooting after a few seconds during the the scanning.
I tested the code with different ESP32 boards including

  • Huzzah32 from Adafruit,
  • ESP32-Wrover-E from Espressif,
  • Fire Beetle from DFRobot
  • and AtomU from M5Stack.

I compiled the code using different versions of the esp boards in the board manager on Arduino and all of these boards showed more or less the same behavior. But the esp32 board version below 2.0.0 didn't compile because it didn't find <drivers/twai.h>.

Here is what it looks like when it reboots:

Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

Core 1 register dump:
PC : 0x400970ef PS : 0x00060033 A0 : 0x80096479 A1 : 0x3ffbf0e0
A2 : 0x00000022 A3 : 0x3ffc6324 A4 : 0x00000004 A5 : 0xb33fffff
A6 : 0x00000001 A7 : 0x00000001 A8 : 0x00000000 A9 : 0xb33fffff
A10 : 0x00000000 A11 : 0x00000003 A12 : 0x3ffe9f00 A13 : 0x3ffe9eb0
A14 : 0x00000001 A15 : 0x3ffc4390 SAR : 0x00000018 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000032 LBEG : 0x400909a9 LEND : 0x400909cb LCOUNT : 0xffffffff

Backtrace:0x400970ec:0x3ffbf0e00x40096476:0x3ffbf100 0x400949a7:0x3ffbf120 0x400e398f:0x3ffbf150 0x40085319:0x3ffbf190 0x4000bfed:0x3ffe9e40 0x400973fd:0x3ffe9e50 0x40094791:0x3ffe9e70 0x400d6a1a:0x3ffe9eb0 0x400d6a71:0x3ffe9f00

and sometimes:

Backtrace:0x400970ec:0x3ffbf0e00x40096476:0x3ffbf100 0x400949a7:0x3ffbf120 0x400e2f73:0x3ffbf150 0x40085319:0x3ffbf190 0x400e36f9:0x3ffd2550 0x400dac8a:0x3ffd2590

Fun Fact: I tested the pre-compiled version of ESP32RET from Macchina found on this link, and it worked perfectly fine on ESP32 board (tested only on Huzzah32 so far).

Please help me fix this crashing problem. And if this still works fine for you, then I would like to know the exact versions of the libraries you used to compile the code i.e. Arduino, esp32 boards version in the board manager etc.

Thanks in advance.

Second serial port

Technically the EVTV boards have a second serial port that is currently un-used. It can only be used by soldering two jumpers. But, doing so would allow for true dual port mode where SavvyCAN traffic could be on port 1 and configuration / status on port 2. It would be good to document how to enable the second port, the reasons not to do so (they take up some of the pins), and then add support to ESP32RET for dual serial mode.

ESP32 dev board, connecting to savvyCAN but not giving frames

so I’m using a ESP32 dev board, using the AP mode on the esp to connect to savvyCAN, and savvyCAN will connect and only has one bus (as expected), but I receive no CAN frames and it the only thing in the device console is write to serial -> f1 9 Got data from serial. Len = 4 f1 09 de ad over and over again. Any ideas?

Documentation : Serial protocol

Hi there!

Thanks for sharing you great contribution!

I'm wondering if you have documented your serial protocol somewhere.
It seems you're keeping the protocol the same between your different RET device implementations.
I can read through the source code and figure it out piece by piece, but I'm wondering if there's a basic reference for the protocol already.

Thank you!
Elliot

Frame forwarding

The older GVRET firmware had the ability to forward traffic back and forth between CAN0 and CAN1. This firmware should allow for the same basic thing. But, this time it might be nice if the forwarding was optional (it's unfortunately stuck on in the GVRET firmware!)

Diy hardware - pinout

Hi,

I want to do own, basic hardware with two can buses and Led.
I belive machina a0 uses gpio 4&5 for can bus but heard somewhere that esp32 has two can buses. how to add another bus or eg. Mcp2515? Which pins i should use?

IDE errors when compiling

Hi Collin,
I'm trying to get a A0 going recently purchased from SparkFun(believe it or not).

This is a A0 Rev2 dated 4/8/21 according to the schematics, it has WROVER-E processor and a WS2812B addressable RGB on I/O 2.

I have selected board ESP32 Dev Module in IDE per A0's page.

I am trying the ESP32RET.ino directly with Arduino IDE2.0.3 I uploaded the master.ZIP file to the arduino library as usual.
I am getting a lot of errors when I try to compile, mostly c:\Users\david\Documents\Arduino\libraries\ESP32RET-master\wifi_manager.cpp,,,,,,ARDUINO_EVENT_WIFI_STA_DISCONNECTED,,,etc variations

why isn't it compiling?

Configuring hardware for GVRET node for SavvyCAN

Hello, I'm trying to use LilyGO T-CAN485 to connect to a DC Battery CAN BUS. I'm trying to figure out how to customize the ESP32RET.ino to work with this hardware. They have an example showing the following pins:

PIN_5V_EN 16
CAN_TX_PIN 26
CAN_RX_PIN 27
CAN_SE_PIN 23
WS2812_PIN 4

So I've modified the ESP32RET.ino to force using selection 3 and added the following:

    if (settings.systemType == 3)
    {
        Logger::console("Running on LILLYGO CANBUS BOARD");
        canBuses[0] = &CAN0;
        canBuses[1] = &CAN1;
        // SysSettings.LED_CANTX = 255;
        SysSettings.LED_CANRX = 255;
        // SysSettings.LED_LOGGING = 255;
        // SysSettings.LED_CONNECTION_STATUS = 255;
        SysSettings.fancyLED = true;
        SysSettings.logToggle = false;
        SysSettings.txToggle = false;
        SysSettings.rxToggle = true;
        SysSettings.lawicelAutoPoll = false;
        SysSettings.lawicelMode = false;
        SysSettings.lawicellExtendedMode = false;
        SysSettings.lawicelTimestamping = false;
        SysSettings.numBuses = 2;
        SysSettings.isWifiActive = true;
        SysSettings.isWifiConnected = true;
        // strcpy(deviceName, EVTV_NAME);
        // strcpy(otaHost, "media3.evtv.me");
        // strcpy(otaFilename, "/esp32ret.bin");
        //reconfigure the two already defined CAN buses to use the actual pins for this board.
        CAN0.setCANPins(GPIO_NUM_27, GPIO_NUM_26); //rx, tx
        // CAN1.setINTPin(36);
        // CAN1.setCSPin(32);

        FastLED.addLeds<WS2812B, 4, RGB>(leds, 1).setCorrection( TypicalLEDStrip );
        FastLED.setBrightness(  20 );
        //With the board facing up and looking at the USB end the LEDs are 0 1 2 (USB) 3
        //can test LEDs here for debugging but normally leave first three off and set connection to RED.
        //leds[0] = CRGB::White;
        //leds[1] = CRGB::Blue;
        //leds[2] = CRGB::Green;
        //leds[0] = CRGB::Red;
        FastLED.show();
        pinMode(16, OUTPUT);  //CAN 5V EN
        pinMode(23, OUTPUT);  //CAN CHIP MODE SELECT (SN65HVD231 Rs pin): LOW = HIGH SPEED, HIGH = SLOPE CONTROL
        digitalWrite(16, HIGH);
        digitalWrite(23, LOW);
    }

I can successfully flash the LilyGo board and connect to the AP. Here is the seriaI log:

Loading settings....
3

Running on LILLYGO CANBUS BOARD
Build number: 618
Enabled CAN0 with speed 500000
Enabled CAN1 with speed 500000
Free heap after setup: 98792
Done with init

However, after opening SavvyCAN and configuring GVRET I'm unable to get a connection established.

image

Any advice on what I can check to get this successfully working?

missing the DLC byte for the ATH1 case.

In file ELM327_Emulator.cpp, function "processCANReply()", when the H1 is used, ie, bHeader is true, it seems that DLC byte is not set into the output buffer.

Compile issue: error: 'union arduino_event_info_t' has no member named 'disconnected'

I’m getting errors when attempting to compile ESP32RET. Specifically, I’m getting:

wifi_manager.cpp:36:32: error: 'union arduino_event_info_t' has no member named 'disconnected'; did you mean 'eth_connected'?

This error is in WiFiManger::setup(), which is where info is defined as type WiFiEventInfo_t. Here is an excerpt of the code:

  WiFiEventId_t eventID = WiFi.onEvent([](WiFiEvent_t event, WiFiEventInfo_t info) 
        {
           if (SysSettings.fancyLED)
           {
               leds[0] = CRGB::Red;
               FastLED.show();
           }
           Serial.print("WiFi lost connection. Reason: ");
           Serial.println(info.disconnected.reason);
           SysSettings.isWifiConnected = false;

ESP32RET includes WiFi.h which includes WiFiType.h which defines arduino_event_info_t as WiFiEventInfo_t.

WiFiEventInfo_t is defined in WiFiGeneric.h as show below. There is no member disconnected.

typedef union {
        wifi_event_sta_scan_done_t wifi_scan_done;
        wifi_event_sta_authmode_change_t wifi_sta_authmode_change;
        wifi_event_sta_connected_t wifi_sta_connected;
        wifi_event_sta_disconnected_t wifi_sta_disconnected;
        wifi_event_sta_wps_er_pin_t wps_er_pin;
        wifi_event_sta_wps_fail_reason_t wps_fail_reason;
        wifi_event_ap_probe_req_rx_t wifi_ap_probereqrecved;
        wifi_event_ap_staconnected_t wifi_ap_staconnected;
        wifi_event_ap_stadisconnected_t wifi_ap_stadisconnected;
        wifi_event_ftm_report_t wifi_ftm_report;
        ip_event_ap_staipassigned_t wifi_ap_staipassigned;
        ip_event_got_ip_t got_ip;
        ip_event_got_ip6_t got_ip6;
        smartconfig_event_got_ssid_pswd_t sc_got_ssid_pswd;
        esp_eth_handle_t eth_connected;
        wifi_sta_config_t prov_cred_recv;
        wifi_prov_sta_fail_reason_t prov_fail_reason;
} arduino_event_info_t;

Fully compile output is:

Arduino: 1.8.16 (Mac OS X), Board: "Onehorse ESP32 Dev Module, 80MHz, 921600, None"

In file included from /Users/xxxx/Documents/Arduino/libraries/FastLED/src/FastLED.h:67,
                 from /Users/xxxx/Documents/Arduino/ESP32RET/ESP32RET.ino:32:
/Users/xxxx/Documents/Arduino/libraries/FastLED/src/fastspi.h:145:23: note: #pragma message: No hardware SPI pins defined.  All SPI access will default to bitbanged output
 #      pragma message "No hardware SPI pins defined.  All SPI access will default to bitbanged output"
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/xxxx/Documents/Arduino/libraries/FastLED/src/FastLED.h:67,
                 from /Users/xxxx/Documents/Arduino/ESP32RET/wifi_manager.cpp:8:
/Users/xxxx/Documents/Arduino/libraries/FastLED/src/fastspi.h:145:23: note: #pragma message: No hardware SPI pins defined.  All SPI access will default to bitbanged output
 #      pragma message "No hardware SPI pins defined.  All SPI access will default to bitbanged output"
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/xxxx/Documents/Arduino/ESP32RET/wifi_manager.cpp: In lambda function:
wifi_manager.cpp:36:32: error: 'union arduino_event_info_t' has no member named 'disconnected'; did you mean 'eth_connected'?
            Serial.println(info.disconnected.reason);
                                ^~~~~~~~~~~~
                                eth_connected
wifi_manager.cpp:38:23: error: 'union arduino_event_info_t' has no member named 'disconnected'; did you mean 'eth_connected'?
            if ( (info.disconnected.reason == 202) || (info.disconnected.reason == 3))
                       ^~~~~~~~~~~~
                       eth_connected
wifi_manager.cpp:38:60: error: 'union arduino_event_info_t' has no member named 'disconnected'; did you mean 'eth_connected'?
            if ( (info.disconnected.reason == 202) || (info.disconnected.reason == 3))
                                                            ^~~~~~~~~~~~
                                                            eth_connected
/Users/xxxx/Documents/Arduino/ESP32RET/wifi_manager.cpp: In member function 'void WiFiManager::setup()':
wifi_manager.cpp:45:25: error: 'SYSTEM_EVENT_STA_DISCONNECTED' is not a member of 'arduino_event_id_t'
         }, WiFiEvent_t::SYSTEM_EVENT_STA_DISCONNECTED);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Multiple libraries were found for "WiFi.h"
 Used: /Users/xxxx/Library/Arduino15/packages/esp32/hardware/esp32/2.0.3/libraries/WiFi
 Not used: /Applications/Arduino.app/Contents/Java/libraries/WiFi
exit status 1
'union arduino_event_info_t' has no member named 'disconnected'; did you mean 'eth_connected'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

What am I missing? Has arduino_event_info_t changed such that member disconnected was removed?

Thx.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.