ESP32 + MCP2515 use CANHacker on CAN Bus system
HTML-код
- Опубликовано: 4 сен 2024
- ESP32 combined with MCP2515 CAN module uses CAN hacker software in the CAN Bus system to collect and analyze data in the can bus.
code is placed on my blog
My Blog: www-winson.blo...
www-winson.blo...
#arduino #esp32 #mega #canbus #mcp2515
verify:
www-winson.blo...
for esp8266 CS > GPIO5 , MOSI>GPIO12 , MISO>GPIO13 , SCK > GPIO14 , INT N/A
Nice
Good efforts. However, ESP32 already comes with built-in CAN port and they call it TWAI. So we can avoid MCP2515 and directly use some line driver like "SN65HVD233".
Good information!! I will try it!
What are you talking about , how can you not use a tranceiver ?
Can you elaborate?
@@natan66 Search for TWAI in the datasheet and you will understand.
@@natan66
check TWAI peripheral in the datasheet of ESP32.
Thanks bro 👍
Welcome
I tested and it`s really works fine (much better than arduino Nano), thank you for sharing!
goods for you
I tried both codes from youtube and from the blog, both have errors, which code did you use?
@@mateicornel9232 you can visit my blog :www-winson.blogspot.com/2023/05/esp32-mcp2515-use-canhacker-on-can-bus.html that has detail description!
@@mateicornel9232 I update the full code on my blog. you can try it!!
@@winson-DIY I managed to load the program on the esp32-s3 without errors. I made these connections: CS10,SCK12,MISO13,MISO12, INT_PIN18 and RX:18, TX17.
It doesn't read any can-bus :(, and can hacker doesn't connect on the selected port :(.
LEDTask at core:
0
Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception).
Debug exception reason: Stack canary watchpoint triggered (LEDTask)
Core 0 register dump:
PC : 0x4037d85b PS : 0x00060e36 A0 : 0x8037ffb8 A1 : 0x3fced460
A2 : 0x3fc97528 A3 : 0xb33fffff A4 : 0x0000abab A5 : 0x00060e23
A6 : 0x00060e23 A7 : 0x0000cdcd A8 : 0x0000cdcd A9 : 0xffffffff
A10 : 0x00000054 A11 : 0xfffc1fff A12 : 0x00060620 A13 : 0x00000000
A14 : 0x02c97528 A15 : 0x00ffffff SAR : 0x00000010 EXCCAUSE: 0x00000001
EXCVADDR: 0x00000000 LBEG : 0x400556d5 LEND : 0x400556e5 LCOUNT : 0xffffffff
Backtrace: 0x4037d858:0x3fced460 0x4037ffb5:0x3fced4a0 0x4037ffe2:0x3fced4c0 0x40380118:0x3fced4e0 0x40377e77:0x3fced500 0x40377e89:0x3fced530 0x40377eb2:0x3fced550 0x403804b9:0x3fced570 0x4037b481:0x3fced590 0x4037b724:0x3fced5b0 0x420046c7:0x3fced5d0 0x4200456b:0x3fced630 0x4200432a:0x3fced6c0 0x4200198d:0x3fced6e0
Thx for the response.
Good day man!
And for esp32 devkit v4 , I used your connections, with this result :(
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0
LEDTask at core:
0
CANTask at core:
1
3:56 - 4:19 Your showing code contains lot of errors can you share the modified aurdino code 🤔
Hi, you can refer to this link www-winson.blogspot.com/2023/05/esp32-mcp2515-use-canhacker-on-can-bus.html
@@winson-DIY Thanks for sharing I have now used the same code from your blog after uploading the program to ESP32 and I tried to connect with canhacker UI V2.00.01 now it throwing one error "CAN interface not responding!" any solution for this error? tryied Windows 7 and 10 same error
@@heugor-india hi! can you try this link www-winson.blogspot.com/2023/07/esp32-mcp2515-use-canhacker-on-can-bus.html for debug
Great information here but you showed an 8Mhz MCP2515 and if I recall correctly the library I used was setup for a 16Mhz MCP2515.
Did you need to change anything to get this to work?
if you want use 16MHz MCP2515 maybe you can try change below code canHacker->setClock(MCP_8MHZ); to canHacker->setClock(MCP_16MHZ);
I don't have this module so you need to try by yourself!
@@winson-DIY Yes, I got this working with an Arduino and posted a video you can watch if your interested. It was the second video in my DIY EV series made a couple of years ago.
How did you get the ESP32 to work with that MCP2515 module?
You're powering it from 5V, so the communication between the controller and the microcontroller must be at 3.3V.
lingshunlab.com/book/arduino/arduino-use-mcp2515-canbus reference this link
Hi. Great work. But i did not understand what You modifying in the code. Can you explain
One way is to do two ESP32+MCP2515 transfer data to each other, the other way is ESP32+MCP2515 and Mega2560+MCP2515(it's what I'm using now)
To make sure the FW is work fine at the same CAN bus baud rate
Hi, I put the video of the test verification and the way to solve it in my blog below
www-winson.blogspot.com/2023/07/esp32-mcp2515-use-canhacker-on-can-bus.html
Hi, the fact is that your indications or instructions on your blog are quite poor and unclear, which makes it difficult to understand; You should explain more that you need to use an Esp32SoftwareSerial library so that there is no problem with the code, you should modify your blog and be more explanatory with what you do because it is quite difficult to understand, on the other hand, how do I get the PC to recognize my code? ESP32 in CANHACKER software?
I did the entire process, the wiring with respect to the diagram on your blog, I DID NOT HAVE ANY INCONVENIENCE WHEN COMPILED OR WHEN SELECTING THE ESP32 Dev Module BOARD in the Arduino IDE; What else should I do so that the CANHACKER software recognizes my ESP32?
Hi, Thanks your suggestion!
OK. I'm lost... At 3:37 in the instruction you write to modify the original code to enable Free RTOS, and then I see no changes made to the code? Furthermore, your IDE shows 171 lines of code and the downloaded sketch has 83 lines. (big difference). I'm lost and just wasted a few hours doing the setup. :(
EDIT: I get it now... You're scrolling down to show the code changes that were made. If someone wants to try this they have to work for it :)... I hope it works. FYI: The native TWAI CAN control code of the built in ESP32 controller is problematic. I've had terrible luck with it. This is why I want to see if I can get this to work...
Please reference
www-winson.blogspot.com/2023/05/esp32-mcp2515-use-canhacker-on-can-bus.html
and
www-winson.blogspot.com/2023/07/esp32-mcp2515-use-canhacker-on-can-bus.html
that is work fine !! good luck !!
非常棒的视频,我做了一个ESP32+MCP2515+PCM2515的CD蓝牙模块,烧录对于我来说是困难的
你遇到什麽問題
Hello sir , may I ask a question , Why MCP2515 is used when esp32 already contain a can interface ? can I use just a transciever ?
Hi, I choice MCP2515 module is want to use CANHacker software.
do you have an example how ESP32 works with CAN? because there is nothing on inet
dara con el monitor serie de arduino ? y sus librerias o solo para el can hacker?
you can down load the canHacker software test your hardware
great job
i did exactly like in yor video but i have an error message
C:\Users\User\OneDrive\Рабочий стол\can-usb-master\can-usb\can-usb.ino:9:10: fatal error: SoftwareSerial.h: No such file or directory
compilation terminated.
exit status 1
Compilation error: SoftwareSerial.h: No such file or directory
how can i resolve this?
Hi, You can download this github.com/junhuanchen/Esp32-SoftwareSerial/tree/master library.
i Used a ESP-WROOM , and a 8khz MCP2515 , And thats it , the CANHAcker cannot be connected to the esp. is just dont do anything
Hi, ESP-WROOM is fine.
Have you read this article? ESP32 + MCP2515 use CanHacker on CAN Bus system --- Verify and Debug(www-winson.blogspot.com/2023/07/esp32-mcp2515-use-canhacker-on-can-bus.html)
Try it !!
@@winson-DIY You Believe that i didnt read the article and the Video 50 times?
@@winson-DIY i just want a ESP32+MCP2515 with no other device involved no jumper on MCP2515 either
@@gc9n That's right, that's what I did.
@@winson-DIY ok it's working, just mention that the pin5 is not D5 , it's GPIO05
Is there any ANDROID APP CanHacker , i dont want to use a laptop
Hi, I've never seen this APP for Android.
cant connect to the canhacker with any bitrate , what iam doing wrong ?
Can you do it again by referring to two related articles on my blog?
@@winson-DIY I used same wiring diagram as u ( I mean same Pins's) ,also used code from ur blog there was lite difrent in line #defnie lenght_ofSomething..
the code are used MCP2515 8mhz same like my , i cant find bit rate so i set 500
@@TheBestSib You can use the blog code that is work.
im using it from start @@winson-DIY
I found the solution but... it connects only in STAMP TIME ONLY(when iam using stamp time it gives frame and i need to connect it againt to program ) , why i cent get real time data ? HS doesnt work and listen mode doesnt give any frames , am i doing sth wrong @@winson-DIY
What exactly is the purpose of this project?
This project can be applied to my work for cam bus application.
Read and send CAN messages I guess, likely on a car's network, what you do with it afterward is up to you, the sky is the limit.
Personally I'll use it as a starting point to build something for a speeduino project (I want to control the original analog dashboard without having to double the sensors), I am fairly new to coding and the library I first tried to use had the pinout locked for "standard" arduino hats and I couldn't (wouldn't take the time to) figure out how to adapt them for my use case.
@@Homme_Pur Generally, CAN bus is used in cars to read the specific PID data you want to capture. It is recommended that you buy a PACN on the market first to get familiar with the CAN BUS architecture.
@@winson-DIY you didn't show how to receive CAN messages on ESP32. like ESP32 CAn Hacker. This is way too important and intereting
I have the Arduino UNO Serial board and the CAN MCP2515 board, I can communicate with the UNO board but I can not with MCP2515, I'm just wondering if I need to use specific driver, library to get it to work. I did the same connection to my Car CAN network but I read nothing.
I set UNO board to serial and 38400 Bud-rate and the MCP2515 to 125000 bit per second or 125kbs but my car doesn't respond. Any help would be appreciated.
here is the setup code:
void setup()
{
//Serial.begin(9600);
Serial.begin(38400); //this is communication to the Adruino
//mcp2515.reset();
//can.reset();
//can.begin(can_tx, can_rx, 9600); // Tx, Rx original communication to the CAN MCP2515 module
can.begin(can_tx, can_rx, 125000); // Tx, Rx communication to the CAN MCP2515 module
Serial.println("begin");
//mcp2515.reset();
//mcp2515.setBitrate(CAN_125KBPS);
//mcp2515.setNormalMode();
Serial.println("--------------------- CAN Read --------------------------");
Serial.println("ID DLC DATA");
}
unsigned long id = 0;
unsigned char dta[8];
void loop() {
if(can.recv(&id, dta))
{
Serial.print("GET CAR DATA FROM PID: ");
Serial.println(id);
for(int i=0; i
Hi, @alannobakht8503
I don't know what special library you are talking about, but there are a few key points:
1. #include
2.Check your SPI wiring is correct
Arduino UNO Rev3
10 SS
13 SCK
11 MOSI
12 MISO
First verify that your hardware can operate then to try your code !!!!
Can you find any sample code for your serial MCP2515 module that maybe can help!!
Da pra fazer com arduíno uno?
It is recommended that you use ESP32 dual core for better results.