Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change OBD protocol #240

Closed
reflexsa opened this issue Apr 9, 2024 · 5 comments
Closed

How to change OBD protocol #240

reflexsa opened this issue Apr 9, 2024 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@reflexsa
Copy link

reflexsa commented Apr 9, 2024

Firstly thanks for this, it was exactly what I was searching for.
I just wanted to ask how/where do I change the OBD protocol? I need to select "const char ISO_15765_11_BIT_500_KBAUD = '6';" to work reliably with my vehicle.
Apologies for the silly question!

@reflexsa reflexsa added the question Further information is requested label Apr 9, 2024
@PowerBroker2
Copy link
Owner

The elm should automatically find and use the best protocol, but if you want to specify it yourself, you can do so in the begin() function:

/*
bool ELM327::begin(Stream &stream, const bool& debug, const uint16_t& timeout, const char& protocol, const uint16_t& payloadLen, const byte& dataTimeout)
Description:
------------
* Constructor for the ELM327 Class; initializes ELM327
Inputs:
-------
* Stream &stream - Reference to Serial port connected to ELM327
* bool debug - Specify whether or not to print debug statements to "Serial"
* uint16_t timeout - Time in ms to wait for a query response
* char protocol - Protocol ID to specify the ELM327 to communicate with the ECU over
* uint16_t payloadLen - Maximum number of bytes expected to be returned by the ELM327 after a query
* byte dataTimeout - Number of ms to wait after receiving data before the ELM327 will
return the data - see https://www.elmelectronics.com/help/obd/tips/#UnderstandingOBD
Return:
-------
* bool - Whether or not the ELM327 was properly initialized
*/
bool ELM327::begin(Stream &stream, const bool &debug, const uint16_t &timeout, const char &protocol, const uint16_t &payloadLen, const byte &dataTimeout)

@reflexsa
Copy link
Author

reflexsa commented Apr 10, 2024

Thank you. For some reason when using my adapter with Torque for example I will get an 'engine check light' unless I specify the protocol. The actual error is communication to the gearbox so it seems that is somehow interfered with.
So would I just change the "const char &protocol" to 6 in the below?
bool ELM327::begin(Stream &stream, const bool &debug, const uint16_t &timeout, const char &protocol, const uint16_t &payloadLen, const byte &dataTimeout)

to:
bool ELM327::begin(Stream &stream, const bool &debug, const uint16_t &timeout, 6, const uint16_t &payloadLen, const byte &dataTimeout)

@PowerBroker2
Copy link
Owner

PowerBroker2 commented Apr 11, 2024

You would have to add the argument in the sketch kind of like this:

myELM327.begin(ELM_PORT, true, 2000, ISO_15765_11_BIT_500_KBAUD);

@reflexsa
Copy link
Author

reflexsa commented Apr 11, 2024

Thank you. I see, that does make sense. I'm hoping this will resolve my other issue where I just have a recurring response after the initial AT commands #241

@jimwhitelaw
Copy link
Collaborator

Fixed in version 3.3.0.

@jimwhitelaw jimwhitelaw pinned this issue Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants