Index: dialin/protocols/CAN.py =================================================================== diff -u -r3bc7e000a3f98d87aa718d34f11305c82ab1f03c -ra641687dd05e3e6a24098fc9606fbb3dd11724b7 --- dialin/protocols/CAN.py (.../CAN.py) (revision 3bc7e000a3f98d87aa718d34f11305c82ab1f03c) +++ dialin/protocols/CAN.py (.../CAN.py) (revision a641687dd05e3e6a24098fc9606fbb3dd11724b7) @@ -471,7 +471,7 @@ self.callback_listener_complete_messages = None self.callback_listener_invalid_messages = None self.thread_pool_executor = ThreadPoolExecutor(max_workers=1) - + self.transmitting_mutex = threading.Lock() # try to setup can bus and exit if the can bus has not ben setup to use. try: self.bus = socketcan.SocketcanBus(channel=can_interface) @@ -750,7 +750,8 @@ # A message can be longer than 8 bytes, so we need to split it # into 8 bytes packets. - + # We are sending one message at a time on CAN + self.transmitting_mutex.acquire() number_of_packets = DenaliMessage.get_total_packets(padded_can_message_array) # We are sending one message at a time on CAN @@ -767,6 +768,7 @@ self.do_log_can(packet, style="candump", channel=self.bus.channel, send=True) self.bus.send(packet, 0) # 0.1) + self.transmitting_mutex.release() # After all messages have been sent, we clear a flag self.send_event.clear()