About the CAN controller.
Re: About the CAN controller.
I have a basic question:
1) How can I validate and test the CAN circuitry in the ESP32 DevKitC with only using a single DevKitC module?
I would like to validate that CAN works in the ESP32 DevKitC before buying a lot of other modules.
1) How can I validate and test the CAN circuitry in the ESP32 DevKitC with only using a single DevKitC module?
I would like to validate that CAN works in the ESP32 DevKitC before buying a lot of other modules.
Re: About the CAN controller.
the CAN board which you have, which CAN board you use for this ( have you a link ? )cliftonk wrote: The CAN chip on the CAN board that I have, the VP230, does appear to be a SN65HVD23x 3.3V, when I do a google search.
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
Re: About the CAN controller.
how looks your CAN circuitry?cliftonk wrote:I have a basic question:
1) How can I validate and test the CAN circuitry in the ESP32 DevKitC with only using a single DevKitC module?
I would like to validate that CAN works in the ESP32 DevKitC before buying a lot of other modules.
to 1)
CAN tester, oscilloscope, logic analyzer
perhabs you have a look into basic first here or there or as video this helps to understand for pulls and terminate the CAN line, and whats happend, if this is not done ( some transceivers going to sleep )
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
Re: About the CAN controller.
Hi guys,
I just heard about esp32. I use arduino (pro micro) with MCP2515 CAN module for my project (https://hackaday.io/projects/hacker/236035). I need also bluetooth feature (HFP and PBAP). Can I do it with a single esp32 board without extrnal can module?
Which board should I use?
I just heard about esp32. I use arduino (pro micro) with MCP2515 CAN module for my project (https://hackaday.io/projects/hacker/236035). I need also bluetooth feature (HFP and PBAP). Can I do it with a single esp32 board without extrnal can module?
Which board should I use?
Re: About the CAN controller.
I bought the WaveShare CAN Module.
I hooked it up and everything works fine.
I might have had bad chips.
I hooked it up and everything works fine.
I might have had bad chips.
-
- Posts: 3
- Joined: Fri Jan 05, 2018 7:10 pm
Re: About the CAN controller.
Are there configuration changes that need to be done based on different ESP32 modules for the CAN bus?
I'm not able to get any CAN bus functionality to work using the Arduino example from here:
http://www.iotsharing.com/2017/09/how-t ... rface.html
I have this module board which uses the ESP-WROOM-32: https://www.tindie.com/products/Fusion/ ... rod_search
Unlike the example, I only have one ESP module, but I do have a VSCOM USB-CAN adapter that I can send and print messages with with a python script. Nothing shows up on the CAN bus (probed with oscilloscope) when the ESP module is supposed to be transmitting (added a serial print after the call to ESP32Can.CANWriteFrame(&rx_frame) to check it wasn't hanging) When I send messages to the ESP module with the VSCOM the ESP module is not setting the acknowledge bit at the end of the received CAN frame.
I've ruled out all of the possible hardware things I could think of that could be causing the problem. I've confirmed that pins IO4 and IO5 are connected to the correct pins on the transceiver chip, and when I transmit a CAN message from my VSCOM the data shows up on the RXD output from the transceiver. The CAN bus is properly terminated with two 120 ohm resistors.
Any help is appreciated, was not expecting it to be so much trouble.
I'm not able to get any CAN bus functionality to work using the Arduino example from here:
http://www.iotsharing.com/2017/09/how-t ... rface.html
I have this module board which uses the ESP-WROOM-32: https://www.tindie.com/products/Fusion/ ... rod_search
Unlike the example, I only have one ESP module, but I do have a VSCOM USB-CAN adapter that I can send and print messages with with a python script. Nothing shows up on the CAN bus (probed with oscilloscope) when the ESP module is supposed to be transmitting (added a serial print after the call to ESP32Can.CANWriteFrame(&rx_frame) to check it wasn't hanging) When I send messages to the ESP module with the VSCOM the ESP module is not setting the acknowledge bit at the end of the received CAN frame.
I've ruled out all of the possible hardware things I could think of that could be causing the problem. I've confirmed that pins IO4 and IO5 are connected to the correct pins on the transceiver chip, and when I transmit a CAN message from my VSCOM the data shows up on the RXD output from the transceiver. The CAN bus is properly terminated with two 120 ohm resistors.
Any help is appreciated, was not expecting it to be so much trouble.
-
- Posts: 3
- Joined: Fri Jan 05, 2018 7:10 pm
Re: About the CAN controller.
Did some more troubleshooting today, it looks like writes to MODULE_CAN->OCR have no effect (always 0). This would explain what I'm seeing, but I don't know why it's happening.
Re: About the CAN controller.
The CAN output control register doesn't actually exist as the ESP32 CAN peripheral only consists of the controller portion and requires an external transceiver functionality.
One of the likely causes of the ESP32 not outputting anything during transmission could be due to the RX pin not being able to observe the TX pin. The first bit in a CAN message is a dominant bit (represented by a low voltage on the TX pin), however if the RX pin observes something different the CAN controller will automatically assume that it has lost arbitration and cease transmission immediately. To see if this is cause of the issue, try directly connecting the TX pin to the RX pin on the ESP32, and observe if there is any activity from the TX pin (in theory the TX pin should repeatedly transmit due to the lack of an ACK bit form another CAN module).
It should also be noted that the CAN controller has a self test mode and a self transmission request (see SJA1000 documentation) which will enable you to test the CAN controller using only a single ESP32 module.
One of the likely causes of the ESP32 not outputting anything during transmission could be due to the RX pin not being able to observe the TX pin. The first bit in a CAN message is a dominant bit (represented by a low voltage on the TX pin), however if the RX pin observes something different the CAN controller will automatically assume that it has lost arbitration and cease transmission immediately. To see if this is cause of the issue, try directly connecting the TX pin to the RX pin on the ESP32, and observe if there is any activity from the TX pin (in theory the TX pin should repeatedly transmit due to the lack of an ACK bit form another CAN module).
It should also be noted that the CAN controller has a self test mode and a self transmission request (see SJA1000 documentation) which will enable you to test the CAN controller using only a single ESP32 module.
-
- Posts: 3
- Joined: Fri Jan 05, 2018 7:10 pm
Re: About the CAN controller.
Thank you for the help, I looked at the R and D pins on the CAN transceiver and noticed that even though the D line (transmit) was changing the R line was not. It turns out that the Rs pin (mode select pin) on the CAN transceiver was connected to pin 27 (IO16) on the ESP-Wroom-32 module. Adding two lines of code to set GPIO_NUM_16 to OUTPUT and drive it LOW before initializing the CAN library solved the problem. Both receive and transmit functions appear to be working just fine now.
I'm less than thrilled with the Tindie seller that failed to give any documentation or examples for the board they were selling, would have saved me from spending two days trying to get the thing to work...
I'm less than thrilled with the Tindie seller that failed to give any documentation or examples for the board they were selling, would have saved me from spending two days trying to get the thing to work...
Re: About the CAN controller.
Just started messing around with CAN on the ESP32....I designed my own PCB using an Infineon 3.3v CAN transceiver chip, assembled a prototype, and got it working perfectly! Many thanks to the excellent work of everyone involved in bringing the ESP32's internal CAN controller to life.
The one question I do have is regarding the libraries/formatting/syntax of how messages are sent within your code. I am using Arduino.
Right now, here is the test code that works perfectly
My question is, does anyone have input as far as making the above formatting/syntax more concise, such as modifying the ESP32 native CAN library to handle the message buffer as a single array?
The MCP2515 CAN SPI interface chip libraries are extremely concise and easy to use with global variables and byte arrays to hold the message.
Using the MCP2515 library is in the format of:
CAN.sendMsgBuf (CAN ID, std/ext ID, DLC length, message_bytes_array);
std (11bit) ID = 0
extended (29bit) ID = 1
So the MCP2515 equivalent of my ESP32 example above would be
Two lines of code, versus 12 lines of code.
I have a couple very large and complex CAN interface programs (2000+ lines of code) written for 8-bit AVR and MCP2515's that I am migrating over to the ESP32. It would be extremely nice to be able to tweak the ESP32 CAN libraries so they are compatible with my existing (MCP2515) programs.....rewriting the entire program to fit the ESP32's different CAN handling syntax.
two lines of code to send a message, and the ability to just leave all of the CAN messages at the beginning of the program in global variables is much easier to work with than using 12 lines of code to send the same message.
Especially since my project has 200 CAN messages stored in global variables used throughout the program...
Thanks
The one question I do have is regarding the libraries/formatting/syntax of how messages are sent within your code. I am using Arduino.
Right now, here is the test code that works perfectly
Code: Select all
my_frame.FIR.B.FF = CAN_frame_ext;
my_frame.MsgID = 291;
my_frame.FIR.B.DLC = 8;
my_frame.data.u8[0] = 7;
my_frame.data.u8[1] = 174;
my_frame.data.u8[2] = 6;
my_frame.data.u8[3] = 3;
my_frame.data.u8[4] = 0;
my_frame.data.u8[5] = 0;
my_frame.data.u8[6] = 127;
my_frame.data.u8[7] = 255;
ESP32Can.CANWriteFrame(&my_frame);
The MCP2515 CAN SPI interface chip libraries are extremely concise and easy to use with global variables and byte arrays to hold the message.
Using the MCP2515 library is in the format of:
CAN.sendMsgBuf (CAN ID, std/ext ID, DLC length, message_bytes_array);
std (11bit) ID = 0
extended (29bit) ID = 1
So the MCP2515 equivalent of my ESP32 example above would be
Code: Select all
byte my_frame[8] = {8, 7, 174, 6, 3, 0, 0, 127, 255};
CAN.sendMsgBuf (291, 0, 8, my_frame);
I have a couple very large and complex CAN interface programs (2000+ lines of code) written for 8-bit AVR and MCP2515's that I am migrating over to the ESP32. It would be extremely nice to be able to tweak the ESP32 CAN libraries so they are compatible with my existing (MCP2515) programs.....rewriting the entire program to fit the ESP32's different CAN handling syntax.
two lines of code to send a message, and the ability to just leave all of the CAN messages at the beginning of the program in global variables is much easier to work with than using 12 lines of code to send the same message.
Especially since my project has 200 CAN messages stored in global variables used throughout the program...
Thanks
Who is online
Users browsing this forum: Baidu [Spider], Majestic-12 [Bot], YaCy [Bot] and 62 guests