This parameter instructs the PCAN driver to automatically reset the CAN controller of a PCAN Channel when a bus-off state is detected. It can be used to avoid resetting a device manually, after it has reached a bus-off state, for instance, when an application should work unattended, and it is known that bus-off error may occur.
It is available since PCAN-Basic version 1.0.0.
This parameter is read/write. It can be configured and retrieved.
This parameter can be activated or deactivated. Accepts values of type ParameterValueActivation.
The default state of the automatic bus-off reset is Off. After switching it On, the automatic reset stays active until it is expressly deactivated, or the Channel is disconnected, i.e., using the Uninitialize method.
Get: The PCAN Channel must be initialized before using this parameter.
Set: The PCAN Channel must be initialized before using this parameter.
The following code shows how to activate the automatic bus-off reset of a USB Channel:
PcanChannel channelUsed = PcanChannel.Usb01;
if (Api.Initialize(channelUsed, Bitrate.Pcan500) == PcanStatus.OK)
{
if (Api.SetValue(channelUsed, PcanParameter.BusOffAutoReset, ParameterValue.Activation.On) == PcanStatus.OK)
Console.WriteLine($"The automatic bus-off reset mechanism has been activated successfully for {channelUsed}.");
else
Console.WriteLine($"Error configuring the automatic reset on bus-off on channel {channelUsed}.");
Api.Uninitialize(channelUsed);
}Dim channelUsed As PcanChannel = PcanChannel.Usb01
If Api.Initialize(channelUsed, Bitrate.Pcan500) = PcanStatus.OK Then
If Api.SetValue(channelUsed, PcanParameter.BusOffAutoReset, ParameterValue.Activation.On) = PcanStatus.OK Then
Console.WriteLine($"The automatic bus-off reset mechanism has been activated successfully for {channelUsed}.")
Else
Console.WriteLine($"Error configuring the automatic reset on bus-off on channel {channelUsed}.")
End If
Api.Uninitialize(channelUsed)
End IfPcanChannel channelUsed = PcanChannel::Usb01;
if (Api::Initialize(channelUsed, Bitrate::Pcan500) == PcanStatus::OK)
{
if (Api::SetValue(channelUsed, PcanParameter::BusOffAutoReset, ParameterValue::Activation::On) == PcanStatus::OK)
Console::WriteLine("The automatic bus-off reset mechanism has been activated successfully for {0}.", channelUsed);
else
Console::WriteLine("Error configuring the automatic reset on bus-off on channel {0}.", channelUsed);
Api::Uninitialize(channelUsed);
}