Open RahndelDaVandal opened 2 years ago
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
You may have found a solution for the _BITMOD constant instead of 0x05 trying to put 0x50. I'll be back after a few tests.
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.
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
I have the same problem on my Raspberry PI 3 B+
Still have this problem.
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.
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
@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)
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