#243573 - 08/12/2004 14:08
Serial port: how to software control a line output to "emulate" RTS
|
new poster
Registered: 19/12/2003
Posts: 22
|
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.
Attachments
242871-after.jpg (591 downloads)
|
Top
|
|
|
|
#243574 - 08/12/2004 14:26
Re: Serial port: how to software control a line output to "emulate" R
[Re: DJZorro]
|
carpal tunnel
Registered: 19/01/2002
Posts: 3584
Loc: Columbus, OH
|
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.
_________________________
~ John
|
Top
|
|
|
|
#243575 - 08/12/2004 16:32
Re: Serial port: how to software control a line output to "emulate" RTS
[Re: DJZorro]
|
enthusiast
Registered: 06/03/2003
Posts: 269
Loc: Wellingborough, UK
|
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.
|
Top
|
|
|
|
#243576 - 08/12/2004 17:18
Re: Serial port: how to software control a line output to "emulate" R
[Re: mdavey]
|
new poster
Registered: 19/12/2003
Posts: 22
|
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
|
Top
|
|
|
|
#243577 - 08/12/2004 19:26
Re: Serial port: how to software control a line output to "emulate" R
[Re: DJZorro]
|
pooh-bah
Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
|
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.
Edited by Shonky (08/12/2004 19:27)
_________________________
Christian #40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)
|
Top
|
|
|
|
#243578 - 08/12/2004 20:15
Re: Serial port: how to software control a line output to "emulate" R
[Re: Shonky]
|
new poster
Registered: 19/12/2003
Posts: 22
|
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.
|
Top
|
|
|
|
#243579 - 08/12/2004 20:59
Re: Serial port: how to software control a line output to "emulate" R
[Re: DJZorro]
|
enthusiast
Registered: 06/03/2003
Posts: 269
Loc: Wellingborough, UK
|
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.
|
Top
|
|
|
|
#243580 - 08/12/2004 21:04
Re: Serial port: how to software control a line output to "emulate" R
[Re: mdavey]
|
enthusiast
Registered: 06/03/2003
Posts: 269
Loc: Wellingborough, UK
|
Also, the tuner connector wires are unbuffered TTL - try to pull too much current or short them out and you could cripple your Empeg.
|
Top
|
|
|
|
#243581 - 08/12/2004 21:52
Re: Serial port: how to software control a line output to "emulate" R
[Re: mdavey]
|
pooh-bah
Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
|
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.
_________________________
Christian #40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)
|
Top
|
|
|
|
#243582 - 08/12/2004 22:11
Re: Serial port: how to software control a line output to "emulate" R
[Re: mdavey]
|
new poster
Registered: 19/12/2003
Posts: 22
|
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?
|
Top
|
|
|
|
#243583 - 08/12/2004 23:28
Re: Serial port: how to software control a line output to "emulate" R
[Re: DJZorro]
|
enthusiast
Registered: 06/03/2003
Posts: 269
Loc: Wellingborough, UK
|
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.
|
Top
|
|
|
|
#243584 - 08/12/2004 23:36
Re: Serial port: how to software control a line output to "emulate" R
[Re: mdavey]
|
pooh-bah
Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
|
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.
_________________________
Christian #40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)
|
Top
|
|
|
|
#243585 - 09/12/2004 05:40
Re: Serial port: how to software control a line output to "emulate" R
[Re: DJZorro]
|
Carpal Tunnel
Registered: 08/02/2002
Posts: 3411
|
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.
_________________________
Mk2a 60GB Blue. Serial 030102962
sig.mp3: File Format not Valid.
|
Top
|
|
|
|
#243586 - 09/12/2004 05:51
Re: Serial port: how to software control a line output to "emulate" R
[Re: genixia]
|
pooh-bah
Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
|
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.
_________________________
Christian #40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)
|
Top
|
|
|
|
#243587 - 09/12/2004 08:31
Re: Serial port: how to software control a line output to "emulate" R
[Re: genixia]
|
new poster
Registered: 19/12/2003
Posts: 22
|
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 )?
|
Top
|
|
|
|
#243588 - 09/12/2004 12:11
Re: Serial port: how to software control a line output to "emulate" R
[Re: DJZorro]
|
enthusiast
Registered: 06/03/2003
Posts: 269
Loc: Wellingborough, UK
|
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.
Attachments
242954-serial-small.jpg (780 downloads)
Edited by mdavey (09/12/2004 13:50)
|
Top
|
|
|
|
#243589 - 09/12/2004 13:36
Re: Serial port: how to software control a line output to "emulate" R
[Re: mdavey]
|
new poster
Registered: 19/12/2003
Posts: 22
|
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!
|
Top
|
|
|
|
#243590 - 09/12/2004 14:06
Re: Serial port: how to software control - RTS
[Re: DJZorro]
|
enthusiast
Registered: 06/03/2003
Posts: 269
Loc: Wellingborough, UK
|
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?
|
Top
|
|
|
|
#243591 - 09/12/2004 20:39
What are the pinouts of the rear serial D connector?
[Re: DJZorro]
|
enthusiast
Registered: 06/03/2003
Posts: 269
Loc: Wellingborough, UK
|
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.
|
Top
|
|
|
|
#243592 - 11/12/2004 21:58
Re: What are the pinouts of the rear serial D connector?
[Re: mdavey]
|
new poster
Registered: 19/12/2003
Posts: 22
|
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.
|
Top
|
|
|
|
#243593 - 11/12/2004 23:35
Re: What are the pinouts of the rear serial D connector?
[Re: DJZorro]
|
pooh-bah
Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
|
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.
_________________________
Christian #40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)
|
Top
|
|
|
|
#243594 - 11/12/2004 23:39
Re: What are the pinouts of the rear serial D connector?
[Re: DJZorro]
|
pooh-bah
Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
|
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
Edited by Shonky (11/12/2004 23:42)
|
Top
|
|
|
|
#243595 - 12/12/2004 01:20
Re: What are the pinouts of the rear serial D connector?
[Re: Shonky]
|
new poster
Registered: 19/12/2003
Posts: 22
|
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.
|
Top
|
|
|
|
#243596 - 12/12/2004 03:59
Re: What are the pinouts of the rear serial D connector?
[Re: DJZorro]
|
Carpal Tunnel
Registered: 08/02/2002
Posts: 3411
|
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.
_________________________
Mk2a 60GB Blue. Serial 030102962
sig.mp3: File Format not Valid.
|
Top
|
|
|
|
#243597 - 14/12/2004 06:59
Re: What are the pinouts of the rear serial D connector?
[Re: DJZorro]
|
pooh-bah
Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
|
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.
_________________________
Christian #40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)
|
Top
|
|
|
|
#243598 - 17/12/2004 04:01
Re: What are the pinouts of the rear serial D connector?
[Re: DJZorro]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14491
Loc: Canada
|
Okay, I nominate this effort as "Cool Hack of the Month!"
Awesome, dude!
|
Top
|
|
|
|
#243599 - 20/12/2004 21:58
Re: Serial port: how to software control a line output to "emulate" R
[Re: DJZorro]
|
member
Registered: 19/03/2002
Posts: 144
Loc: Florida, USA
|
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?
_________________________
::: shadow45
|
Top
|
|
|
|
#243600 - 21/12/2004 03:12
Re: Serial port: how to software control a line output to "emulate" R
[Re: DJZorro]
|
new poster
Registered: 05/01/2002
Posts: 40
Loc: Boston, MA
|
Cool project. How are you controlling the playlist interface?
|
Top
|
|
|
|
#243601 - 21/12/2004 05:34
Re: Serial port: how to software control a line output to "emulate" R
[Re: kday]
|
pooh-bah
Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
|
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.
_________________________
Christian #40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)
|
Top
|
|
|
|
#243602 - 21/12/2004 23:26
Re: What are the pinouts of the rear serial D connector?
[Re: mlord]
|
new poster
Registered: 19/12/2003
Posts: 22
|
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.
|
Top
|
|
|
|
|
|