Use ESP32 Web interface also as GVRET CAN device?

Discussion about various user interfaces such as web interface, displays and apps
User avatar
uhi22
Posts: 601
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 91 times
Been thanked: 412 times

Use ESP32 Web interface also as GVRET CAN device?

Post by uhi22 »

The ESP32 web interface
https://github.com/jsphuebner/esp32-web ... an-backend
has as initial hotspot name "ESP32RETSSID". This sounds like it could be used like ESP32RET, as a interface for SavvyCAN.
The original ESP32RET lives here: https://github.com/collin80/ESP32RET

At the moment, I use two ESP32, one for the esp32-web-interface, and one as interface for SavvyCAN (https://github.com/uhi22/wifican). Both of these have CAN on the one side and Wifi on the other side, so basically this is topic to optimize both into one project.

Is there a plan, to provide the ESP32RET functionality in the esp32-web-interface? Or are there reasons why NOT doing this? What I learned some years ago is, that the CAN interface of the ESP32 is crap (hardware buffer overruns lead to corrupted data until resetting the complete interface). Also the TWAI software driver seems to have stability issues.
User avatar
johu
Site Admin
Posts: 5791
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1023 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by johu »

The twai works fine when limited to the few ids needed for SDO transfers. I use hardware filtering but you can only specify two ids. Some say on a busy bus without filtering CAN on the ESP becomes unstable. This would be the only reason to not add the function. At least not without the option to disable it
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
RetroZero
Posts: 731
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 329 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

For info, I bought an ESP32-S3 wroom and will attempt your setup.
I (think) I have setup my Nucleo board to send a message in loopback.
Plan now is to copy your .io file using Arduino to ESP32. What I understand is that once that is done, I can connect it via Savvycan and 'listen' to CAN bus .
Then connect the 2 boards via CAN and hope to see traffic....
RetroZero
Posts: 731
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 329 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

"At the moment, I use two ESP32, one for the esp32-web-interface, and one as interface for SavvyCAN (https://github.com/uhi22/wifican). Both of these have CAN on the one side and Wifi on the other side, so basically this is topic to optimize both into one project"

@uhi22, are you using Arduino or Espressif to run your wifican code for Savvycan configuration?
User avatar
uhi22
Posts: 601
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 91 times
Been thanked: 412 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by uhi22 »

I use arduino IDE, the version etc is mentioned in the readme of the github.
RetroZero
Posts: 731
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 329 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

Almost there.
I don't see the reason for:

"Connect a switch, which connects the pin35 either to ground or to pin 47"
User avatar
uhi22
Posts: 601
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 91 times
Been thanked: 412 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by uhi22 »

The switch is intended to select between "at home" (where the device connects to the home wifi) and "outside" where the device creates an own hotspot where the laptop can connect. Maybe this can be replaced by a kind of auto-detection or both-in-one, but for testing I found it better to have a clearly defined behavior. pin47 is just an output which is set to high, so the switch can be also between ground and 3.3V directly, to pull pin35 eigther high or low.
RetroZero
Posts: 731
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 329 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

Sorry @uhi22, but I have spent days trying to get this running.
I am not at ease with all this coding....after numerous de-installing all Arduino files, I "sort of" managed to create a sketch.
Now I have spent te last few hours trying to fix all the error messages
Any ideas where I am going wrong?
Arduino made me install each .h file individually....this doesn't make sense and might lead to where the root of my problems are.
Thanks in advance for your reply.
Attachments
Error messages ESP32S3 wifican.txt
(2.05 KiB) Downloaded 8 times
Jacobsmess
Posts: 489
Joined: Thu Mar 02, 2023 1:30 pm
Location: Uk
Has thanked: 252 times
Been thanked: 62 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by Jacobsmess »

RetroZero wrote: Fri Apr 12, 2024 10:43 am Sorry @uhi22, but I have spent days trying to get this running.
I am not at ease with all this coding....after numerous de-installing all Arduino files, I "sort of" managed to create a sketch.
Now I have spent te last few hours trying to fix all the error messages
Any ideas where I am going wrong?
Arduino made me install each .h file individually....this doesn't make sense and might lead to where the root of my problems are.
Thanks in advance for your reply.
I recently got mine running and it was hassle free with no errors from memory. I'm also no coder.
Have you installed the whole GitHub WiFican directory in the Arduino folder?
I'd start a fresh, delete your whole Arduino folder or change it's name and reinstall it all if you've made changes. Follow the instructions on the wifican GitHub also.
RetroZero
Posts: 731
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 329 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

I'll try again, thanks.
Yes, I installed the whole Wifican directory - Add Zip library.
When that did not work, I added the .h files manually.
I have nothing wired up to the ESP for now, just trying to configure and setup the wifi link.

Thanks again and will give it a whirl..
User avatar
uhi22
Posts: 601
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 91 times
Been thanked: 412 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by uhi22 »

You write "Add zip library", this sounds wrong. You need to get the sources from github, either using git clone, or downloading as zip from github. If you chose the zip download, unzip the project, and the unzipped folder IS your sketch folder. Just "open sketch" and select the folder with the unzipped files. You do not need to install extra libraries (at least I hope).
RetroZero
Posts: 731
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 329 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

I've done that a few times.I however get the options of Wifican and Wifihandler. I have selected Wifican. Then added Wifihandler file.
Am I correct in piutting my wifi details in the main wifican.ino file?

I have again manually added the .h files
I can Verify the Sketch.
I can upload the Sketch ( even though there is no 'code' on my screen).

When I go to Debug, I get openocd errors.
Is there a fault setting to change in Debug?
Also, in ArduinoIDE, the closest Board I could select was the Adafruit Feather ESP32-S3 2MB PSRAM. Is this maybe causing problems?
Attachments
Error message after complete new installation of ArduinoIDE.txt
(1.07 KiB) Downloaded 9 times
User avatar
uhi22
Posts: 601
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 91 times
Been thanked: 412 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by uhi22 »

I never used debugging in Arduino, so regarding openocd I have no idea.
Tried a workflow:
1. Create a new folder C:\Sketchfolder
2. Open in a browser https://github.com/uhi22/wifican
3. Green Button "Code", choose "Download zip". This creates a wifican-main.zip in the downloads folder.
4. Copy this zip into C:\Sketchfolder
5. Unzip, and arrange the folders in the way that you have the folder C:\Sketchfolder\wifican, and in this is the wifican.ino. This is because the Arduino IDE takes the folder name as name of the sketch, and the main ino file needs to have the same name.
6. Start the Arduino IDE. In my case it is Arduino IDE 2.2.1.
7. File -> Open..., navigate to C:\Sketchfolder\wifican\wifican.ino. This should directly show all files, with the wifican.ino as most left, because it is the main file.
8. Choose the board "ESP32S3 Dev Module"
The result should be:
image.png
9. Rename the wifi_credentials_template.h to wifi_credentials.h, and enter your wifi credentials there.
10. Press the upload button. This takes some minutes to compile. Then it tries to upload.

Besides the failing upload, because I do not have the device connected at the moment, I did not see any error message.
RetroZero
Posts: 731
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 329 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

Thank you very much. I'll give this a try tonight or in the morning 😉🤞👍
RetroZero
Posts: 731
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 329 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

Thanks for the description. I now have a wifican device available in my wifi list!!
Next step is to see why SavvyCan doesn't find the device or connect if I put in my IP adress....

Edit, I have connected pin 35 to GND and then to Pin47.Both ways do not allow for SavvyCan connection.
Wifican is found in my Wifi list, so I assume it's on the same network, but I cannot connect to it. Is this maybe an indication of the problem?
RetroZero
Posts: 731
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 329 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

I downloaded Savvycan again. Then I downloaded the GVRET update. I ran the .exe file (as I haven't seen how to update Savvycan). Still no way to connect wifican with Savvycan 😠
Jacobsmess
Posts: 489
Joined: Thu Mar 02, 2023 1:30 pm
Location: Uk
Has thanked: 252 times
Been thanked: 62 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by Jacobsmess »

RetroZero wrote: Sat Apr 13, 2024 6:13 pm I downloaded Savvycan again. Then I downloaded the GVRET update. I ran the .exe file (as I haven't seen how to update Savvycan). Still no way to connect wifican with Savvycan 😠
You are connected to wifican on your computer? For me, it just automatically appears when I select network connection under the connections window.

Also, have you configured the WiFi details as per your WiFi credentials as described in the instructions?
RetroZero
Posts: 731
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 329 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

I cannot connect to it. It just appears as a new wifi network.
I put in my current home wifi adress and password in the credentials instructions.
Basically, I opened the zip file, changed the template file, put in my wifi details and saved it back in wifican file.
I then connected it to Arduino, opened wifican, verified it, then uploaded it to ESP32-S3.
Jacobsmess
Posts: 489
Joined: Thu Mar 02, 2023 1:30 pm
Location: Uk
Has thanked: 252 times
Been thanked: 62 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by Jacobsmess »

Savvycan will not connect to the WiFi can device unless you are connected to the WiFi being broadcast from your WiFi can (at least that's how it works for me)
RetroZero
Posts: 731
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 329 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

So if I cannot connect to Wifcan from my computer, there is something wrong?

Edit:: on first setup, Pin32 should be pulled High? Connected to Pin 47?

Edit 2 - Should I be connecting a second wifi (dongle) to connect wifican whilst remaining on my home wifi network?
I ask because each time I try to connect to Wifican, I loose home connection first, then computer attempts to connect to wifican,asking to put in my password for home connection as per credentials. This I have done a few times.
Jacobsmess
Posts: 489
Joined: Thu Mar 02, 2023 1:30 pm
Location: Uk
Has thanked: 252 times
Been thanked: 62 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by Jacobsmess »

I just used the password in the wifican.ino file, "topsecret" this allows me to connect to the wifican SSID and it connects as previously described on savvycan
RetroZero
Posts: 731
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 329 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

Thanks, I'll look at it in the morning. Appreciate all the help, but feel really useless at the moment.....
RetroZero
Posts: 731
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 329 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

@Jacobmess, thankyou for this info!! This was my problem. The Wifican password is "topsecret" and not my home network password.
So once the "credentials.h file has been modified with local your wifi details", load the sketch and connect to the new "wifican network" using "topsecret" as the password. (I assume we can change this directly in the wifi.ino if we want to)
It might seem so simple, that it not need saying. Many days of rebooting later, I have a wifican up and running. I'll add this to the wiki alongside @gregski's CanDue.
Many thanks again....Happy Can sniffing!
RetroZero
Posts: 731
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 329 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

I assume it's normal to have some kind of data loop going through 2 ID when you start up Savvycan without any Canbus connected?
User avatar
uhi22
Posts: 601
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 91 times
Been thanked: 412 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by uhi22 »

Yes, the wifican privides some debug data as "virtual" CAN messages.
Post Reply