Listen-only mode when using UDS API

The free CAN Software API (Application Programming Interface) for Windows®
Post Reply
MaxenceD
Posts: 8
Joined: Fri 14. Feb 2020, 11:21

Listen-only mode when using UDS API

Post by MaxenceD » 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:

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 ?

User avatar
U.Wilhelm
Sales & Support
Sales & Support
Posts: 1198
Joined: Fri 10. Sep 2010, 19:34

Re: Listen-only mode when using UDS API

Post by U.Wilhelm » Tue 18. Feb 2020, 14:44

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.
--------------------------------
PEAK-System Technik
Technical Support Team
support@peak-system.com
-------------------------------

Post Reply