Shamtam / PyJ2534

A complete J2534 Pass-Thru DLL wrapper implementation
GNU Affero General Public License v3.0
11 stars 3 forks source link

ERR_INVALID_MSG #2

Closed jackmerker13 closed 5 months ago

jackmerker13 commented 5 months ago

I am trying to apply the PyJ2534 to PCANPT32.dll. I am having difficulty creating a message to write to my device. The device uses ISO15765 protocol. I use the following line: message = PyJ2534.PASSTHRU_MSG(PyJ2534.ProtocolID.ISO15765,PyJ2534.TxFlags.TX_NORMAL_TRANSMIT, b'\x01\x02\x03') When I try to write the message via PassThruWriteMsgs, I get ERR_INVALID_MSG. When i print out the message details for debugging, the protocolID is 6, which is correct, but the DataField is empty.

Not sure of the correct syntax to use for creating valid messages.

Shamtam commented 5 months ago

Pass your binary data to the data keyword argument:

PyJ2534.PASSTHRU_MSG(PyJ2534.ProtocolID.ISO15765,PyJ2534.TxFlags.TX_NORMAL_TRANSMIT, data=b'\x01\x02\x03')

jackmerker13 commented 5 months ago

Thank you for the quick response. Unfortunately I have tried this, and still receive the Invalid message error.

Shamtam commented 5 months ago

https://github.com/Shamtam/PyRRhic/tree/main/pyrrhic/comms/phy

Have a look here for examples. I don't have examples for CAN at the moment, but I've done it before.

Shamtam commented 5 months ago

I suspect you need to add the appropriate ISO15765 flags to make this work, but I don't know your specific application

jackmerker13 commented 5 months ago

Thank you for the assistance, I am working on setting the message up according to the J2534 documentation, for my specific application.

Shamtam commented 5 months ago

https://web.archive.org/web/20150104103545/http://subdiesel.wordpress.com/generic/protocols/ssm2-via-can/

https://web.archive.org/web/20150104082849/http://subdiesel.wordpress.com/2011/05/01/manual-iso15765-connection-tutorial/

This may be a useful reference

jackmerker13 commented 5 months ago

I have solved the issue, thanks for the support! :)