Esp32 10400 baudrate issue

Hello, i am using esp32 hardware serial to comunicate with car ecu via kline adapter, problem is i need specific baudrate of 10400. Its not working using
"Serial1.begin(10400, SERIAL_8N1, 22, 23)"
But if i use Esp softwareserial library its working, with the same pins
softSerial.begin(10400, EspSoftwareSerial::SWSERIAL_8N1, 22, 23)"
i found 5 year old issue wit this in github HardwareSerial incorrect timing with non standard baudrate · Issue #2004 · espressif/arduino-esp32 · GitHub

Can someone help me what i need to configure to work with this baudrate?

If the hardware baudrate generator can not provide a usable frequency then you are bound to use a software Serial.

Have you already tried the standard 9600 baudrate instead of 10400?

i am limited to 10400 because its coded in ecu side. Softwareserial somehow always at receiving data from ecu returns at beginning last byte of my request data. like this. even after Serial.flush() after tx.

TX to ECU: 81 12 F3 81 7
RX from ECU : 7 83 F3 12 C1 EF 8F C7

without Serial.flush() usage i am getting
TX to ECU: 81 12 F3 81 7
RX from ECU : 81 12 F3 81 7 83 F3 12 C1 EF 8F C7

Try 9600 or I'm out.

ok 9600

REQUEST: 81 12 F3 81 7
ECU ANSWER: 7

there is no answer because ecu baud rate is 10400, its standard transmission rate for kwp2000.

Ah, a marketing thing :frowning:

ok figured it out. I made few mistakes. I declared UART pins as input and output after "Serial1.begin(10400, SERIAL_8N1, 22, 23)", i need this because there is specific startup sequence before comunication with ecu for tx pin HIGH 25ms and LOW 25ms. So correct way for esp32 is declare pins and do startup sequence request before calling Serial1.begin. So everything works ok with 10400 baudrate.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.