-
Notifications
You must be signed in to change notification settings - Fork 72
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
esp32 with OBD9141 not work #45
Comments
Do you know which protocol was used by that library? What library was it? If you have something that works, why switch? :) Did you also try the readerKWP? Fast kwp init and slow kwp init are different, I don't know what you ECU uses to communicate, but you showed 9141-2 init with the slow 5 baud and initKWPSlow not working, might as well try the third and final handshake this library supports. You can also enable the debug prints by uncommenting this line. |
Hi. |
This library is also synchronous though, so it will also block your main program until the data comes back from the ECU. You will likely have the same experience.
Ah, 252 is You could also put print statements in the libraries that are working, to see how their handhake works. |
Thanks for your time. |
Certainly, I've used that chip myself with this library.
Looks like just nothing comes back. Tricky! I'd try to record a working handshake with one of the other libraries with a logic analyser, or even just print statements, that way there's something to compare against. |
Hi again. this is what one of library had on serial/debug
and sync code is aproximatly the same with your obd9141.cpp pinMode( txPin, OUTPUT ); // Set the txPin to idle HIGH
delay( 2000 ); // Leave Tx HIGH for 2 seconds before starting the actual init routine
Serial.println( F( "Starting Init" ) );
// Send 0x33 (LSB first) via K-Line to the OBD port (0x33 is address of OBD)
digitalWrite( txPin, LOW ); // start bit
delay( 200 ); // 5 baud means 200ms per bit
digitalWrite( txPin, HIGH ); //11
delay( 400 );
digitalWrite( txPin, LOW ); //00
delay( 400 );
digitalWrite( txPin, HIGH ); //11
delay( 400 );
digitalWrite( txPin, LOW ); //00
delay( 400 );
digitalWrite( txPin, HIGH ); // stop bit
delay( 200 );
mc33290.begin(10400, SERIAL_8N1 , 16 ,17) ; //mc33290 is a hardware serial defined
if( mc33290.available()){
sync =mc33290.read();
//DEBUG
snprintf_P( buffer, BUFLEN, PSTR("SYNC Byte: %2X"), sync );
Serial.println( buffer );
// Continue Init if we got the correct SYNC Byte
if( sync == 0x55 ) {
....} What is strange if i put a debug in your library in function BEGIN
i receive it set port with 0 , but i send from sketch
|
Thanks for sharing code and prints. I put some backticks (`) in your comment to create code blocks to make it more readable.
I don't think that print the serial ports' id, I think instead it will try to read a byte from the serial port and print that. But this one:
that looks like a difference from my library, I don't pass the pin numbers, but it looks like they vary between We can certainly pass these pin numbers, I put up a change with 1d07f97 on the issue-45-esp32-serial-port branch, could you give that a go? I obviously can't test this, but if you are indeed on an esp32s3 board, this could fix it. |
Hi and excuse my late answer. I'm not at home and i can verify only after one week because i'm in hollyday. My esp32 is a wroomer 32 u with 32 pinds i't must doesn't matter witch pins used tge serial port because i configured in sketch at the begin line on other pins.and it mjst work. The problem is from other parts, and we will see. Thanks and keep in touch. |
Hi. I arrived at home and i tested the new version of your library. How can we see if the serial2 is correct init? |
Not sure if there's any way... :/ Start by putting a print here to print the pin numbers that are being set, that also confirms the |
YES, enter in that ESP_ARDUINO_VERSION_MAJOR |
Hmm, well, the ECU is clearly not talking back. The first read isn't even If you have a second arduino & transceiver chip, you can try to listen in on the communication performed on the K-line by just hooking up the Rx and opening a serial port at 10400 baud, that way you should be able to see what the other library sends on the bus and what this one sends. It also allows ruling out eletrical issues. |
Yes it is exactly the same. If i upliad thst library over yours in my esp32 it works.. |
HI again. I made teste and tests..... reader_esp32 not work, i receive first byte every time 0. STRANGE what is next:
} void OBD9141::set_port(bool enabled){
} AND , AND i received this.....what is ok for KWP 17:16:19.124 -> Before magic 5 baud. // these two should be identical according to the spec. //here never arrived 17:26:20.798 -> Before magic 5 baud. |
Hmm, looks like you're on the right track, things are coming back now. In Try just disabling this check by setting |
it is setted to false, not enter in that check, after that check is a problem, if i put a debug (print) funtion ....the program stopped |
Well, if the program suddenly stops if you put a print statement somewhere... I think there are other problems in your program / setup. Not much I can do to help with that though. |
It is not from the sketch, it is something inside the library.. If you see first post from yesterday, something is strange. These OBD9141println("") added in OBD9141.begin and OBD9141.set_port add some delay and like i said with them added in the code i can receive good response with KWPSlow. |
What happens if you replace that with a |
HI IWANDERS.
I tried from 2 days to make it works but without succes!
I use esp32 wroomer 32U and a mc33290. Witrh this setup i had other library witch work at the same pinrx 16 and tx 17. For mc33290 i used a resistor 500k between 12v and k-line. I work with ECU me7.5.
If i use reader esp32 with INIT i receive :
16:17:43.716 -> Before magic 5 baud.
16:17:45.697 -> Before setting port.
16:17:45.732 -> After setting port.
16:17:45.732 -> First read is: 252
16:17:45.797 -> Timeout on reading bytes.
16:17:45.929 -> Timeout on reading bytes.
16:17:46.027 -> Timeout on reading bytes.
16:17:46.027 ->
If i tried to use INITKWPSlow
16:29:55.011 -> initialization
16:29:55.011 ->
16:29:58.026 -> Before 25 ms / 25 ms startup.
16:29:58.091 -> Enable port.
16:29:58.418 ->
16:29:58.646 ->
Please waiting your advices.
Many thanks.
The text was updated successfully, but these errors were encountered: