-
Notifications
You must be signed in to change notification settings - Fork 7.6k
ESP-IDF CAN controller driver not working for transmit: invalid_state error #3921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@Civilduino I have encountered the same problem as you ( first frame return 0, the latter return 0x103). |
Did you find any reason for this problem? Receiving is going fine, transmitting is not working! |
See my comment above, it is a hardware problem. There are counterfeit chips of SN65HVD230 out there. Order original chips from a reliable supplier and replace the one on your PCB. It worked for me. Good luck! |
It might actually be a software problem? When the QMC chips replaced the HMC ones for magnetometers, minor subtle code adjustments were needed. Chips that are MARKED DIFFERENTLY but serve as replacements for other chips, are not per-se "counterfeit". What were the markings on the chip that you had problems with, and what were the ones on the "original" that you found to work ? (Your photo is not clear enough) |
Sorry for late answer. |
I have a query with the Hardware Connection. How does ESP32 with CAN work. CAN I define any pins as CAN Rx and Tx and just change the definition here: Or this program only works with Pins 22 and 23?? Also which is Rx and which one is Tx?? |
I don't think there are specific pins for CAN, you can use what gpio you have open. |
Does anyone here have any experience with reading raw input from a transceiver board (SN65HVD230) via the GPIO pins on an ESP32? I am trying to read CAN messages very quickly bit-by-bit. |
Some CAN boards do not work on 3.3 volts, and require 5v at least. If you're "bitbashing", use an ESP with 2 cores, so you can bitbash in one core, and process in the other. |
Thank you very much for the reply. Could you provide some guidance on where best I might start? I purchased some CAN transceiver boards, and plan to hook them up to the GPIO pins on my FeatherS3. As I understand it, the transceiver board will simply convert the differential voltage on the CAN bus to a digital signal that can be used on a GPIO pin. Is there some generic code I can use to decide the data coming from the transceiver on the GPIO pins? I appreciate your reply.
On Thu, Aug 11, 2022 at 9:53 PM, Chris ***@***.***> wrote:
Some CAN boards do not work on 3.3 volts, and require 5v at least.
Some CAN boards are sketchy and just do not work at all.
Keep in mind there's 2 kind of CAN board - ones with just the transceiver chip, and others with the CAN decode ship as well - you want the 2nd kind - trying to decode CAN in software is a monster can of worms.
If you're "bitbashing", use an ESP with 2 cores, so you can bitbash in one core, and process in the other.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
Generic CAN-Bus code: I looked myself about 2 months ago, and could not find any, no. I'm not sure why China makes the "CAN" boards without the chip - I expect it's for people who want to do differential signalling, but do not want to use CAN protocols. I doubt that's you. |
Thank you for the suggestion. I have a specific need to decode CAN messages bit-by-bit, and use of a CAN module will unfortunately introduce too much latency into my application.
On Fri, Aug 12, 2022 at 4:04 AM, Chris ***@***.***> wrote:
Generic CAN-Bus code: I looked myself about 2 months ago, and could not find any, no.
Get the CAN modules that include the CAN decoder chip (not just the transceiver board), then you won't have any problems.
I'm not sure why China makes the "CAN" boards without the chip - I expect it's for people who want to do differential signalling, but do not want to use CAN protocols. I doubt that's you.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
Hardware:
Board: Wemos LOLIN D32 Pro
CAN Bus Transceiver: SN65HVD230
Software
PLATFORM: Espressif 32 1.12.0 > WEMOS LOLIN D32 PRO
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
PACKAGES:
-- framework-arduinoespressif32 3.10004.200129 (1.0.4)
-- tool-esptoolpy 1.20600.0 (2.6.0)
-- toolchain-xtensa32 2.50200.80 (5.2.0)
Dependency Graph
--Ticker 1.1
RAM: [ ] 4.5% (used 14796 bytes from 327680 bytes)
Flash: [== ] 20.8% (used 272229 bytes from 1310720 bytes)
IDE name: Platformio.io Core 4.3.1, Home 3.1.1 using Visual Code IDE
Flash Frequency: default
PSRAM enabled: yes
Upload Speed: 460800
Computer OS: Mac OSX
Description:
I am trying to use the ESP-IDF driver for the CAN controller in my CAN BUS application. I am getting an error when trying to transmit a CAN data frame or RTR. The error appears when trying to send the second CAN data frame. However, the first frame seems to be corrupted as well when I look at it with a digital analyser directly at the Tx pin.
Why does the CAN controller enters an "invalid_state" and then it goes "bus-off"?
How exactly I need to use this API? if I were to only receive CAN frames my approach seems to work.
or can it be a hardware issue as described here (from page 16) https://esp32.com/viewtopic.php?t=380&start=170 ?
Sketch:
Debug Messages:
Platformio configuration
The text was updated successfully, but these errors were encountered: