Robust txCAN()? errors and time outs

Discussions on CAN mapping for ECUs, sensors, PDMs, and more.
Post Reply
TXBDan
Posts: 69
Joined: Sat Mar 25, 2017 1:43 am

Robust txCAN()? errors and time outs

Post by TXBDan »

Hello,

I'm curious about how to make my sending of CAN messages as robust as possible. I notice that I occasionally get fail warnings which are triggered when txCAN() returns 0. I'm sending data at 50Hz (a send function is running with an onTick() at 50Hz) with the CANBUS set to 1mbps.

How should the "timeout" parameter be used? the default value is 100ms which seems very long. I don't want to block for 100ms if it can't send. Should i use a shorter value if i intend to run at 50Hz (20ms period)?
https://wiki.autosportlabs.com/RaceCapt ... ting#txCAN

Also is it ok to rapid fire several txCAN() calls in a row? I've seen some example code insert sleep(10) statements, but i don't want to wait around for 10ms.

Thanks,
Dan

brentp
Site Admin
Posts: 6282
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

There's currently a 2 message buffer for sending CAN messages, so at the moment you'll need to work around that. Fine-tuning your timeout in your script is likely the best way to go for now.
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

Post Reply