connecting pyboard to CAN BUS
Re: connecting pyboard to CAN BUS
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.
Re: connecting pyboard to CAN BUS
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.
Re: connecting pyboard to CAN BUS
no... even with transceivers it doesn't work and fails in the same way
-
- Posts: 30
- Joined: Thu Dec 18, 2014 10:38 pm
Re: connecting pyboard to CAN BUS
How do you wire your P1 to the pyboard connectors. Have you measured whats on the pins of the transceivers?
-
- Posts: 30
- Joined: Thu Dec 18, 2014 10:38 pm
Re: connecting pyboard to CAN BUS
Here is a skin that I know Works.
https://github.com/HenrikSolver/pybcanskin
https://github.com/HenrikSolver/pybcanskin
Re: connecting pyboard to CAN BUS
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?
Re: connecting pyboard to CAN BUS
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
Re: connecting pyboard to CAN BUS
after 3 send() calls I'm getting OSError 16. So it looks like all 3 TX mailboxes are filled and nothing being sent to the bus/receiver.
Then I've connected my DSO Quad oscilloscope to CAN2 TX and GND, and captured folloring stuff:
the code was:
Then I've connected my DSO Quad oscilloscope to CAN2 TX and GND, and captured folloring stuff:
the code was:
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)
Re: connecting pyboard to CAN BUS
ok. my fault. Now it works. MCP2562`s Vdd should be connected to V+, while Vio to 3V3. Will fix a scheme soon ) Thank you for help
Re: connecting pyboard to CAN BUS
Another question. Is it fine to do bus.recv(0) in rx callback?
With following code
I am getting following exception when rx callback is being executed on bus.recv():
With following code
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: