Building my own digital WBO2-CAN Adapter - help?
Because I like to tinker and it doesn't seem all that complicated, and I want smooth closed loop fueling goodness, I've embarked on building my own adapter to take the LC2 digital output and feed it to my MS3 basic over CAN. I am using a Teensy 3.1 micro controller (think arduino on steroids, has a built in CAN controller), and I have a max3232 serial to UART bridge. However I cannot seem to read any messages coming from the LC2 on the Teensy, through the max3232. Does anyone know if it follows normal RS232 protocol? I can read LC2 messages on my laptop in realterm, and I can send messages at the same baud rate to my teensy from realterm. But I can't read messages on the teensy from the LC2.
In summary, this works: realterm (set to 19200,8n1) --> usb/rs232 adapter -> max3232 -> teensy --> serial monitor and this works: serial monitor --> teensy --> max3232 --> usb/rs232 adapter --> realterm (set to 19200, 8n1) and this works: wideband lc2 --> usb/rs232 adapter -> realterm (set to 19200, 8n1) but this doesn't: wideband lc2 --> max3232 --> teensy --> serial monitor I'm not getting any messages whatsoever on the Teensy, not even some garbled mess suggesting that it's a translation issue. The only thing I can think of is that the LC2 doesn't actually use RS232. But I don't have a scope to check the TX voltage (I don't want to fry my microcontroller) Hoping someone who's embarked on something similar can shed some light. Thanks! |
Code is simple. Read from one, send to other. Serial is the serial monitor on my laptop. Serial1 is wired into the MAX3232.
Code:
#define HWSERIAL Serial1 |
I've attempted doing my own LC2 display using serial communication with the intent of eventually output the data to the MS3 via CANbus. I was able to read the LC2 serial data into an Arduino. However, I was not able to decipher the data. It did not seem to match their documentation at all. I eventually just gave up.
There was another thread of someone else working on a similar project but I can't find it at the moment. |
Originally Posted by cyotani
(Post 1339548)
I've attempted doing my own LC2 display using serial communication with the intent of eventually output the data to the MS3 via CANbus. I was able to read the LC2 serial data into an Arduino. However, I was not able to decipher the data. It did not seem to match their documentation at all. I eventually just gave up.
There was another thread of someone else working on a similar project but I can't find it at the moment. |
I wouldn't be surprised if the LC2 is outputting TTL levels instead of RS232 ones -- do you know if the 3232 will accept those?
I'm using Reverant's LC2-to-CANbus adapter in my car, I'll see if I can stick the scope on it and capture the data. --Ian |
Originally Posted by codrus
(Post 1339554)
I wouldn't be surprised if the LC2 is outputting TTL levels instead of RS232 ones -- do you know if the 3232 will accept those?
I'm using Reverant's LC2-to-CANbus adapter in my car, I'll see if I can stick the scope on it and capture the data. --Ian I'd appreciate that. Like I said, I could just plug it into my Teensy but if I'm wrong and the lc2 is spitting out over 5v then it's toast. |
I'm pretty sure I had an LC-1 hooked up straight to an Arduino using TTL-Level and reading the output. Was a few years ago though and memory is weak...
|
Got it working. It looks like the male to male db9 connector I used was not properly mapping the pins out to the other side. Hooking them up manually got me going. Successfully reading AFR values, as well as the LC-2 status (warming up, errors, etc).
So for the record, it is RS232 and you can read it with a MAX3232. Next step is hooking up the CAN side and trying to read/send messages. Woop. |
I got it working - my male to male serial adapter was screwing things up. Connected the TX and gnd db9 pins directly and now it's good. And the code that I found/modified to interpret the lc1 packets works as well - reads the status packet accurately and shows the afr. Next step is to get it CAN communications going.
|
these snippets might help.. fair warning, I haven't touched this code in a little over 2 years.
Code:
void LC1::get_AFR() { Code:
void MSRequest(byte block, unsigned int offset, byte req_bytes) { |
Originally Posted by gooflophaze
(Post 1341208)
these snippets might help.. fair warning, I haven't touched this code in a little over 2 years.
Code:
void LC1::get_AFR() { Code:
void MSRequest(byte block, unsigned int offset, byte req_bytes) { I still need to figure out why the EGO request packets from my megasquirt are reporting 597 and 605 for myvaroffset. |
MS's request code is kinda stupid (at least it was 2 years ago). It spams the bus. You can write directly to the block:offset if you can find it in the .ini. Values are persistent until overwritten - so you don't have to write the AFR every millisecond, just whenever a new LC1 packet arrives. This is where LC1's averaging/instant settings become interesting.
|
Originally Posted by gooflophaze
(Post 1342279)
MS's request code is kinda stupid (at least it was 2 years ago). It spams the bus. You can write directly to the block:offset if you can find it in the .ini. Values are persistent until overwritten - so you don't have to write the AFR every millisecond, just whenever a new LC1 packet arrives. This is where LC1's averaging/instant settings become interesting.
I also got the 29bit request/response working to display data on a gauge of some sort. Now to work on the hardware part (which I'm not as good at). |
All times are GMT -4. The time now is 07:56 AM. |
© 2024 MH Sub I, LLC dba Internet Brands