Page 1 of 1

PCAN UDS Api Python - Read problem

Posted: Fri 9. Jun 2023, 12:45
by nankuniyil
Hello all,

I'm trying to use PCAN-UDS API 2013 (ISO 14229-1:2013) to read values from my BMS controller.
I'm able to initialize the UDS object (code is given below) but I'm not able to understand how to define the request format to put in the read function.

How should I write my request format in the read function to read values stored at id 100?
Should I call any other PCAN UDS functions (like SvcDiagnosticSessionControl_2013) before the read function?

Code: Select all

pcanObj= PCAN_UDS_2013()
request = uds_msg()
response = uds_msg()
status = pcanObj.Initialize_2013(PCAN_USBBUS1,PCANTP_BAUDRATE_500K,0,0,0) # returning PUDS_STATUS_OK as success on execution
if pcanObj.StatusIsOk_2013(status, PUDS_STATUS_OK, True):
    print("Initialized")
    try:
        read_status = pcanObj.Read_2013(channel,response,request, None)
        if pcanObj.StatusIsOk_2013(read_status, PUDS_STATUS_OK, False):
            print("Read error")
    except Exception as e:
        print("Exception")
        print(e)

    pcanObj.Reset_2013(channel)
    pcanObj.Uninitialize_2013(channel)

Re: PCAN UDS Api Python - Read problem

Posted: Fri 9. Jun 2023, 14:09
by PEAK-Support
As the UDS Software Protocol is not a PEAK-System build solution, you need to study the USD Protocol Definition how to use the protocol.
As we d not know if you use our Hardware, you need to contact us by e-mail with more information (we do only B2B) so that we could help you.
support[at]peak-system.com

Re: PCAN UDS Api Python - Read problem

Posted: Tue 13. Jun 2023, 09:46
by K.Wagner
Hello,

This has already been answered by email. For completeness, here are the answers to the questions:
nankuniyil wrote:
Fri 9. Jun 2023, 12:45
How should I write my request format in the read function to read values stored at id 100?
As its name suggest, the read function “Read_2013” is intended to read data. It cannot write anything. The request has to be sent with Write_2013, or using any of the UDS_Svc.... functions.
nankuniyil wrote:
Fri 9. Jun 2023, 12:45
Should I call any other PCAN UDS functions (like SvcDiagnosticSessionControl_2013) before the read function?
This depends on what you are doing, how your device is configured, what does it expect to receive, and in which state. Please note that, as my colleague Uwe Wilhelm mentioned in the forum, we do not offer support on the UDS protocol itself.

Please check the python samples, in special the sample 07_read_write_uds, to see how you can send a request and read a response using a custom CAN-ID, which seems to be that what you want to do. Here a list of the current available examples:
Current available Python examples
Current available Python examples
Samples-Python.PNG (11.59 KiB) Viewed 2604 times
The samples can be found within the samples.zip file that comes with the PCAN-UDS package, in the “samples” folder.

Closed.