Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion tests/multi_extmod/machine_can_05_tx_prio_cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,21 @@ def instance0():
# requirement)
multitest.wait("instance1 ready")

bcast_countdown = 5

# "Babble" medium priority messages onto the bus to prevent
# instance1() from sending anything lower priority than this
while len(recv) < ITERS:
for id in range(0x5000, 0x6000):
can.send(id, b"BABBLE", CAN.FLAG_EXT_ID)
if len(recv) >= ITERS:
break
if bcast_countdown > 0:
# queue some "babble" messages onto the bus before signalling to
# instance1 that it can start trying to send
bcast_countdown -= 1
if not bcast_countdown:
multitest.broadcast("instance0 babbling")

print("received", ITERS, "messages")
for can_id in recv:
Expand Down Expand Up @@ -92,7 +100,7 @@ def instance1():
# make sure instance0 can queue outgoing medium-priority
# babble before we start trying to send, so we're trying to
# send onto an already busy bus
time.sleep_ms(100)
multitest.wait("instance0 babbling")

for i in range(ITERS):
# Fill the transmit queue with low priority messages (all extended IDs)
Expand Down
Loading