So, I've managed to get some cables on the car and route the K-line control signals from the OBD adapter to the dashboard. This way I can drive and look at the display without loosing sight of the road!!! Drive safely!! :)
Then I hit the road and all was fine. An occasional reconnection here and there but all seems ok.
But then I entered the highway and everything went crazy! I noticed that after 90Km/h the OBD seems to stop responding.
When I come back under 90 it reconnects and everything is ok.
The code is not very optimized because I read the OBD values (3 blocks) and then I update the display and also read the temperature sensor and also update the display with that. This takes around 130+90=220ms. From what I've seen using the VAG-COM software on the laptop and capturing the control signal, when the software is idling it sends ACK frames back and forth to the ECU. So this 220ms might be too long between communications and the ECU might drop the connection. Still have to investigate further...
But I'm planning to add a ESP8266 to be in charge of the display control and leave the STM32 only with the OBD tasks. This way I can leave it reading the blocks at max speed and reporting them to the ESP through RS232 and leave it to display the data.
More to come...