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

RuntimeError: Timeout setting Mode #13

Open
RahndelDaVandal opened this issue Apr 9, 2022 · 9 comments
Open

RuntimeError: Timeout setting Mode #13

RahndelDaVandal opened this issue Apr 9, 2022 · 9 comments

Comments

@RahndelDaVandal
Copy link

I am trying to use the MCP2515 with my BlueSense Feather and rp2040 feather. I ran your simple test code and it fails to initialize on 4 different MCP2515 boards. Any suggestions or should I just forget about the MCP2515 and suck it up and buy some feather cans.

Traceback (most recent call last):
File "code.py", line 16, in
File "adafruit_mcp2515/init.py", line 270, in init
File "adafruit_mcp2515/init.py", line 302, in initialize
File "adafruit_mcp2515/init.py", line 631, in _set_mode
File "adafruit_mcp2515/init.py", line 650, in _request_new_mode
RuntimeError: Timeout setting Mode

@Borti0
Copy link

Borti0 commented Apr 22, 2022

I have the same problem, for the moment I am trying to solve it, the problem is that the new operating mode in mcp2515 fails to be written, and when reading for validation the configuration mode is returned which is set to activate once the power is turned on. mcp2515

@Borti0

This comment was marked as outdated.

@casainho
Copy link
Contributor

I got that same error while trying to use a MCP2515 SPI module. I was connecting CS pin of the module to GND but then I connected it to my board, to the expected CS pin and now it works, that solved my problem.

@fy8207345
Copy link

fy8207345 commented Mar 27, 2023

I have the same problem on my Raspberry 4b.
the wirings is below:
MCp2515 vcc -> raspberry 5v
MCp2515 GND -> raspberry GND
MCp2515 CS-> raspberry GPIO8
MCp2515 SO-> raspberry GPIO9
MCp2515 SI-> raspberry GPIO10
MCp2515 SCK -> raspberry GPIO11
MCp2515 INT -> raspberry GPIO25

@Joz1mar
Copy link

Joz1mar commented Jun 14, 2023

I have the same problem on my Raspberry PI 3 B+

@HourGlss
Copy link

Still have this problem.

@anecdata
Copy link
Member

anecdata commented Jun 25, 2023

Note that this is the exception that arises if the CS pin in code doesn't match the wiring (probably also other SPI-related causes):

Correct CS pin:

Adafruit CircuitPython 8.2.0-rc.0 on 2023-06-23; Adafruit Feather RP2040 with rp2040
>>> from time import sleep
>>> import board
>>> from digitalio import DigitalInOut
>>> from adafruit_mcp2515 import MCP2515 as CAN
>>> 
>>> cs = DigitalInOut(board.D5)
>>> cs.switch_to_output()
>>> spi = board.SPI()
>>> can_bus = CAN(spi, cs)
>>> 

Wrong CS pin:

Adafruit CircuitPython 8.2.0-rc.0 on 2023-06-23; Adafruit Feather RP2040 with rp2040
>>> from time import sleep
>>> import board
>>> from digitalio import DigitalInOut
>>> from adafruit_mcp2515 import MCP2515 as CAN
>>> 
>>> cs = DigitalInOut(board.D4)
>>> cs.switch_to_output()
>>> spi = board.SPI()
>>> can_bus = CAN(spi, cs)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_mcp2515/__init__.py", line 322, in __init__
  File "adafruit_mcp2515/__init__.py", line 354, in initialize
  File "adafruit_mcp2515/__init__.py", line 687, in _set_mode
  File "adafruit_mcp2515/__init__.py", line 706, in _request_new_mode
RuntimeError: Timeout setting Mode
>>> 

I'd also suggest updating to the current version of the library.

@yarrumretep
Copy link

Having this problem with CS pin D5 - any thoughts @anecdata ?

Adafruit CircuitPython 8.2.8 on 2023-11-16; Adafruit Feather RP2040 CAN with rp2040
>>> from time import sleep
>>> import board
>>> from digitalio import DigitalInOut
>>> from adafruit_mcp2515 import MCP2515 as CAN
>>> cs = DigitalInOut(board.D5)
>>> cs.switch_to_output()
>>> spi = board.SPI()
>>> can_bus = CAN(spi, cs)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_mcp2515/__init__.py", line 322, in __init__
  File "adafruit_mcp2515/__init__.py", line 354, in initialize
  File "adafruit_mcp2515/__init__.py", line 687, in _set_mode
  File "adafruit_mcp2515/__init__.py", line 706, in _request_new_mode
RuntimeError: Timeout setting Mode

@anecdata
Copy link
Member

@yarrumretep I don't have that board, but the guide says CS is:

GPIO19 - CAN Chip Select pin. Can be accessed in CircuitPython with CAN_CS and in Arduino with PIN_CAN_CS.
https://learn.adafruit.com/adafruit-rp2040-can-bus-feather/pinouts (about 2/3 down the page)

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

8 participants