-
Potential Tuner
PWM J1850 with OKI MSM6636
I'm having problems how to properly use OKI MSM6636 API that is used for J1850 PWM communication.
MSM6636 has one receive buffer and receive register. In OKI documentation is not clearly described how/when the received bytes are move to the received register.
The problem is that on every transmitted request the length of received data is always 1 (retrieved from register 0x20). What is the right procedure to retrieve the proper length of data inside the register.
For example if I like to send legislated OBD request:
61 6A F1 01 00
I set the OKI registers as described in document (with proper values in mode register 0x2A (value 0x83), and source register 0x2B (value 0xF1)
(OKI register = value)
0x2A = 0x83 mode
0x2B = 0xF1 source
0x00 = 0x61 communication type
0x01 = 0x6A functional/physical addressing type
0x03 = 0x01 data 1
0x04 = 0x00 data 2
0x13 = 0x05 transmit 5 bytes (3 byte header + 2 data)
The result is response with 1 byte length, the values in registers are
0x15 = 0x10
0x16 = 0x6A
0x17 = 0xF1
0x18 = 0x01
but with retransmitting the request (with register 0x13)
almost the correct response is received but the length is sill the size of one.
0x15 = 0x10
0x16 = 0x6A <-- it should be 0x6B
0x17 = 0x10
0x18 = 0x41
0x19 = 0x00
0x1A = 0xE8
0x1B = 0x19
0x1C = 0x30
0x1D = 0x46
0x1E = 0xF6
Also maybe i'm messing something with IFR types.
I will apprisiate any help or direction.
-
Potential Tuner
.. answer to myself
Problem fixed. There was a problem with interrupt handling time-gap. The host CPU periphery was set too slow; so OKI and SPI interaction also. The answer from the ECU was missed and the next IFR was read instead of the previous received answer.