Another update to my issues with sending frames (Tx) from my ESP32.
I came along exchanging the Transceiver SN65HVD230 (CJMCU-230 - Devboard Ali-ordered) with a some SN65HVD232 chips.
This solved the issue for me~! I have stable CAN Rx/Tx now on my very same test setup (it really slept there for the few month). It might be the whole batch(?) of my CJMCU-230 / SN65HVD230 were not matching my network setup (don't know if there are setups they work with, maybe among each. My test were done with a 2nd CAN node, arudino based MCP2515 (5V) Transceiver.)
If I make it to owning my first oscilloscope, then I can also cross-check the transceiver voltage level on bus side again (which in the first CJMCU-230 batch order seemed too low to be recognized by other nodes correctly).
About the CAN controller.
Re: About the CAN controller.
- Attachments
-
- CJMCU-230s.jpg (146.58 KiB) Viewed 19766 times
-
- Posts: 1
- Joined: Wed Apr 17, 2019 11:17 am
Re: About the CAN controller.
Hello and
sorry for reactivating this thread. But my problems are nearly the same like described in this thread, but still no solution.
I use the SN65HVD230 and a ESP32 Dev Board with following LIB (https://github.com/miwagner/ESP32-Arduino-CAN)
As second node I use a CAN interface which is sending a recorded CAN trace with 500kbs in a loop. The HW used is a interface from Vector, so the second node works properly, thats sure. Used it for another project with ESP8266 and MCP2515/SN65HVD230 without any issues. Termination is 120Ohms, without the resistor, no communication is possible (which is ok).
It is possible to receive any message and any signal without any problem. The CAN data is displayed at a external LC-Display.
To send data to the CAN I used the same way like described in TX example of the LIB, adapted to 1000ms cycle, but nothing happens, which means RX is still okay, but the second node does not receive anything.
I tried different settings (e.g. RTR switched off, reduce SAM from triple to one, different BTR0 and BTR1 settings) without success. I also tried different transceivers (SN65HVD230, SN65HVD232, SN65HVD233) but still no success.
Connecting all GND also did not solve the problem.
Trying to debug the issue produces some data, but I am a bit confused.
1. Looking to error counters (RX = 0, TX = 0 after start, after short time TX error =128) -> So message is not transmitted
2. Looking ECC. This is always 0. Looking to SJA1000 datasheet, this means ECC [0-4]= five times 0 is not defined, ECC[5]= TX error, ECC[6-7]= bit error -> So what is the error reason? Any ideas?
3. Looking into status register (SR) -> RBS = 0, DOS = 0, TBS most times 0 (locked), TCS = 0, RS = 1, TS = 1, ES = 1 (sometimes 0 which is correct because no message was sent), BS = 0 (sometimes 1)
So my actual status: TX message is in buffer, but there is a issue, so the message can't be send out. Looking to the CAN traffic at second node, confirms this, because no message from the ESP32 occurs.
So any ideas? Comments or possible investigation you would suggest?
Thanks in advance and best regards
Malte
Update 24.04.2019:
"Solved" my problem by accident
Added a second termination resistor with 120Ohm directly to the transceiver. During my first tries, I am really sure, that I did this before. Maybe it was after I played with the CANInit-values and crashed TX with that...
But know it is sending constantly and precise (RX 5 times 10ms messages, TX 1 a 1000ms message).
So, always double check termination
sorry for reactivating this thread. But my problems are nearly the same like described in this thread, but still no solution.
I use the SN65HVD230 and a ESP32 Dev Board with following LIB (https://github.com/miwagner/ESP32-Arduino-CAN)
As second node I use a CAN interface which is sending a recorded CAN trace with 500kbs in a loop. The HW used is a interface from Vector, so the second node works properly, thats sure. Used it for another project with ESP8266 and MCP2515/SN65HVD230 without any issues. Termination is 120Ohms, without the resistor, no communication is possible (which is ok).
It is possible to receive any message and any signal without any problem. The CAN data is displayed at a external LC-Display.
To send data to the CAN I used the same way like described in TX example of the LIB, adapted to 1000ms cycle, but nothing happens, which means RX is still okay, but the second node does not receive anything.
I tried different settings (e.g. RTR switched off, reduce SAM from triple to one, different BTR0 and BTR1 settings) without success. I also tried different transceivers (SN65HVD230, SN65HVD232, SN65HVD233) but still no success.
Connecting all GND also did not solve the problem.
Trying to debug the issue produces some data, but I am a bit confused.
1. Looking to error counters (RX = 0, TX = 0 after start, after short time TX error =128) -> So message is not transmitted
2. Looking ECC. This is always 0. Looking to SJA1000 datasheet, this means ECC [0-4]= five times 0 is not defined, ECC[5]= TX error, ECC[6-7]= bit error -> So what is the error reason? Any ideas?
3. Looking into status register (SR) -> RBS = 0, DOS = 0, TBS most times 0 (locked), TCS = 0, RS = 1, TS = 1, ES = 1 (sometimes 0 which is correct because no message was sent), BS = 0 (sometimes 1)
So my actual status: TX message is in buffer, but there is a issue, so the message can't be send out. Looking to the CAN traffic at second node, confirms this, because no message from the ESP32 occurs.
So any ideas? Comments or possible investigation you would suggest?
Thanks in advance and best regards
Malte
Update 24.04.2019:
"Solved" my problem by accident
Added a second termination resistor with 120Ohm directly to the transceiver. During my first tries, I am really sure, that I did this before. Maybe it was after I played with the CANInit-values and crashed TX with that...
But know it is sending constantly and precise (RX 5 times 10ms messages, TX 1 a 1000ms message).
So, always double check termination
Re: About the CAN controller.
I registered here just to say thank you and to confirm that changing the chip worked for me too.
I spent several days trying to get the 230 chip working in a car with a 128kbit canbus to no avail, it also didnt want to work with a bench network using mcp2515/ja1050 transceiver. I could "listen" to the network, but could not transmit.
Once I swapped it with a 232, it worked perfectly.
I tried changing the resistor on the Rs pin in case it was a slope issue but to no avail.
Hope this helps other people in the same boat.
Re: About the CAN controller.
I have a working code that uses MCP2515 CAN module. Wanted to minimize the size of required modules, so I went with VP230 CAN transceiver and I'm having trouble relaying the same data through different libraries. All it has to do is log in with the first ''payload1'' and send voltage instruction with ''setdefaultvolt''. Any help is greatly appreciated.
**MCP2515** code:
**VP230** code:
**MCP2515** code:
Code: Select all
#include <mcp_can.h>
#include <mcp_can_dfs.h>
#include <SPI.h>
#include <Wire.h>
//pins:
#define CAN_INT 17 // Set INT to pin 2
MCP_CAN CAN(5); // Set CS to pin 4 (D2)
void setup()
{
Serial.begin(115200);
delay(100);
pinMode(17, INPUT); //Setting pin 2 for /INT input
START_INIT:
if(CAN_OK == CAN.begin(MCP_ANY, CAN_125KBPS, MCP_8MHZ))
{
}
else
{
delay(100);
goto START_INIT;
}
CAN.setMode(MCP_NORMAL); //set operation mode to normal so the MCP2515 sends acks to received data.
unsigned char payload1[8] = {0x16, 0x50, 0x71, 0x07, 0x97, 0x089, 0x00, 0x00}; //login data with serial number
CAN.sendMsgBuf(0x05004804, 1, 8, payload1); //send login data
unsigned char setdefaultvolt[5] = {0x29, 0x15, 0x00, 0xFE, 0x10}; //this is the command for setting the default output voltage (Last two bytes, LSB first). 16 80 is the maximum voltage of 57.6 V
CAN.sendMsgBuf(0x05019C00, 1, 5, setdefaultvolt); //send setup data
}
void loop()
{
}
Code: Select all
#include <CAN_config.h>
#include <ESP32CAN.h>
CAN_device_t CAN_cfg;
#include <SPI.h>
#include <Wire.h>
void setup()
{
Serial.begin(115200);
CAN_cfg.speed=CAN_SPEED_1000KBPS;
CAN_cfg.tx_pin_id = GPIO_NUM_19;
CAN_cfg.rx_pin_id = GPIO_NUM_23;
CAN_frame_t my_frame;
CAN_frame_t my_frame2;
ESP32Can.CANInit();
my_frame.FIR.B.FF = CAN_frame_ext;
my_frame.MsgID = 0x05004804;
my_frame.FIR.B.DLC = 8;
my_frame.data = {0x16, 0x50, 0x71, 0x07, 0x97, 0x089, 0x00, 0x00};
ESP32Can.CANWriteFrame(&my_frame);
my_frame.FIR.B.FF = CAN_frame_ext;
my_frame.MsgID = 0x05019C00;
my_frame.FIR.B.DLC = 5;
my_frame2.data = {0x29, 0x15, 0x00, 0xFE, 0x10};
ESP32Can.CANWriteFrame(&my_frame2);
}
void loop()
{
}
Re: About the CAN controller.
Be aware that they are some "FAKE" transceiver based on VP230 (SN65HVD230) !!!
I've lost days with 2pcs CJMCU-230 coming from the same supplier on Aliexpress. They were almost working at low speed (125kb) & only for few seconds at 500kb... Forcing High Speed mode with Rs connected to GND did not help really.
Applying another similar transceiver from Waveshare with same VP230 SN65HVD230 with Rs grounded solved all my troubles. Plugg & run! Smooth ESP32 read & writte at 500kb for hours with heavy REC trafic (Rx_PDO1_20ms, Rx_PDO2_1s, Rx_PDO3_5s, Tx_PDO1_1s)
https://www.waveshare.com/sn65hvd230-can-board.htm
Finally I pruchased (1 Euro/pc) 1pc SN65HVD232DR + 1pc SN65HVD233DR
https://www.d4online.com/search?q=can+t ... nstruments
I replaced the fake SN65HVD230 has shown here bellow (thanks Gnatz_):
https://esp32.com/posting.php?mode=quote&f=12&p=35553
Now, both my old transceivers CJMCU-230 are now working well at 500kB (without Rs grounded)
For my project (Cruise Control for my byke KTM Adventure 1190), I don't need to send any PDO's, I only need to received 5 PDO's but it must be reliable reading (20ms pooling time).
For now, I'm trying to understant the PeliCAN filter mode with Michael Wagner CAN driver 0.0.1. Has anyone ever seen a nice tutorial?
https://github.com/miwagner/ESP32-Arduino-CAN
I've lost days with 2pcs CJMCU-230 coming from the same supplier on Aliexpress. They were almost working at low speed (125kb) & only for few seconds at 500kb... Forcing High Speed mode with Rs connected to GND did not help really.
Applying another similar transceiver from Waveshare with same VP230 SN65HVD230 with Rs grounded solved all my troubles. Plugg & run! Smooth ESP32 read & writte at 500kb for hours with heavy REC trafic (Rx_PDO1_20ms, Rx_PDO2_1s, Rx_PDO3_5s, Tx_PDO1_1s)
https://www.waveshare.com/sn65hvd230-can-board.htm
Finally I pruchased (1 Euro/pc) 1pc SN65HVD232DR + 1pc SN65HVD233DR
https://www.d4online.com/search?q=can+t ... nstruments
I replaced the fake SN65HVD230 has shown here bellow (thanks Gnatz_):
https://esp32.com/posting.php?mode=quote&f=12&p=35553
Now, both my old transceivers CJMCU-230 are now working well at 500kB (without Rs grounded)
For my project (Cruise Control for my byke KTM Adventure 1190), I don't need to send any PDO's, I only need to received 5 PDO's but it must be reliable reading (20ms pooling time).
For now, I'm trying to understant the PeliCAN filter mode with Michael Wagner CAN driver 0.0.1. Has anyone ever seen a nice tutorial?
https://github.com/miwagner/ESP32-Arduino-CAN
-
- Posts: 1
- Joined: Tue Jan 24, 2023 12:10 pm
Re: About the CAN controller.
This is probably just a question from the uneducated. eg me
I am having problems using a ESP32 Feather with the SN65HVD231 CAN Bus transceiver using the ESP32CAN library.
On my bench I also have an UNO with a MCP2515 using the mcp_can library.
Both have jumers for a 120ohm resistor to terminate the CAN BUS.
When I setup the UNO to send data using
CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_8MHZ)
the ESP32 Feather does not read any data, however when I change the UNO to
CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ)
the ESP32 feather reads the data.
I can get my UNO to read my car CAN when set to 8MHz but cannot get the ESP32 Feather to read either the CAR or the test bench.
I only appear to be able to change the baud of the ESP32 but not the frequency.
How is anyone geeting this SN65HVD231 CAN Bus transceiver to work on a Car CAN BUS?
What am I missing.
I am having problems using a ESP32 Feather with the SN65HVD231 CAN Bus transceiver using the ESP32CAN library.
On my bench I also have an UNO with a MCP2515 using the mcp_can library.
Both have jumers for a 120ohm resistor to terminate the CAN BUS.
When I setup the UNO to send data using
CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_8MHZ)
the ESP32 Feather does not read any data, however when I change the UNO to
CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ)
the ESP32 feather reads the data.
I can get my UNO to read my car CAN when set to 8MHz but cannot get the ESP32 Feather to read either the CAR or the test bench.
I only appear to be able to change the baud of the ESP32 but not the frequency.
How is anyone geeting this SN65HVD231 CAN Bus transceiver to work on a Car CAN BUS?
What am I missing.
Who is online
Users browsing this forum: Google [Bot] and 37 guests