Making an FM radio-Part 1; the TEA5767

I’ve started to build a little FM radio with one of this cheap modules with a Phillip chip, the TEA5767. I will control it with a MSP430, probably I’ll use some kind of encoder to change stations and a potentiometer for the volume.

The TEA5767 is a single-chip electronically tuned FM stereo radio for low-voltage applications with fully integrated Intermediate Frequency (IF) selectivity and demodulation. Most of the information of this devices is from the datasheet and this app note.

Module Pinout

The I2C-bus mode is selected when pin BUSMODE (PIN 3) is LOW. The serial interface use pin 1 as SDA and PIN 2 as SCL. The board is powered with 3.3V with VCC being PIN 5 and GND in PIN 6.  PIN 10 is there to connect an external antenna (just a piece of wire) and PIN 7 and 8 are the audio outputs.  Pins 4 and 9 are left unconnected.

radio

Some basic theory

First of all let me explain some basics concepts about FM radio receivers in order to understand how to configure the different settings this chip has. I might be oversimplifying some things here, I’m just writing what I’ve read and understood while searching information to use this thing so beware of mistakes!

The superheterodyne is a circuit arrangement that is the basis of almost all modern radio receivers. Edwin Armstrong invented in 1918 the idea of a heterodyne receiver. Heterodyning is the translation of a signal from a higher Radio Frequency (RF) carrier signal to a lower Intermediate Frequency (IF). There are three important frequencies in heterodyne RX; RF Radio Frequency, the center frequency the signal is broadcast on; IF Intermediate Frequency, fixed frequency inside the RX (the RF signal is downconverted to this frequency) and LO Local Oscillator, tunable frequency inside the RX used to translate the RF signal to the IF frequency.

Structure of the Superheterodyne Receiver [c1]

radio-001

The mixer uses a non-linear component to produce both sum and difference signals, each one containing the modulation contained in the desired signal. The output of the mixer may include the original RF signal at fd, the local oscillator signal at fLO, and the two new frequencies fd+fLO and fdfLO. The mixer may inadvertently produce additional frequencies such as 3rd- and higher-order intermodulation products. The undesired signals are removed by the IF bandpass filter, leaving only the desired offset IF signal at fIF which contains the original modulation (transmitted information) as the received radio signal had at fd.

The idea behind an IF Intermediate Frequency is that you need to have the rest of your sistem tuned to a particular frequency not dependent on the receiving frequency and that greatly simplifies optimization of the circuit. In the TEA5767 the IF frequency is 225kHz. The IF amplifier can be made highly selective around its center frequency fIF , a more “selective” receiver is able to select the station you want and keep out other stations. By tuning the frequency of the local oscillator fLO, the resulting difference frequency will be matched to the IF amplifier’s frequency fIF for the desired reception frequency fd.  [c2]

In a receiver, when the LO frequency is below the RF, it is called low-side injection and the mixer a low-side downconverter; when the LO is above the RF, it is called high-side injection, and the mixer a high-side downconverter.[c3]  That is

fLO= fd+fIF   high-side injection

fLO= fd-fIF   low-side injection

The TEA5767 has the ability to work with both high and low-side injection.  This is to avoid the problem of image frequencies. Other signals produced by the mixer (such as due to stations at nearby frequencies) can be very well filtered out in the IF stage, giving the superheterodyne receiver its superior performance. However, if fLO is set to fd + fIF, then an incoming radio signal at fLO + fIF will also produce a heterodyne at fIF; this is called the image frequency and must be rejected by the tuned circuits in the RF stage.

Don’t believe me? Let’s do the math;

You want to hear the station on 97,5 Mhz so the Local oscillator will have to be tune to

fLO= fd+fIF   (high-side injection) → fLO=97,5 Mhz + 225 kHz = 97,725 MHz

so, with that frequency in the Local Oscillator you’ll get

fLO fd= 97,725 MHz – 97,5 Mhz =225 kHz=fIF (you’ll hear this one)

fLO+ fd= 97,725 MHz + 97,5 Mhz =195,225 MHz fIF  (this one won’t pass)

That’s pretty simple now imaging you have an RF frequency of  fLO + fIF= 97,95 MHz and;

|(fLO + fIF)- fLO|= 97,95 MHz – 97,725 Mhz =225 kHz= fIF  here again the difference is 225 kHz and this other radio station would also be heard, though not as well as the one at 97,5 Mhz because the RF tuned circuits largely remove it. This is the image frequency.

Let’s do the same procedure but now using low-side injection;

fLO= fdfIF   (low-side injection) → fLO=97,5 Mhz – 225 kHz = 97,225 MHz

again, with that frecuency in the LO you’ll get

|fLO fd|= 97,225 MHz – 97,5 Mhz =225 kHz= fIF 

|fLO+ fd|= 97,225 MHz + 97,5 Mhz =194,725 MHz fIF  (this one won’t pass)

now there will be a frequency fLOfIF= 97 MHz with the same problem;

|(fLOfIF)- fLO|=|97 MHz – 97,225 Mhz| =225 kHz= fIF another image frequency

You have this two image frequencies at fd±2fIF that might pass through but at least you can choose to have the one that interfere less with the station you want to hear.

Tuning of the local oscillator and the RF stage may use a variable capacitor, or varicap diode. Nowadays digital tuning systems are replacing the conventional mechanical systems in AM and FM receivers. One of this digital tuning systems is the Phase Locked Loop (PLL).The PLL is often used to synthesize the local oscillators used in communication transmitters and receivers. In a typical scenario, we might have a crystal oscillator which provides an accurate frequency reference at a relatively low frequency, the TEA5767 module uses a 32,768kHz crystal. We wish to use this to derive an accurate frequency reference at a higher frequency which will be the local oscillator used at an IF or RF stage in the transceiver.[c4]

Structure of a PLL

radio-002

I’m not exactly sure about how the PLL works but the important thing here is to understand that we have control over the Frequency Divider shown in the diagram. Using a simple formula a 14bit  number is calculated (the “k” value) and used in that divider in order to receive a certain station.

In case of using High side injection the following expression is used;

Ndec= \frac{4*(F_{RF}+F_{IF})}{F_{FREF}}

Talking to the TEA5767

The device has an I2C serial interface and the data sequence is as follow: address, byte 1, byte 2, byte 3, byte 4 and byte 5, both when writing and reading. The IC address is ob11o oooo.

The first two bytes are quite simple. MUTE has to be at 0 to unmute both channels and SM also at 0 because I won’t be using the search  mode. The rest of the bits are for the number I have to send for th PLL to set the station frequency. Using as an example FM 97, 5;

Ndec= \frac{4*(97,5MHz+225kHz)}{32,768kHz}=11.962=0x2EBA

In the third byte the three MSB are used in the search mode, I’m not using it so those three will be set as 0. HLSI is to choose between Low/high side injections. The formula I used to calculate the PLL frequency divider is for a High Side injection setup so that bit has to be set to 1. MS will be at 0 to choose a stereo output instead of mono. MR and ML will be at 0, otherwise right and left channel would be muted. Finally, SWP1 is for a software programmable port which I don’t have access to and won’t be using so I’ll put there a 0.

In the fourth byte there is another software programmable port and again this will be at 0.  STBY is set at 0 to avoid Standby mode. BL is set at 0 to use the US/Europe band limits (i’m in Argentina). XTAL is set at 1 because the board is using a 32,768kHz crystal.  SMUTE, HCC, and SNC will activate different functions with the intention of improving the sound quality, I’ll just ignore them for now and set those three bits to 0. The LSB is SI which is related to SWPORT1 and I can’t use it so, again, 0.

In the last byte there are only two bits to configure. PLLREF has to be set at 0 to disable the 6,5 Mhz reference and DTC is 1 to use a de-emphasis time constant of 75us. The rest of the bits are not used.

After figuring out what to send to the module I made a simple program and connected the TES5767 to a Launchpad. I’m using a MSP430F2012, the code is built in IAR and I’m using TI’s library for the I2C communication to makes things easier.

radio-003

As you can see in the code there are only a couple of functions. Luckily all the time spent to understand the chip paid off and the radio worked inmediatelly.

#include <msp430x20x2.h>
#include "USI_I2CMaster.h"

int StatusCallback(unsigned char c)
{
return TI_USI_EXIT_LPM; // Exit active for next transfer
}

void main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;

BCSCTL1 = CALBC1_16MHZ; // Set range
DCOCTL = CALDCO_16MHZ; // SMCLK = DCO = 1MHz

/* Initialize USI module, clock ~ SMCLK/128 */
TI_USI_I2C_MasterInit(USIDIV_7+USISSEL_2+USICKPL, StatusCallback);

unsigned char TxDataConfig[5] = {0x2E,0xBA,0x10,0x10,0xC0};

/*Write data, configuration register
TI_USI_I2CWrite(SlaveAddress, Length, Multi, TxData) */
__disable_interrupt();
TI_USI_I2CWrite(0x60, 5, 0,TxDataConfig);
__bis_SR_register(LPM0_bits + GIE);

TI_USI_I2CStop();

}

MSP430 Launchpad and TEA5767 FM radio module

MSP430 Launchpad and TEA5767 FM radio module

EDIT: I made a mistake calculating Ndec, I divided by 32678 Hz instead of 32768 Hz. The correct number for 97.5Mhz is 11929 = 0x2E99.


19 thoughts on “Making an FM radio-Part 1; the TEA5767

  1. Great!
    I used your explanations to get my TEA5767 Devboard running.
    Its an Atmega32 Devboard with a build in TEA5767 module and a display header for standart 1602 LCDs. It works great with an encoder for tuning the frequency. Now I just need to implement some kind of station memory and its good to go to replace my crappy batroomradio 🙂

    • glad you like it! I finished it (at least in a breadboard…) and the final designd has four 7-segment displays controlled with a PCF8574 and some transistors and a TPA6021 as audio amplifier. The amplifier uses a pot for volume. I’m soldering everything together…

  2. Hi,
    First of all, thank you very much for your work on this chip, you saved me a lot of time of datasheet exploration 🙂

    I just wanted to point a little mistake on the last schematic, you exchanged P1.7 and P1.6.
    P1.7 is SDA and P1.6 is SCL.

    Thanks again, Bye!

  3. Hello , I keep on having problems with the calculation of N (dec). Base frequency of 95.5Mc gives
    a result of 11.962 (0x2EBA). But when I do the calculation , I’m having another number. Is there
    something I’m doing wrong?
    Thanks in advance
    Ron

  4. have you any idea to increase the sound of tea5767…..actually I have made this with Raspberry Pi…but the problem the the sound of tune channel is very low….please inform…and if it is possible to share on my email… er.saurabh2890@gmail.com …then share…..thanks

  5. Pingback: Inici projecte Raspberry Pi: Mopidy + TEA5767 (Ràdio FM) – Parufito

  6. Is it possible to hard wire the module to receive one FM station without any programming or extra hardware (apart from audio amp)? Is there any detail info available on this module?

    • I don’t think so. You need to configure the module through I2C bus, not only set the station but also other registers like band limits. Maybe I’m wrong and somebody else know how to do it, if so please share!

  7. Pingback: Making an FM radio-Part 1; the TEA5767 • Tech Projects

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s