Serial port: how to software control a line output to "emulate" RTS

Posted by: DJZorro

Serial port: how to software control a line output to "emulate" RTS - 08/12/2004 14:08

Hello guys!

I'm in the middle of a project to emulate an I-BUS (BMW's owm protocol) cd-changer using an empeg: the software is 80% done (working on my laptop), and I now need to port it to the empeg (with the help of a chrooted Debian Potato installation).

One of my greatest issues is to get a line output like RTS to control collision-detection ciruit of the I-BUS interface: nothing too fancy, just a way to turn on/off any logic output would be ok.. I will adapt the voltage if needed.

Any of you have any tips? Please help an empeg customer to enjoy his music inside a car without a DIN adapter

This project, when finished, will be published on the web with all relevant software released under GPL.
Posted by: JBjorgen

Re: Serial port: how to software control a line output to "emulate" R - 08/12/2004 14:26

I can't really help you out, but just wanted to say that that sounds like a really cool project. I'll be interested to see how it turns out.
Posted by: mdavey

Re: Serial port: how to software control a line output to "emulate" RTS - 08/12/2004 16:32

Quote:
One of my greatest issues is to get a line output like RTS ... just a way to turn on/off any logic output.


Which serial port plug will you be using? The one on the harness or the one on the back of the Empeg?

If harness, you are going to find it mightily tricky. If you are a programming God and don't care to have a tuner, I guess it might just be possible to encourage the DSP to drive one of the tuner lines how you need - I don't know in which direction they are normally driven. Of course, there is also the TD and RD for the other serial port on the tuner connector.

If socket on the Empeg, things might be a little easier. The DTR line (pin 4) on this socket is connected to GPIO23 on the StrongArm, so it should be possible to twiddle the GP and cause the pin to go high/low. I say should, as I attempted to do just that in Hijack only to have the pin revert to its previous state shortly after. It is as if something else in the kernel is reverting the state. I haven't had a chance to investigate further (other than to grep the entire source for any references to that GP).

It may be that other lines (besides DTR) are also connected on this socket.
Posted by: DJZorro

Re: Serial port: how to software control a line output to "emulate" R - 08/12/2004 17:18

Any serial (internal/external) will do: also, as the BMW dashboard already have a radio, I no more need the empeg external tuner (maybe I will sell on ebay one time.. )

BTW: What ttyS device uses the radio? Is the pinout available?
If you (or other guys) can give me a clear path to drive a digital signal out of the empeg, you will make my day
Posted by: Shonky

Re: Serial port: how to software control a line output to "emulate" R - 08/12/2004 19:26

I can't help immediately with your digital output requirement, but I will be very interested in this. I have just bought an E36 M3 which as I understand it has an Ibus CD changer. If I could control the empeg with the standard radio that would be cool since I'm loathe to start hacking away at the dash of my $50k car.

I assume you have an E46 (3 series) or E39/34 (5 series)? Are you getting track titles etc on the head unit/on board computer? I don't think this will be possible with my E36 but I will be investigating.

What do you actually need the digital output for? As I understand it Ibus is merely 9600 baud async serial.
Edit: I see why now. I wasn't aware of this requirement in Ibus.
Posted by: DJZorro

Re: Serial port: how to software control a line output to "emulate" R - 08/12/2004 20:15

Hello Shonky, yes newer E36 should have I-BUS and some version of BMW car-audio: my E46 (3-series, of course) have the 4:3 LCD for navigation, on-board computer, radio tuning and so on.

Unlike what has been done with Phatbox (that's a rather "simply" design with just basic CD-changer interface made by 3rd party company and no text display), I want to use my Empeg for better performances, integration & technical excellence.

I just have to code a daemon to "drive" (via I-BUS) the present player software (that works just fine) exploiting excellent Hijack kernel features.

I hope someone can give help to sortout how to get an additional output gate.

BTW: Anyone has disassembled the firmware in TV module? Reverse engineering of the module will be the project following this one I hope to finish soon.
Posted by: mdavey

Re: Serial port: how to software control a line output to "emulate" R - 08/12/2004 20:59

Quote:
BTW: What ttyS device uses the radio?


ttyS0 Tuner
ttyS1 Rear & Sled
ttyS2 IrDA

Quote:
Is the pinout available?


Of the serial port on the rear? No. The best I can do is the pinout of the sled wiring harness:

http://www.riocar.org/modules.php?op=mod...;faqent=259#259

plus the actual identities of the tuner wires - pages 22 and 23 of this document:

http://www.reality.pwp.blueyonder.co.uk/manual.pdf

The conclusion of a recent discussion on the BBS was that the TD and RD lines on the sled connector are the opposite way around to those on the rear connector. Don't assume things about what signals are present on which pins - you could be in for a nasty surprise.
Posted by: mdavey

Re: Serial port: how to software control a line output to "emulate" R - 08/12/2004 21:04

Also, the tuner connector wires are unbuffered TTL - try to pull too much current or short them out and you could cripple your Empeg.
Posted by: Shonky

Re: Serial port: how to software control a line output to "emulate" R - 08/12/2004 21:52

Only thing I can think of so far for an output is the power antenna wire of the tuner. That's a fair waste though and even then it's speed of switching mightn't be good enough. You really need a direct IO from the CPU for this to work properly I would say.

I think the tuner interface is the best option for a possible digital output. As I don't intend to remove the factory headunit, I won't require a tuner anyway.
Posted by: DJZorro

Re: Serial port: how to software control a line output to "emulate" R - 08/12/2004 22:11

Thank you a lot mdavey: do you know if GPIO_GPIO24 is really wired (on serial port on the rear) to RTS according to empegcar.h?

Also what's the meaning and the levels of "level" and "signal" signals on the radio module?
Posted by: mdavey

Re: Serial port: how to software control a line output to "emulate" R - 08/12/2004 23:28

Quote:
Thank you a lot mdavey: do you know if GPIO_GPIO24 is really wired (on serial port on the rear) to RTS according to empegcar.h?


I don't know.

Quote:
Also what's the meaning and the levels of "level" and "signal" signals on the radio module?


I'd guess that "level" is either analogue or BCD from the tuner to the DSP to indicate the signal strength so that the DSP can do automatic fine tuning / drift correction and automatic gain control. I'd further guess that "signal" is a serial stream from the tuner to the DSP, containing the FM multiplex - being a combination of the RDS, left and right channels.

This is all pure guess work, however. You'll have to wait until pca reads and replies to this thread to be sure.
Posted by: Shonky

Re: Serial port: how to software control a line output to "emulate" R - 08/12/2004 23:36

I think that's pretty right. I think the level line is merely an analogue signal representing signal strength.

The signal line is as mdavey said, the FM multiplex signal to the DSP which then splits it up to left, right and RDS. Not sure where AM fits in there though.
Posted by: genixia

Re: Serial port: how to software control a line output to "emulate" R - 09/12/2004 05:40

If you're willing to hack your empeg, trace the microphone wire through the docking connector, and snip it carefully on the internal harness. I'd advise not snipping too close to either connector so that you could resplice it later if need be. Patch the wire to an appropriate internal connection. Someone has already suggested a GPIO. Carefully remove the microphone wire from the harness and replace the appropriate pin with one wired for your use. All at your own risk of course.

The player's serial port is DCE so that it can be connected with a null modem cable to a PC (which are usually DTE). The sled connector on the other hand is a modified DTE with only TX and RX brought out. Pin 4 (usually DCE Ready) has the amp remote line on it. This is 12V switched with the VFD screen - ie, if the VFD is on this is 12V. You cannot control this separately.
Posted by: Shonky

Re: Serial port: how to software control a line output to "emulate" R - 09/12/2004 05:51

Quote:
The player's serial port is DCE so that it can be connected with a null modem cable to a PC (which are usually DTE). The sled connector on the other hand is a modified DTE with only TX and RX brought out. Pin 4 (usually DCE Ready) has the amp remote line on it. This is 12V switched with the VFD screen - ie, if the VFD is on this is 12V. You cannot control this separately.


Incorrect genixia. The built in serial port is DTE not DCE which is why you need the null modem. The sled serial port is a mixture of DTE and DCE. See here for reference.
Posted by: DJZorro

Re: Serial port: how to software control a line output to "emulate" R - 09/12/2004 08:31

Quote:
trace the microphone wire through the docking connector, and snip it carefully on the internal harness

This is really a cool idea as it's completly useless for my Empeg daily use.

Quote:
Someone has already suggested a GPIO.

Can you give me additional references of the right GPIO to use and where to find it (a snapshot with the pad location on the PCB would be fantastic )?
Posted by: mdavey

Re: Serial port: how to software control a line output to "emulate" R - 09/12/2004 12:11

Quote:
Can you give me additional references of the right GPIO to use and where to find it.


http://empegbbs.com/files/242954-serial-small.jpg
Sorry, had to push the compression really high and the resolution low to get it to upload to the BBS system.

GPIO23 is on pin 55 of the StrongArm. The top highlighted StrongArm pin on the photo is pin 53 (pin 1 is above the blue dot and they are numbered anticlockwise so pin 52 is the left-most pin on the top row, followed by 53 as the top-most pin on the left, pin 104: bottom-most pin on the left, pin 105: left-most pin on the bottom, pin 156: right-most pin on the bottom, pin 157: bottom-most pin on the right, and and finally pin 208: top-most pin on the right-hand row) [SA1100 datasheet, page 355 & 356].

From there, the signal goes to the MAX3241 (RS-232 transceiver chip) pin 13 and comes out on pin 10 [page 13 of the MAX3241 datasheet], then on to the 4420P-601 resistor array pin 13 and out on pin 8 [Bourns 4400P-series datasheet] and finally out on pin 4 of the on-board serial (D socket) connector.

However, you don't actually need to know this - you can just solder a wire to the back of the D socket. I'd strongly suggest working on getting the software working before doing anything to the hardware. You could simply plug a D plug into the socket temporarily while testing.

Many thanks to RobS for helping me figure out how this works, a few weeks ago.
Posted by: DJZorro

Re: Serial port: how to software control a line output to "emulate" R - 09/12/2004 13:36

Quote:
Many thanks to RobS for helping me figure out how this works, a few weeks ago.

Thank you very much mdavey!

Would be fantastic if RobS could clarify a bit also if the GPIO_GPIO24 is wired to RTS.. anyway I will try with this output, even if your findings about "auto-reverting" by some process in the kernel don't make me feel so good.. time to write some code!
Posted by: mdavey

Re: Serial port: how to software control - RTS - 09/12/2004 14:06

Quote:
... if GPIO_GPIO24 is wired to RTS...


Right, found my multimeter (burried under a pile of paper).

If I buzzed it out right, then it goes like this:

Out on StrongArm pin 54 (GPIO24), in on MAX3241 pin 12 and out on 11, in on 4420P pin 12 and out on 9, to pin 7 of the on-board serial D socket. Can you remind me what the sourcecode says about the other uses of GPIO24?
Posted by: mdavey

What are the pinouts of the rear serial D connector? - 09/12/2004 20:39

MK2a
The signal lines on the serial connector are driven from the GPIO lines of the StrongArm, via an RS-232 driver (a Maxim MAX3241 chip), a thick-film resistor array (a Bourns 4420P chip) and some other minor components. Some of the lines perform other roles when the player is in DC mode (typically, when in a car).
Code:

Serial GPIO SA Other Uses
============================================
1 DCD [in] 27 51 Telephone Mute
2 RD [in] - -
3 TD [out] - -
4 DTR [out] 23 55 debug LED?, MK2 SIR endec speed sel 1
5 GND
6 DSR [in] 21 59
7 RTS [out] 24 54 MK2 SIR endec speed sel 2
8 CTS [in] 22 56 Headlight Sense
9 GND*



Notes
DTR is sometimes called DTS
DCD is normally called CD
SA is the pin on the StrongArm upon which the signal is present
*As far as I can tell, pin 9 (normally ring indicator - RI) is grounded.
I couldn't work out where pins 6 and 15 of the 4420P go, nor pins 8 and 15 of MAX3241. Pins 1 and 10 on one side of the 4420P and pins 11 and 20 on the other side seem to be connected to their respective grounds.
I am unclear on whether pins 2 and 3 should be swapped, see this thread.
Posted by: DJZorro

Re: What are the pinouts of the rear serial D connector? - 11/12/2004 21:58

mdavey: thank you (again) very much for your support.

Both DTR & RTS are present on the "rear RS-232" and works quite well: the only thing I had to do was to patch the kernel in order to:

1) Disable the SIR setup (this was causing your problem of sudden level change during kernel operation)
2) Modify a bit get_serial_info & set_serial_info in order to enable a minimum set of ioctl needed to work with DTR/RTS from my user-mode daemon

Today, 0:40 my dashboard saw for the very first time a cd-changer that was - actually - the empeg.

The fun part of the whole project is that since 10 minutes, thanks to an enhanced interface, I don't need any RS232 output (apart the TX signal of course) anymore :-O

Let me some days to sort out various things and to refine various patches and I'll release everything on a site as promised.
Posted by: Shonky

Re: What are the pinouts of the rear serial D connector? - 11/12/2004 23:35

Cool!

Although my BMW is a bit different, I'll be interested to see what I can do with mine then. I don't think I'll be able to display song titles though

Quote:
The fun part of the whole project is that since 10 minutes, thanks to an enhanced interface, I don't need any RS232 output (apart the TX signal of course) anymore :-O

Surely you still need to both transmit and receive? Or are still controlling the empeg by it's front panel/remote and ignoring what the interface sends to it? I would have thought you would need to respond to interrogation commands so the main display knows the CD changer is actually there.
Posted by: Shonky

Re: What are the pinouts of the rear serial D connector? - 11/12/2004 23:39

BTW: What are you using for an IBus interface? I'm going to have to get/make one me thinks... At least to see how far I can go with my setup.

Edit:
Nevermind. I see your posts on the HackTheIBus list referring to your use of Rolf Resler's interface here
Posted by: DJZorro

Re: What are the pinouts of the rear serial D connector? - 12/12/2004 01:20

Quote:
Surely you still need to both transmit and receive?

The output signal was used to reset the collision detection circuit.

Quote:
BTW: What are you using for an IBus interface?

I was using an experimental interface, but I switched to the one by Rolf Resler based around a th3122 k-bus driver.
I recommend Mr. Resler's kits due to their good quality and safety (playing with I-BUS without a decent interface can be quite dangerous).

Now a question: as you known I need to run ttyS1 at 9600-8-E-1, but I also need read/write access to /proc/empeg_notify; does it's enought to setup Hijack to "Apps use serial" and put [output]notify=1 / [hijack]suppress_notify=1 in config.ini?

Sorry for questions that some could see as obvious, but I want to be sure about everything.
Posted by: genixia

Re: What are the pinouts of the rear serial D connector? - 12/12/2004 03:59

Correct. "Apps use serial" hijacks the serial port away from the player application and allows other applications to open it. "notify=1" exposes the /proc/notify interface, and "suppress_notify=1" prevents the player from outputting track information to the port. Thinking about it, you probably don't need "suppress_notify=1" once "Apps use serial" is set - all the player serial output is being redirected to /dev/null anyway.
Posted by: Shonky

Re: What are the pinouts of the rear serial D connector? - 14/12/2004 06:59

Well I knocked up the "simple" interface version last night which should be good enough since nothing else in the car is Ibus ( )

Also I can't do track titles or anything fancy it seems ( again). I was thinking of a remote display although that will of course require a second serial port I don't have. It's certainly going to require some creativity on my behalf to keep the stock stereo. For now I think I will simply run the empeg into the changer inputs and I can probably work out how to send all the front panel buttons using the disc select options.

How long before you show us what you've got do you think?

Otherwise I think I'll start writing something tonight assuming I can get a development environment up and running.
Posted by: mlord

Re: What are the pinouts of the rear serial D connector? - 17/12/2004 04:01

Okay, I nominate this effort as "Cool Hack of the Month!"

Awesome, dude!
Posted by: shadow45

Re: Serial port: how to software control a line output to "emulate" R - 20/12/2004 21:58

not to threadjack but anyone know of similar efforts for Pioneer CD changers? I've got a 6 discer in the dash on my new car and it has line level stereo outs.. just gotta do track/disc change control.

does anyone know the name of their bus so i could google some?
Posted by: kday

Re: Serial port: how to software control a line output to "emulate" R - 21/12/2004 03:12

Cool project. How are you controlling the playlist interface?
Posted by: Shonky

Re: Serial port: how to software control a line output to "emulate" R - 21/12/2004 05:34

I'm not aware of a Pioneer version but it probably exists. Remember we are trying to make an empeg look like a CD changer to a standard head unit. We aren't trying to drive a CD changer with an empeg although in this case it would be quite easy due to the IBus used in BMWs.

As for controlling playlists (my take anyway), I plan on mapping the 1-6 buttons onto the buttons to control the empeg. Then I think a remote display and an IR extender for complicated stuff.

I already have next/prev track type stuff working, although the headunit is muting things for some reason since I'm not appearing exactly how it expects the CD changer.
Posted by: DJZorro

Re: What are the pinouts of the rear serial D connector? - 21/12/2004 23:26

I'm completly destroyed: as I'm "self-emplyed" (or something like this) I have to work hard during the day and the only "spare" for developying is during night :-O

Anyway this night (just back from my night-car-fever) was the one! Even if the LCD-display just say CD01-1 (sending messages to various regions on the dashboard-LCD is really easy, I'll do later), my empeg (already mounted with the self-made adapor in the same bay of the original cd-changer) was emulating a BMW I-BUS player, reacting to various dashboard/steering buttons!).

The remaining problems are:

1) Using +12V/GND from the original cd-changer connector (the one that also has the I-BUS signal), I can haar the alternator in the speakers (!). I hope it's a not-so-good-ground problem, I have to investigate further.

2) I used the Mark Lord tip (thank you for replaying) to control the standard player by Empeg guys (using /proc/empeg_notify interface), but it seems that "button=pause" will not do the right things if issued in a odd number order (I hope you get what I want to say, I'm too "underslept" to speak a more decent english. Sorry.

3) I see that "long key press" means a fixed hold/release sequence in the kernel. I don't know if it's a good thing(tm) to patch hijack.c in order to accept a release signal via an ioctl (I want to implement a decent FF/REW).

4) Maybe, when I finish the daemon that deals with the I-BUS, I could think to swap also the player software (the original software eat a lof of CPU, and I think I don't need anymore most of the original features): what alternative (and open source) player do you suggest? Squash looks good, but don't seems actively developed anymore.

BTW for all BMW-guys: Remote signal (= red input for the empeg) is on white wire on radio signal connector (the box under the cd-changer and the tv-tuner if you have one). The signal is delayed of about 1 minute when you turn off the engine.

I could write more and more things, but I'm completly destroyed and I really have to get some sleep.
Posted by: Shonky

Re: What are the pinouts of the rear serial D connector? - 22/12/2004 05:58

Quote:
Even if the LCD-display just say CD01-1

That's about all I can ever hope to do on mine, so I need to sort out some sort of remote display somehow.

Quote:
(already mounted with the self-made adapor in the same bay of the original cd-changer)

So your empeg mounts vertically? My changer mounts horizontally under the rear shelf. I can't see that mounting it horizontally will be very good so I think a bracket angling the empeg up might be a good idea to prevent any chance of it sliding out.

Quote:
1) Using +12V/GND from the original cd-changer connector (the one that also has the I-BUS signal), I can haar the alternator in the speakers (!). I hope it's a not-so-good-ground problem, I have to investigate further.


Up until now I have been powering off the cigarette lighter socket and have been getting noticeable alternator whine. I was planning to move to power off the Ibus connector hoping the whine would go away - Apparently it might not it seems. The only option might be a good ground loop isolator.

Quote:
4) Maybe, when I finish the daemon that deals with the I-BUS, I could think to swap also the player software (the original software eat a lof of CPU, and I think I don't need anymore most of the original features): what alternative (and open source) player do you suggest? Squash looks good, but don't seems actively developed anymore.


I think the original software will be the best. I doubt you'll get much lower CPU usage with anything else. Turning off visuals would be a good start though.

I'm finding some "lag" in the button presses but that's more than likely my interface code doing wierd things.
Posted by: DJZorro

Progress on the "Ze46peg" project - 22/12/2004 19:11

Quote:
That's about all I can ever hope to do on mine, so I need to sort out some sort of remote display somehow.

Yes, in your case I think so: if the display and the radio aren't a different "entity" (= different I-BUS addressing), you won't have a chance to force the display something different the radio firmware expect.

Quote:
So your empeg mounts vertically? My changer mounts horizontally under the rear shelf.

The same as mine (there's a bay - something like a non-standard mini-rack - that holds the radio, that also include the power amplifier IMHO, and the tv-tuner on the lower side.
Upper side there's the MKIII CD-based GPS navigator and finally, on the top off all things, there's the cd-changer (now the empeg with my adaptor, painted of black color). See the attached picture.
When I resolve the most big problem I have now (see below) I will remount everything and redefine the software, and of course publish everything (after a bit of cleanup) all the software on a web site.

Quote:
Up until now I have been powering off the cigarette lighter socket and have been getting noticeable alternator whine.

I have to first try to connect the empeg directly to the battery (tonight I'm too destroyed to even think about it, but I'll do it tomorrow) to check if the problem disappear.

The sound is crisp clear, but I can hear everything.. the HDD powering up, the engine, lights, and so on.

Quote:
I was planning to move to power off the Ibus connector hoping the whine would go away - Apparently it might not it seems. The only option might be a good ground loop isolator.

Ground loop isolator = something before the +12V/GND or after the pre-amp output? If later.. mmm.. how much sound you will lose that way.

Also, I anyway tought: "But my original cd-changer works quite well and sounds perfectly with the very same input" (ok, not cosidering different power consuption), so I called the car-shop where I bought my 2nd-hand E46 asking for a dead changer to analyze.. and the guy promised me one

Quote:
I think the original software will be the best. I doubt you'll get much lower CPU usage with anything else. Turning off visuals would be a good start though.

Then when the visuals are turned off, they are really "off"? I never checked this thing with "top" or something like this.
Also another question: I tried some 3.x alphas with not very good results (2.0 is rock solid). Does the database rebuild problem & the "hard-disk always on" issues has been resolved in latest build? OGG Vorbis is so nice

Quote:
I'm finding some "lag" in the button presses but that's more than likely my interface code doing wierd things.

My very own problem is that the "lag" most of the time is due the delay from /proc/empeg_notify writing to real seek by the player (of course with hard-disk already turned on and ready - something don't appears with real keys), but it's not so big deal for me.

About knowing when the player is really in pause, I'm thinking to examine the display frame-buffer in the || area sign.. ok, lame but it should work.

Any more elegant ideas?
Posted by: Shonky

Re: Progress on the "Ze46peg" project - 23/12/2004 06:07

I won't quote since my head isn't quite working good enough...

Whine:
I believe the problem is possibly not power through the empeg. For testing I've had the empeg powered off the cigarette lighter socket. I was still getting the whine with the tuner AND the tape deck though, so the noise must be getting into the amp somehow. I'm still going to try running of the Ibus supply but I'm guessing the CD changer has some special circuitry. It appears from the diagrams I have that the CD changer outputs balanced signals. I have a few things to try first (after power from Ibus)

Isolator:
A ground loop isolator goes on the RCA audio lines. The whine is coming from currents flowing through the shields in the RCA jacks. Filters can be placed on power lines, but the problem is caused by the loop through the audio circuitry so start there. The isolation transformer is a special 1:1 audio transformer. I managed to pick one that was reasonable quality for A$20. Disdavantages are that they generally roll off at high and low frequencies (particularly low if I'm thinking right)

Lag:
Now that I think about it, my debugging showed the empeg received the button commands instantly and it was the software that was slow. So maybe it's not our code
Posted by: DJZorro

Re: Progress on the "Ze46peg" project - 24/12/2004 22:56

I finnally managed to sleep a complete day (yesterday) and find some time to put my head on piles of documentation from riocar.org & analyze the dead cd-changer: I now control /dev/empeg_state and fixed the no more "pause instead of play". Also the cd-input of the radio module is balanced you are right (hey where you found the cd-changer schematic!!?): I'm still evaluating if it's better to buy a converter or build one with savaged components from original-but-dead cd-changer.

Apart the noise, evertthing is quite stable and, when I fix the audio path, I can assemble the rear of the machine and finnally focus on redefine the software (the lacking area is the title/author display and some other goodies not very critical).

Having my empeg player back is really cool, I couldn't drive without it.
Posted by: Shonky

Re: Progress on the "Ze46peg" project - 26/12/2004 04:16

Although it's sort of the shonky ( ) way out, I bought a ground loop isolator since I knew it would work. The one I bought seems to be pretty decent quality and only A$20.

Apart from the lack of whine I don't think I can really tell the difference. This is exactly what I bought here

I still might try the pseudo-balanced circuit I have, but if this is just as good why bother really. I figured the input was balanced from here and also the ETM I have. This doco describes the circuit to convert to a pseudo balanced signal.

We bought a stack of new test equipment just recently. I might hook it up with a signal generator and receiver and see what kind of frequency response the isolator has when I get a chance.
Posted by: DJZorro

Re: Progress on the "Ze46peg" project - 28/12/2004 19:48

Thank you Shonky: I will find a bit of time to sort out the crappy-sound issue (I tested a DI-BOX, but nothing changed. As I have a lot of hard-drive noise even with engine turned off, I think I have a grounding problem).

Anyway I'm enjoyning various coding: it's really fun.
hijack.c & c. are REALLY A FANTASTIC PIECE OF WORK.
MARK LORD ROCKS BIG TIME.

To solve the "double pause/play" issue was rather trivial, just something like this:
[..]
if (*s && get_button_code(&s, &button, 1, raw, ".\r")) {
if ((button == (IR_RIO_PLAY_PRESSED|ALT)) && (empeg_statebuf[0xc] == 0x00))
return s; /* Empeg is pausing - no need to issue a pause virtual key again */
if ((button == (IR_RIO_PLAY_PRESSED)) && (empeg_statebuf[0xc] == 0x02))
return s; /* Empeg is playing - no need to issue a play virtual key again */
if (raw) {
[..]
on do_button().

The I-BUS software is under heavy rewriting, preparing it for GPL release; I think I'll need a month or so.

I'm SO amazed about how much I learned by just watching at the code. I would to thank you all!
Posted by: Shonky

Re: Progress on the "Ze46peg" project - 29/12/2004 02:39

After saying the one I bought is good quality it has developed a broken connection on one channel and I had to get it replaced.

I'm not having any "double pause" issues. My main problem is the code I used to inject the button press seems to be waiting for the drives to spin up. You seemed to mention this problem earlier - how did you get around it? It's really starting to annoy me.

I'm now trying to figure out how I'm going to remotely display the empegs VFD. I found this post where Hugo seemed to think extending the cable wouldn't be a problem. I think extending the display is my best option with the empeg in the glovebox. It means I keep all the button functions too.
Posted by: fliplap

Re: Progress on the "Ze46peg" project - 29/12/2004 02:54

Would you believe I joined this forum just for this thread?

I too have an e36 M3, although I don't have an empeg. I do however have a Zaurus SL-5500 which runs Linux, has a serial cable and has a headphone jack. I'm planning on turning it into an mp3 player since I no longer use it.

Shonky: I'm putting together the simple iBus interface tomorrow. Have you actually been able to read/write to the iBus thus far? What year is your M3 and what color is the iBus wire? I'm assuming you're using the CD Changer cable in the trunk? Best of luck on your project!
Posted by: Shonky

Re: Progress on the "Ze46peg" project - 29/12/2004 03:42

Yes I would believe you joined for the thread.

I use this interface and it works OK except for the empeg getting confused when characters echo back to it while booting.



Yes I can read/write Ibus no problems and currently have the 1 - 6 direct CD access buttons controlling my empeg remotely with great success (apart from the delay due to drives spinning up). Ibus is quite simple to program. I wrote my code completely from scratch in just a few hours, plus another few hours debugging some stuff where the head unit didn't like exactly what I was sending.

On mine, I am using the CD changer Ibus interface and have disconnected the changer for now. I might try and do some sort of pass through so I can have both empeg and CD changer but now the changer lies dormant. On mine the red wire is +12, black is ground and yellow is Ibus from memory.

The CD changer with Ibus appeared on later E36s. I don't know when but would guess around 96-97.
Posted by: Shonky

Re: Progress on the "Ze46peg" project - 29/12/2004 03:45

Oh and my M3 is a 5/98 Euro model (i.e. with the real 321hp S50 B32 engine and not the 240hp US version)

Edit: I'm still not sure whether it's an S50B32 or an S52. Different sources say different things. I think it's probably an S50 B32 since that's what the ETM calls it.
Posted by: fliplap

Re: Progress on the "Ze46peg" project - 29/12/2004 20:25

Yep, you have the S50B32 engine. My US model has the S52 engine :-( I have a 98 M3 as well and it has the 3-wire connector I-Bus connector as opposed to the 2-wire M-Bus of the older e36 Cd changers. I'm sitting in my garage with my trunk open trying to get _something_ off of the I-Bus. Right now I've got a multimeter attached to the yellow wire (ground on brown). It holds a steady 8v, even when buttons are pressed I don't see a drop which is alittle discouraging
Posted by: Shonky

Re: Progress on the "Ze46peg" project - 29/12/2004 20:55

Well I don't understand how they code their engines i.e.

S50B30 Euro 3.0
S50B32 Euro 3.2

For the US, some say the engines are

S50US US 3.0
S52US US 3.2
eg: http://www.bentleypublishers.com/product.htm?code=b398

and then some sites refer to

S50US B30 3.0
S50US B32 3.2
eg : http://www.bcw3design.com/m3/us_euro_faq.htm

So I really don't know what's what.

Anyhoo... With regards to your Ibus problem. A volt meter will show nothing of value. I'm not sure about ground being brown, but if your unsure find a bare chassis bolt and temporarily use that as ground.

To see a signal you need an oscilloscope. The Ibus signal is pulled high to +12V so it should read +12V most of the time and very very briefly dip when something is transmitted.

There will be very little traffic if the CD changer is disconnected. The head unit will only transmit about once every 30 seconds looking for the changer.

If you have an Ibus changer, the CD changer should have two connectors. 1 x 6 pin connector for the audio and 1 x 3 pin connector for power, ground and Ibus.

I just built the basic circuit above and connected it up with the CD changer still connected and watched all the packets go backwards and forwards.

Have you seen the HackTheIbus Yahoo group?
http://groups.yahoo.com/group/HackTheIBus/

Specifically I used:
http://groups.yahoo.com/group/HackTheIBus/files/IBUS%20Interfaces/SimpleInterface2.jpg
http://groups.yahoo.com/group/HackTheIBu...deDRAFTREV5.PDF
and
http://groups.yahoo.com/group/HackTheIBu..._Connectors.pdf

You probably have to be a member to get the files.
Posted by: fliplap

Re: Progress on the "Ze46peg" project - 30/12/2004 00:46

I can say with certainty that my engine code is S52US

On the topic of I-Bus, I rebuilt my interface again on the breadboard, but unfortunatly I still am not able to read anything off of it. Oddly enough my I-Bus seems to pull to a constant +10.5V, though my CD Changer functions fine.

In the back of the manual for my headunit, it does indeed refer an I-Bus pin, so i can verify that I've got it. I suppose I'll try rebuilting my connector once more Thanks for all your help!
Posted by: fliplap

Re: Progress on the "Ze46peg" project - 30/12/2004 20:26

Sigh. Rebuilt it one last time and I'm not sure where to go from here. I have to think my circuit is built right.. I even tried tapping it with the CD Changer plugged in so i would know there would be traffic, nothing Although i can confirm that when I detach the cd changer and attach the yellow iBus line to our Fluke digital multimeter there is a small drop in voltage every 12 seconds like clockwork. I don't suppose you have any suggestions?
Posted by: Shonky

Re: Progress on the "Ze46peg" project - 30/12/2004 21:33

OK, so I'm assuming you are using the circuit I inlined above. Make sure it's the version 2 where the IBus line is pulled up. Otherwise the original circuit pulled up the IBus line with DTR. If DTR wasn't active, the whole IBus would be pulled down and wouldn't work (hence the first question).

1) Does the CD changer still work OK with your interface? It should.

2) Are you sure you have your serial port pinouts right? Looking into the connector male and female are the opposite. Usually the connectors have very tiny numbers printed on them. This is looking into a male connector.

3) Are you using 9600 baud, 8 data bits, 1 stop bit, even parity (8E1) and NOT 8N1?

4) What are you using to capture? I highly recommend Serial Watcher here for debugging this sort of stuff. It lets you select hexadecimal mode for non printable characters.

5) If you have a good macro camera, take some hires close ups of your board and I can have a look for you. My email address is in my profile and I can accept big emails.

6) When you have the changer connected, you are actually using it right (changing tracks etc)? Otherwise you'll simply get the hello messages every fixed interval. I thought it was 30 seconds but it doesn't matter.
Posted by: fliplap

Re: Progress on the "Ze46peg" project - 30/12/2004 21:47

1) Yep still works

2) Yep, I used the tiny numbers printed on the connector

3) check

4) I'm using the I-Bus analyzer. I'm going to dig back into this on Saturday using Serial Watcher for sure, thanks for the tip

5) I'm very tempted to have you look at it. I'm going to rebuild it again on Saturday, space out all of the components so its easier to see.

6) Yeah, i've tried pushing buttons, I get nothing at all :/

Thanks again for your help! I really apprieciate it.
Posted by: Shonky

Re: Progress on the "Ze46peg" project - 30/12/2004 21:57

Quote:
4) I'm using the I-Bus analyzer. I'm going to dig back into this on Saturday using Serial Watcher for sure, thanks for the tip

I used the IBus analyzer program initially and it did do the job and correctly captured basic packets. I just like the simplicity of Serial Watcher though - I use it every day for work.

Another couple:
7) Have you got your transistor pinouts right?

8) Are you using the Zaurus or a laptop/desktop? Some laptop serial ports can be a bit picky when you use interfaces like these since the interfaces don't really implement RS232 properly. If you can try another laptop/desktop easily, I would since I assume the Zaurus serial port could be like that.
Posted by: fliplap

Re: Progress on the "Ze46peg" project - 01/01/2005 18:15

7) Yeah, i've double and triple checked the transistors.

8) I've tried 2 laptops, a dell and an IBM, no go on either. The serial cable for my zaurus should be here on Monday and I'll give it another shot.

But for now it looks like this might be a project I have to scrap :-/ Thanks so much for your help though. At least I know its possible.
Posted by: Shonky

Re: Progress on the "Ze46peg" project - 01/01/2005 21:27

If it's not working on the two different laptops, I doubt it will work on the Zaurus.

I think there must be something wrong with your wiring/components/board design, particularly if you've rebuilt it and had the same result (i.e. nothing).
Posted by: fliplap

Re: Progress on the "Ze46peg" project - 01/01/2005 22:31

Woops, meant to edit that post earlier. Turns out I'm a filthy liar. The transistors were wrong, I must have labeled my diagram wrong the first time and that got me twisted around each time a rebuilt it. I turned the transistors around and it works perfect now! Thanks so much for all your help!
Posted by: DJZorro

Re: Progress on the "Ze46peg" project - 02/01/2005 11:56

Eheh, to all non-NAV BMWist, check photo form my site my site
BTW: Anyone of you want to exchange some free-days on the Lake of Garda in exchange of one hour on the whell of his M3? I will also pay for gasoline.
Posted by: DJZorro

Re: Progress on the "Ze46peg" project - 03/01/2005 20:27

Quote:
It appears from the diagrams I have that the CD changer outputs balanced signals. I have a few things to try first (after power from Ibus)

The whine is coming from currents flowing through the shields in the RCA jacks.


I finally get the time to look to the noise issue, for the first part, I examined for well the original cd-changer: in the rear there's something that's look like a post-production add-on (where I-BUS connector & audio-linees connector are soldered); the circutary is a simple battery filter, and near the audio connector there's a passive band-pass circuit. One fact I got from this circuit is that negative audio output are common, then it's a balanced output non-GND relative (like all decent equipment out of there).

After checking this, I immediately installed an additional 3mm diamater direct wire from battery and the empeg/I-BUS interface and all the noise just disappeared (even with the engine turned on).

I'm veeeeeeeeeeeeeeery pleased of this, but now, to put another big smile on my face, I have to find a way to get a stereo balanced pre-output line from the headunit to add a subwoofer.
Posted by: Shonky

Re: Progress on the "Ze46peg" project - 03/01/2005 21:03

Excellent work - I'll probably just stick with the ground loop isolator I'd say since it seems to be quite good quality.

Any chance of pictures of the insides where the IBus / balanced interface is?

Also, how did you get around the issue where there was lag from pushing your button code in /proc/empeg_notify to the empeg responding?
Posted by: DJZorro

Re: Progress on the "Ze46peg" project - 03/01/2005 21:12

Quote:

Any chance of pictures of the insides where the IBus / balanced interface is?



I intended to make a photo, but I have the camera at work Maybe tomorrow! The changer is just laying on a desk.. it will NEVER come back on the car, at least until I sell it.

Quote:
Also, how did you get around the issue where there was lag from pushing your button code in /proc/empeg_notify to the empeg responding?


The lag is not very high for my just-drive-and-hear-'80s-dance-music days, but I think one way to get around it is to use a uP between the empeg and the I-BUS, to do direct keypad driving and high-level I-BUS I/O for text. Or.. just find a way to do this in software I work on the project a bit every day and I plan to finish everything by the end of the month. On the software-only side, I think mr. Lord can give us an hint,,
Posted by: littlejimmy

Re: Progress on the "Ze46peg" project - 11/05/2005 01:55

Hi,

I was sitting down this evening to start working on adapting my empeg for my '04 BMW (with Nav) and discovered this thread. Needless to say, it looks like you folks are well on your way to doing exactly what I'd like to do. Have you made any additional progress on this, and would you be willing to share what you've done?

Cheers!
Posted by: Shonky

Re: Progress on the "Ze46peg" project - 11/05/2005 07:41

I had mine basically working but nowhere to really put the empeg. In the end, I went and did this instead.

Probably better really. I did lose the speed dependent volume and it's not quite as loud as it could be, but I can probably get that speed dependent volume back if I figure out OBD2. The pulse signal is right there so at worst a small micro could do it.

If I had an E46 I'd hopefully have navigation with the LCD/TV. In that case I'd be building a full car PC instead. I'd have a car PC now if there was an easy way to fit it in an E36 without losing the onboard computer and without covering the middle air vents.