Re: connecting pyboard to CAN BUS
Posted: Fri Sep 02, 2016 5:36 pm
I would find such a shield useful, but I'd prefer to see a separate output for each port, and perhaps have the option of connecting them together using jumpers.
Please see the new forum at
https://forum.micropython.org/
the only reason there would be separate outputs needed - if you want to join separate CAN buses... otherwise single output is the same as two separate - in the end they will be connected to the same two wires of the CAN busdhylands wrote:I would find such a shield useful, but I'd prefer to see a separate output for each port, and perhaps have the option of connecting them together using jumpers.
I have updated scheme image, added PyBoard pins onto P1PappaPeppar wrote:How do you wire your P1 to the pyboard connectors. Have you measured whats on the pins of the transceivers?
could you please provide the code which you test this skin with?PappaPeppar wrote:Here is a skin that I know Works.
https://github.com/HenrikSolver/pybcanskin
Code: Select all
def cb1(bus, reason):
print('cb1', bus, reason)
def cb2(bus, reason):
print('cb2', bus, reason)
def init_cans():
can1 = CAN(1, CAN.SILENT)
can2 = CAN(2, CAN.NORMAL)
can1.setfilter(0, CAN.LIST16, 0, (123, 124, 125, 126))
can1.rxcallback(0, cb1)
can1.rxcallback(1, cb1)
can2.rxcallback(0, cb2)
can2.rxcallback(1, cb2)
return can1, can2
can1, can2 = init_cans()
can2.send('magic', 123)
Code: Select all
from pyb import CAN
def cb10(bus, reason):
print('cb1_0', bus, reason)
print(bus.recv(0))
def cb11(bus, reason):
print('cb1_1', bus, reason)
print(bus.recv(1))
def cb2(bus, reason):
print('cb2', bus, reason)
def init_cans():
can1 = CAN(1, CAN.NORMAL)
can2 = CAN(2, CAN.NORMAL)
can1.setfilter(0, CAN.LIST16, 0, (123, 124, 125, 126))
can1.setfilter(1, CAN.LIST16, 1, (113, 114, 115, 116))
can1.rxcallback(0, cb10)
can1.rxcallback(1, cb11)
can2.rxcallback(0, cb2)
can2.rxcallback(1, cb2)
return can1, can2
and then callback stops working silently while I still can do can1.recv() and receive data manually>>> can1, can2 = init_cans()
>>> can2.send('magic', 113)
>>> cb1_1 CAN(1, CAN.NORMAL, extframe=False) 0
uncaught exception in CAN(1) rx interrupt handler
MemoryError: