Listen-only mode when using UDS API
Posted: Tue 18. Feb 2020, 12:16
Hello,
I'm using the PCAN UDS successfully. Now I'm trying to additionally add a PCanBasic channel in listen-only mode to watch the actual CAN traffic on the bus.
However I am unable to initialize the PCanBasic channel after initializing the channel in the UDS API. I think it should be somehow be possible because PCan-View has no problem watching the bus while my application is running without interfering with it.
What I'm doing:
Any idea ?
I'm using the PCAN UDS successfully. Now I'm trying to additionally add a PCanBasic channel in listen-only mode to watch the actual CAN traffic on the bus.
However I am unable to initialize the PCanBasic channel after initializing the channel in the UDS API. I think it should be somehow be possible because PCan-View has no problem watching the bus while my application is running without interfering with it.
What I'm doing:
Code: Select all
// Successsfully initialize PCan-UDS APU on USBBUS1, 500kb, HwType 0
...
// Try to initialize a PCanBasic channel in listen-only mode
/* start CAN Basic listen only mode */
char strMsg[256];
uint8_t canParameter ;
canParameter = PCAN_PARAMETER_ON;
status = uds->CAN_SetValue(channel->udsChannel, PCAN_BITRATE_ADAPTING , &canParameter, sizeof(canParameter)); // 0x800 0000
uds->CAN_GetErrorText(status, 0, strMsg);
qInfo()<<strMsg; // An operation is not allowed due to the current configuration
canParameter = PCAN_PARAMETER_ON;
status = uds->CAN_SetValue(channel->udsChannel, PCAN_LISTEN_ONLY, &canParameter, sizeof(canParameter)); // 0x0
uds->CAN_GetErrorText(status, 0, strMsg);
qInfo()<<strMsg; // No Error
status = uds->CAN_Initialize(PCAN_USBBUS1, PCAN_BAUD_500K, 0, 0, 0);
uds->CAN_GetErrorText(status, 0, strMsg);
qInfo()<<strMsg; // A PCAN Channel has not been initialized yet or the initialization process has failed
Any idea ?