1
\$\begingroup\$

I'm using an I/K-Bus transceiver IC from Melexis.

This is the one which has collision detection and other functions that makes it easy to send and receive data from the bus.

The I/K Bus is a common bus used in BMWs starting from the early 2000s to control windows, doors, and receive their status (and much more).

It has a pin name "SEN/STA" which is a bidirectional pin used to detect and control the bus state. When you read this pin, it shows logic 0 when the bus is free, and logic 1 when it is busy (thus you should not start sending your message). When you write to this pin, you can disable the "transmission path" (logic 1), or you can force it to be free (logic 0).

Although the chip has a lot of cool features I'm not able to use it to transmit any single message onto the bus.

My schematics is here (tried with the SEN/STA wire removed too):

TH3122_to_USB

Here is a scope image of the TX coming from the serial port (yellow), and the BUS line (purple). You can see that the IC tries to start the transmission on the BUS line, but immediately stops it.

Enter image description here

Here is a scope image of the SEN/STA pin (yellow) and the BUS (purple): You can see that the SEN/STA goes up during the requested transmission which is okay, but it should NOT stop the current transmission. It seems the IC thinks the BUS is busy and stops its transmission!

Enter image description here

Here is a scope image of the SEN/STA pin (yellow) vs. serial TTL TX pin (purple): You can see the SEN/STA is high during the transmission (a bit later the yellow line went down, similar to the picture above).

Enter image description here

I'm using PuTTY to send data at 9600 baud, 8N1. This is the specification for the I/K Bus.

I think the bus logic of the TH3122 is fine, however it should not disable its own transmission.

UPDATE1

Now I tried to force the SEN/STA to logic 0 during the TX. Here are my scope images for this:

BUS (yellow), TX (purple), you can see that transmission is disabled after each falling edge of the TX:

Enter image description here

BUS (yellow), SENSTA (purple), you can see SENSTA is controlled to be logic 0 for the whole transmission operation as marked on Figure 3 in the datasheet:

Enter image description here

\$\endgroup\$
5
  • \$\begingroup\$ Have you checked for shorts in your circuit? If you look at the last scope screenshot, you can see that the purple trace (TX) is being modulated onto the yellow trace (SEN/STA). This makes me think there is some form of short or wiring mistake. \$\endgroup\$ – Tom Carpenter Jul 29 '18 at 15:59
  • \$\begingroup\$ Yepp, saw that too, but have no idea why. Shorts are not really possible, this IC is mounted onto a breakout board, and it needs only 4 discreet components. However where shall I check the shorts, what do you think? \$\endgroup\$ – Daniel Jul 29 '18 at 16:11
  • 1
    \$\begingroup\$ It may not be a short actually - in those screenshots STA is acting as an output. It might be a power supply issue - lack of decoupling capacitors can cause problems like that. Try probing the VCC pin with the scope during transmit and see if it has the same noise floating on it. If so, try adding a 100nF capacitor to between VS and GND and another between VCC and GND. \$\endgroup\$ – Tom Carpenter Jul 29 '18 at 16:17
  • \$\begingroup\$ Why is this tagged with CAN (bus)? This question doesn't seem to have anything CAN bus related. \$\endgroup\$ – Peter Mortensen Jul 30 '18 at 17:11
  • \$\begingroup\$ Unfortunately, there is no K or I-Bus tag. I did not have enough reputation to add a new custom tag, that's why I choose CAN, because it is at least automotive-related. Sorry for that. \$\endgroup\$ – Daniel Jul 30 '18 at 19:03
1
\$\begingroup\$

You should force SEN/STA to 0 in order to transmit, as the datasheet clearly indicates.

Also, see the "Constant Low Switch Off" description. It means that your TX line should not be held low for more than 3 ms. If your protocol needs to transmit "0" for longer than that, you have to insert short "1" pulses periodically to prevent the transmission from being disabled.

UPDATE

I am looking at the documentation, and I have no idea how this wiring can work at all. If you have any links to the K-Bus specification it would be helpful.

The problem is, the output driver is a PNP open emitter. So, without pull-up all you can hope to get is a short spike on the input capacitor, exactly what you see on your scope. At least now you are getting those spikes on each TX pulse, and there is not any "blocking" as in the title.

From some obscure references there should be +12 V on the bus in idle state. Do you have that? I guess if you were to connect to a real BMW bus it would be pulled up somewhere by the car. If you do the experiments on your desk then you have to do it yourself. I don't believe the leakage current from the transistor base to emitter could possibly drive the entire bus up, unless you have a dozen devices connected to the bus simultaneously.

Here is the circuit according to documentation, including driver stage of TH3122:

Enter image description here

UPDATE 2

Here is tiny bit of information found here: "network load: power-up resistors in Master and Power-up modules". This confirms my guesses above - you need to either test your adapter while connected to actual bus, or you need a 1 kΩ pull-up resistor on a bus to test standalone chip operation.

UPDATE 3

The internal 5V regulator not only outputs power for MCU, but also supplies chip logic and I/O circuits. So, it has to be enabled for proper operation. It requires all the capacitors as per "Figure 8 - Application Circuit" in the datasheet.

The EN pin can be permanently connected to VS or it can be controlled by MCU after MCU has been woken up by bus traffic.

\$\endgroup\$
14
  • \$\begingroup\$ I tried to short SEN/STA manually to GND (with a wire), but the situation was not get much better. Only I get spikes on the bus at every falling edge of the TTL TX. (you can check the first scope image, there only the very first falling edge causes a spike on the BUS. When SENSTA is shorted to GND, every falling edge does the same) \$\endgroup\$ – Daniel Jul 28 '18 at 18:43
  • \$\begingroup\$ I don't see a scope image with SEN/STA permanently connected to GND during entire transmission, as it supposed to be. See Figure 3 in datasheet. If you can show the same but with bus behaving differently then there is a problem. \$\endgroup\$ – Maple Jul 28 '18 at 18:48
  • \$\begingroup\$ The problem is I use an FTDI USB serial interface and none of its pins seems to give me GND during the whole tx. Do you think I need to build a very custom board to reach this? (I currently don't have that particular scope image that's why I illustrated textual) \$\endgroup\$ – Daniel Jul 28 '18 at 18:57
  • \$\begingroup\$ CP2102 is not an FTDI chip. Furthermore, I have no idea what that "CTS/RTS" pin means. These two are separate signals. Unless you can provide stable SEN/STA to ground during entire transmission you cannot expect TH3122 to work. You can try Br@y terminal instead of PuTTY as it allows manual control over DTR and RTS signals. \$\endgroup\$ – Maple Jul 28 '18 at 19:12
  • 1
    \$\begingroup\$ What do you think powers I/O circuits and other logic? "If VCC < 3.15V the bus driver is tristate". Tx and other output pins also cease to function. You need all those capacitors on Figure 8 in datasheet and you need EN connected. Note that voltage regulator is also powered up by bus activity, so there is a chance this can work when connected to vehicle with EN disconnected. But why would you do that? It's not like your application has to worry about power savings. \$\endgroup\$ – Maple Jul 31 '18 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.