Skip to content
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

ESP32 compatibility #1

Closed
benjamintyler opened this issue Nov 27, 2018 · 4 comments
Closed

ESP32 compatibility #1

benjamintyler opened this issue Nov 27, 2018 · 4 comments

Comments

@benjamintyler
Copy link

Hi Pierre- Great job with these new ACAN2515 and ACAN2517 drivers! Most other MCP2515/2517 drivers seem to be lacking in various areas, but your ACAN drivers look excellent and very easy to use. Im looking forward to experimenting with them.

One question I had was regarding Espressif ESP32 compatibility. The Arduino ESP32 SPI drivers are a bit different in that they do not support the spi.usingInterrupt function. When I compile the ACAN2515/2517 test programs for ESP32, the compiler gives an error because the "usingInterrupt" does not exist in ESP32.

Just as a quick experiment, I modified your source files (ACAN2515.cpp/ACAN2517.cpp) and commented out line 156 "mSPI.usingInterrupt (itPin)".

On my work bench here with an MCP2517 development board (MCP2517 with a 20Mhz Ceralock resonator), with that mSPI.usingInterrupt line removed, the ACAN2517 driver initializes "ok", and it does send out CAN messages correctly. It does NOT receive any messages correctly though.

My tests were done with low speed single-wire CAN (33.333k) used on some GM/Opel/Saab vehicles, with a TH8056 single-wire-CAN transceiver connected to the MCP2517.

I could not make it send or receive with traditional 500k CAN. Perhaps something wrong with oscillator settings or my use of a 20MHz resonator and not a true 40MHz crystal?

I assume the receiving problem was due to the ACAN driver not correctly using the interrupt trigger from the MCP2517 due to the fact that I removed the usingInterrupt function.

Do you have any ideas on how to modify the driver to work correctly with the ESP32's SPI hardware?

Thanks
Ben

@pierremolinaro
Copy link
Owner

pierremolinaro commented Nov 27, 2018 via email

@pierremolinaro
Copy link
Owner

It appears that Arduino ESP32 interrupts are managed in a completely different way from usual Arduino:

  • SPI.usingInterrupt is not implemented;
  • noInterrupts() and interrupts() are NOPs;
  • interrupt service routines should be fast, otherwise you get an "Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)".

So 1.0.x releases do not run on ESP32.

For a few days now, I have had an ESP32 connected to a MCP2517FD, so I will port the driver to this platform.

@Piter2004
Copy link

Can you help me with setting bautrate registers for sending at speed 33,333kb for opel.

What values i have to write to registers
BRP
SEG1
SEG2
SJW
Thanks

@pierremolinaro
Copy link
Owner

pierremolinaro commented Oct 14, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants