PCAN UDS Api Python - Read problem

A free API for the communication with control devices according to UDS (ISO 14229-1)
Locked
nankuniyil
Posts: 1
Joined: Fri 9. Jun 2023, 11:19

PCAN UDS Api Python - Read problem

Post by nankuniyil » Fri 9. Jun 2023, 12:45

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)

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: PCAN UDS Api Python - Read problem

Post by PEAK-Support » Fri 9. Jun 2023, 14:09

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

K.Wagner
Software Development
Software Development
Posts: 1082
Joined: Wed 22. Sep 2010, 13:36

Re: PCAN UDS Api Python - Read problem

Post by K.Wagner » Tue 13. Jun 2023, 09:46

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 2602 times
The samples can be found within the samples.zip file that comes with the PCAN-UDS package, in the “samples” folder.

Closed.
Best regards,
Keneth

Locked