Play around with CAN bus using micropython and MCP chips on ESP modules
sudo nano /etc/udev/rules.d/99-USBtiny
Then paste
SUBSYSTEM=="usb", SYSFS{idVendor}=="1781", SYSFS{idProduct}=="0c9f", GROUP="users", MODE="0666"
or
SUBSYSTEM=="usb", ATTR{idVendor}=="1781", ATTR{idProduct}=="0c9f", GROUP="adm", MODE="0666"
into the new file. Write it out by pressing Ctrl-O
and Ctrl-X
to exit.
sudo usermod -a -G plugdev YOURUSERNAME
sudo service udev restart
sudo udevadm control --reload-rules
Insert the USBtinyISP again.
from mcpcan import CAN
can = CAN()
# can.stop()
can.start()
msg = {'ext':True, 'id':0x18ff50e5, 'data':b'\x12\x34\x56\x78\x90\xab\xcd\xef', 'dlc':8, 'rtr':False}
can.send_msg(msg)
Debugging script
cfg = b'\x02\x92\x04'
can.stop()
can._spi_reset()
can._spi_write_bit(b'\x0f', b'\xe0', b'\x80')
can._spi_write_reg(b'\x28', cfg)
can._spi_write_bit(b'\x60', b'\x64', b'\x64')
can._spi_write_bit(b'\x70', b'\x60', b'\x00')
can._spi_write_reg(b'\x08', b'\xff\xff\xff\xff')
can._spi_write_reg(b'\x10', b'\xff\xff\xff\xff')
can._spi_write_reg(b'\x14', b'\xff\xff\xff\xff')
can._spi_write_reg(b'\x18', b'\xff\xff\xff\xff')
can._spi_write_reg(b'\x24', b'\xff\xff\xff\xff')
can._spi_write_bit(b'\x0f', b'\xe0', b'\x00')
can.send_msg(msg)
- HABR VAG
- Arduino simple communication
- ! MCP CAN utils
- ! Installing Python-CAN for Raspberry Pi
- Python CAN Raspberry Pi
- [quick-guide] CAN bus on raspberry pi with MCP2515
- CAN2Ethernet
- How to Connect Raspberry Pi to CAN Bus
- pyobd
- piobd
- !!!!! micropython CAN !!!!!!!!
- Short MCP CAN Arduino lib
- MCP2515 instructions
- Python Raspberry Pi SPI CAN
- Esp32 can driver #5310 (Pull request)