Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#102551 - 02/07/2002 03:39 Tuner serial interface
caederus
journeyman

Registered: 18/02/2000
Posts: 51
Loc: UK
Is there a definitive description of the serial interface to the tuner module?
From what I can see of past discussions, information is very sketchy. Could
Patrick or Hugo oblige with a complete list?

Here's what I have gleaned from past posts:

http://empeg.comms.net/php/showthreaded.php?Cat=&Board=hackers_prog&Number=76423
Responses from the Tuner always always always begin with 0x01

http://empeg.comms.net/php/showthreaded.php?Cat=&Board=hackers_prog&Number=76416
...the 3 byte init string Hugo originally sent me of 0x01, 0x00, 0x01

http://empeg.comms.net/php/showthreaded.php?Cat=&Board=empeg_tech&Number=95104
There are 2 parameters which define when the tuner will send a stalk command
0x01 0x08 <fuzz> <loops>

http://empeg.comms.net/php/showthreaded.php?Cat=&Board=empeg_tech&Number=37787
0x02 - indicates a command from the stalk interface
0x00 / 0x01 - indicates that the shift switch is off / on
ADC1 first sample read from the remote
ADC2 second sample read from the remote

http://empeg.comms.net/php/showthreaded.php?Cat=&Board=hackers_prog&Number=81713
To read the knob, send "0x01 0x09", and the Tuner will reply with
"0x01 0x09 0x0y 0x(9+y)", where "y" is the dial setting.
_________________________
http://ro.nu/ Robin O'Leary

Top
#102552 - 02/07/2002 05:50 Re: Tuner serial interface [Re: caederus]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
Is this helpful?
_________________________
- Tony C
my empeg stuff

Top
#102553 - 02/07/2002 06:18 Re: Tuner serial interface [Re: tonyc]
caederus
journeyman

Registered: 18/02/2000
Posts: 51
Loc: UK
I was more interested in the tuner side of things; that article
concentrates on the wired remote data.

Perhaps the serial interface has little to do with the radio operation.
From the kernel source, it seems that all the tuning, signal strength and
RDS stuff is done by the fiendishly complex SAA7705H DSP. From the block
diagram on the SAA7705H data sheet, it looks as if some dumb front-end
circuitry just hands over a chunk of spectrum, in which case the serial
port may be used for nothing more than switching the receiver, LED and
antenna on and off.
_________________________
http://ro.nu/ Robin O'Leary

Top
#102554 - 02/07/2002 21:57 Re: Tuner serial interface [Re: caederus]
number6
old hand

Registered: 30/04/2001
Posts: 745
Loc: In The Village or sometimes: A...
You pretty much have worked it out.

Yes, the Tuner interface is very low-level and the tuner module does little else than accept I2C commands to read and write certain registers on the Tuner module in the tuner.

The 'smarts' are all on the Empeg itself, either in the DSP (where the RDS signal is processed), or in the kernel and/or player software (for the tuning, user interface etc).


Top
#102555 - 08/07/2002 06:05 Re: Tuner serial interface [Re: caederus]
altman
carpal tunnel

Registered: 19/05/1999
Posts: 3457
Loc: Palo Alto, CA
Not quite; the tuner module does *all* the tuning (front end, IF mix, demod etc etc). The DSP just does baseband signal processing (weak signal processing, inteference supression, etc), RDS extraction and FM demultiplex.

The tuner module itself is handed a frequency and various other settings and gives you the demodulated AF L+R/L-R/RDS signal over one wire and an analogue indication of signal strength over another.

There is an I2C eeprom in the tuner module which contains calibration values which are used (with interpolation) to calibrate signal strength indications over the entire tuning range.

Hugo

Top
#102556 - 08/07/2002 06:25 Re: Tuner serial interface [Re: altman]
caederus
journeyman

Registered: 18/02/2000
Posts: 51
Loc: UK
I presume the tuner module is ``handed a frequency and various other
settings'' over the serial port? If so, any chance you could list all
the commands, and what the settings are?

TIA
_________________________
http://ro.nu/ Robin O'Leary

Top
#102557 - 08/07/2002 15:13 Re: Tuner serial interface [Re: caederus]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14494
Loc: Canada
If you cannot get a list of them, many are easy enough to reverse-engineer by enabling "trace_tuner=1" in Hijack, and then watching the serial console output while trying various Tuner operations.

Cheers

Top
#102558 - 08/07/2002 16:08 Re: Tuner serial interface [Re: mlord]
altman
carpal tunnel

Registered: 19/05/1999
Posts: 3457
Loc: Palo Alto, CA
I've not got a document of the commands, but you will also need the UFC1384 datasheet from Microtune as this documents the calibration and interpolation values. If anyone really, really, wants the tuner commands I'll try and find time to write them down from the PIC source...

Hugo

Top
#102559 - 08/07/2002 16:10 Re: Tuner serial interface [Re: caederus]
altman
carpal tunnel

Registered: 19/05/1999
Posts: 3457
Loc: Palo Alto, CA
Correction on the stalk response: the last byte is a checksum, so is (shift reading+adc reading) and not first/second ADC reads. Before we send a stalk response from the tuner we wait until the ADC read has settled for a certain number of ADC reads within a certain amount of fuzz (+/- range)

Hugo

Top
#102560 - 08/07/2002 18:57 Re: Tuner serial interface [Re: altman]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14494
Loc: Canada
Methinks that might be useful information to the community, and t'would be a shame were it lost forever.

Thanks Hugo!

Top
#102561 - 11/07/2002 03:10 Re: Tuner serial interface [Re: mlord]
altman
carpal tunnel

Registered: 19/05/1999
Posts: 3457
Loc: Palo Alto, CA
Ok, the basics: 19200bps, 8n1

Commands of the form:

0x01 <command> [<command data>]

Commands are answered with replies of the form
0x01 <command> <result> <command+result>

There's no checksum on commands. There are 2 special commands, 0xf0 and 0xf1 (single bytes, not prefixed with 0x01) which tune to frequency A and B respectively - this is for quick switching to do RDS updates.

Other replies from the tuner are:

0x02 <shift> <key> <shift+key>
Stalk response. Shift indicates the shift state of the track skip part (which can be pushed in, binary 0/1) and key indicates the adc value.

0x03 0x01 0x00 0x01
Overcurrent indication on antenna supply. Current limit exceeded, foldback in operation. This indicates a likely short on the antenna output (load <25ohms attached).

command 0: tuner enumerate
1 parameter (0=tuner off/led off, 1=tuner on/led on).
If turned on, result is the tuner id (0x03=am/fm module rev 1) otherwise it's 0.

command 1:
Full tuner setup
8 parameters. Full tuner setup sent to tuner chip (8 bytes).
Result 0

command 2:
Full tuner setup and tuneto
8 parameters. Does tuner setup then resends first 3 bytes with bit 7 of 3rd byte cleared (unmute audio). Saves frequency as frequency A.
Result 0

command 3:
Tuneto
3 parameters sent as first 3 bytes to tuner. Saves as frequency A.
Result 0

command 4:
read eeprom
1 parameter (address in i2c eeprom to read. i2c eeprom is inside the canned module and contains antenna calibration values which are individually calibrated & stored).
Result is the read byte

command 5:
antenna power on/off
1 parameter: 0=antenna down, 1=antenna up
Result 0

command 6:
AM/FM switch direct control
1 parameter, 0=fm/1=am (I think). Usually, tuneto sets the analogue switch automatically so that the FM-MPX/AM-AF wire to the empeg carries the appropriate tuner output; this allows it to be overridden just in case you want to get freaky with the output.
Result 0

command 7:
Force a stalk poll
0 parameters
NO REPLY: well, no normal format reply. You will get a stalk response.

command 8:
set stalk fuzz/stable time
2 parameters: fuzz then stabletime. Fuzz defines the range within which the stalk adc readings have to stay within (eg 2 will mean that the reading has to wobble <= +/- 2 from the last ADC read) for <stable time> loops before it's classified as stable enough to send to the host. Default is 2/100.
Result 0

command 9:
read tuner module ID
0 parameters
Result is tuner module ID (on rotary dial)

command 10:
read IF counter from tuner
0 parameters
Result is IF counter byte read from tuner module.

command 11:
LED mode
1 parameter, on/off. If LED mode is set, the LED on the tuner is PWM'ed with relative signal strength - brighter=better signal. This does not affect any other tuner operation, it's just an installation debug tool.

command 12:
set frequency B
3 parameters, 3 bytes to send to tuner when 0xf1 command is received.
Result 0

command 13: (patrick's tuner only, version 0x28 onwards)
set outputs
1 parameter: low 2 bits control the 2 user output ports
Result 0

command 14: (patrick's tuner only, version 0x28 onwards)
read inputs
0 parameters
Result is state of 4 user inputs in bits 0-3

command 255:
read version
0 parameters
Result is tuner version number. I believe production units are 0x27 (v2.7)

...that's about the size of it! I can't find my open tuner module, but the 8 byte setups are very much like the TEA6840 ISTR, though the chip is a later model. You really want the UFC1384 module datasheet from Temic.

Hugo

Top
#102562 - 11/07/2002 05:51 Re: Tuner serial interface [Re: altman]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
Perhaps someone could paste this into the FAQ or Developer Guide over at Riocar.org? Valuable bit of info there.

Also I see where you have been adding the codes for Patrick's DIY tuner with "extra stuff". Cool.
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#102563 - 11/07/2002 10:31 Re: Tuner serial interface [Re: Shonky]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31599
Loc: Seattle, WA
Agreed. Someone PLEASE put that in the developer section of riocar.org.

Isn't some of it already in there, though?
_________________________
Tony Fabris

Top
#102564 - 11/07/2002 17:00 Re: Tuner serial interface [Re: tfabris]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
Ummm don't think so. There is a large section on stalk commands in the Main -> Mk2 Hardware section of the developer guide but it really glosses over the actual commands to tuner (mentions only the 02 command) and concentrates on the stalk stuff
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#102565 - 17/07/2002 12:28 Re: Tuner serial interface [Re: altman]
caederus
journeyman

Registered: 18/02/2000
Posts: 51
Loc: UK
That's exactly what I needed, thanks!

Now to find the UFC1384 data sheet...
_________________________
http://ro.nu/ Robin O'Leary

Top
#102566 - 17/07/2002 18:09 Re: Tuner serial interface [Re: caederus]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
I thought they were made by microtune... although that may be the complete module itself rather than the main IC (which might be made by Temic).

http://www.microtune.com/products/1384_Series.html

I have attached the Microtune .PDF brochure but it's not what you're after


Attachments
104369-PB-00013 1384 Series.pdf (689 downloads)

_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#102567 - 17/07/2002 18:12 Re: Tuner serial interface [Re: Shonky]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
OK,

Temic is owned by Microtune so that makes sense...
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#102568 - 18/07/2002 02:48 Re: Tuner serial interface [Re: Shonky]
altman
carpal tunnel

Registered: 19/05/1999
Posts: 3457
Loc: Palo Alto, CA
Come to think of it, the datasheet for the tuner wasn't under NDA, so I'll save you some hassle:

http://utter.chaos.org.uk/~altman/temic_7660.pdf

(though if someone else wants to mirror/host this I'm happy, it may not stay there forever)

Hugo

Top
#102569 - 18/07/2002 04:58 Re: Tuner serial interface [Re: altman]
smu
old hand

Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
This (as well as the DSP docu) is now in the downloads section of riocar.org, under add-ons/documentation for now.

cu,
sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord

Top
#359473 - 23/08/2013 10:44 Re: Tuner serial interface [Re: smu]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14494
Loc: Canada
Updated link for the temic_7660.pdf datasheet:
http://riocar.org/download.php?op=getit&lid=43

Top