Page 1 of 1

Listen-only mode when using UDS API

Posted: Tue 18. Feb 2020, 12:16
by MaxenceD
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:

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 ?

Re: Listen-only mode when using UDS API

Posted: Tue 18. Feb 2020, 14:44
by PEAK-Support
With the PCAN-Basic API only one Application could communicate with a CAN Channel. If you use a UDS Session, this is the only availbale Session - UDS is based on ISO-TP which is based on PCAN-Basic Layer 2 API.
see here: http://www.peak-system.com/fileadmin/im ... Is_DEU.png
You should use PCAN-View to sniff your communication - the PCAN-View could connect to a existing PCAN-Basic Session.