Update CAN examples.

This commit is contained in:
iabdalkader 2020-12-06 20:37:16 +02:00
parent 2c80728bc8
commit fecb586bae
2 changed files with 6 additions and 18 deletions

View File

@ -9,15 +9,9 @@ from pyb import CAN
# NOTE: Set to False on receiving node. # NOTE: Set to False on receiving node.
TRANSMITTER = True TRANSMITTER = True
can = CAN(2, CAN.NORMAL) can = CAN(2, CAN.NORMAL, baudrate=125_000, sampling_point=75)
# Set a different baudrate (default is 125Kbps) # NOTE: uncomment to set bit timing manually, for example:
# NOTE: The following parameters are for the H7 only. #can.init(CAN.NORMAL, prescaler=32, sjw=1, bs1=8, bs2=3)
#
# can.init(CAN.NORMAL, prescaler=32, sjw=1, bs1=8, bs2=3) # 125Kbps
# can.init(CAN.NORMAL, prescaler=16, sjw=1, bs1=8, bs2=3) # 250Kbps
# can.init(CAN.NORMAL, prescaler=8, sjw=1, bs1=8, bs2=3) # 500Kbps
# can.init(CAN.NORMAL, prescaler=4, sjw=1, bs1=8, bs2=3) # 1000Kbps
can.restart() can.restart()
if (TRANSMITTER): if (TRANSMITTER):

View File

@ -9,15 +9,9 @@ from pyb import CAN
# NOTE: Set to False on receiving node. # NOTE: Set to False on receiving node.
TRANSMITTER = True TRANSMITTER = True
can = CAN(2, CAN.NORMAL) can = CAN(2, CAN.NORMAL, baudrate=125_000, sampling_point=75)
# Set a different baudrate (default is 125Kbps) # NOTE: uncomment to set bit timing manually, for example:
# NOTE: The following parameters are for the H7 only. #can.init(CAN.NORMAL, prescaler=32, sjw=1, bs1=8, bs2=3)
#
# can.init(CAN.NORMAL, prescaler=32, sjw=1, bs1=8, bs2=3) # 125Kbps
# can.init(CAN.NORMAL, prescaler=16, sjw=1, bs1=8, bs2=3) # 250Kbps
# can.init(CAN.NORMAL, prescaler=8, sjw=1, bs1=8, bs2=3) # 500Kbps
# can.init(CAN.NORMAL, prescaler=4, sjw=1, bs1=8, bs2=3) # 1000Kbps
can.restart() can.restart()
if (TRANSMITTER): if (TRANSMITTER):