← index #8129Issue #968
Off-topic · high · value 0.185
QUERY · ISSUE

Document values of CAN bus Constants

openby keelung-yangopened 2021-12-31updated 2024-09-08
docs

Hi,
Since CAN.send() have no error code returned, I've to check CAN.state() and got 4. But what 4 stand for? Then I've to search code to figure out this error code.
So, it's very convenient if values of CAN bus Constants can be documented clearly.
image

CANDIDATE · ISSUE

can.send and can.recv crash

closedby karihanskiopened 2014-11-09updated 2014-11-16

Test program:

from pyb import CAN
mode = CAN.NORMAL
can = CAN(1, mode)
can.init(mode, extframe=False, prescaler=5)
can.send('\x55', 0x10, timeout=2000)

will send can-telegrams repeatedly, blink the leds and USB REPL port disappears after a while.

can.recv(0)

Same symptoms, does not receive from can-bus, which may be because of inaccurate bus-speed.

CAN-bus speed setting (prescaler) unclear.
prescaler=5 will produce near 500k bus speed. Should be much higher, if I understand correctly.

Firmware version:
Micro Python v1.3.6-12-gb98c162 on 2014-11-09; PYBv1.0 with STM32F405RG

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied