RealTek RTL2832U

From LinuxTVWiki

Revision as of 23:27, 7 June 2013 by RodrigoT (Talk | contribs)
Jump to: navigation, search

Contents

General Description

(from the specifications page at RealTek [1]) The RTL2832U is a high-performance DVB-T COFDM demodulator that supports a USB 2.0 interface. The RTL2832U complies with NorDig Unified 1.0.3, D-Book 5.0, and EN300 744 (ETSI Specification). It supports 2K or 8K mode with 6, 7, and 8MHz bandwidth. Modulation parameters, e.g., code rate, and guard interval, are automatically detected.

The RTL2832U supports IF (Intermediate Frequency, 36.125MHz), low-IF (4.57MHz), or Zero-IF output using a 28.8MHz crystal, FM/DAB/DAB+ Radio Support. Embedded ADC (Analog-to-Digital Converter).


Features

  • COFDM compliant with Nordig Unified 1.0.3, D-book 5.0, and ETSI 300-744
  • Supports multiple IF frequencies (4.57MHz or 36.167MHz) and spectrum inversion
  • Includes Radio Support (FM/DAB/DAB+)
  • Includes ISDB-T(SBTVD-T) 1-Seg
  • Supports Zero-IF input
  • Single low-cost crystal for clock generation (±100ppm)
  • Automatic transmission mode and guard interval detection
  • Impulse noise cancellation circuits
  • Automatic carrier recovery over a wide range offset (±800KHz)
  • Superior performance with pre/post/long echo profiles
  • Embedded adjacent and co-channel interference rejection circuit
  • Delayed AGC with programmable Take-Over Point (TOP)
  • 7-bit ADC for RF signals level measurement
  • Hardware MPEG-2 PID filters
  • Infra-red port for remote control and wake-up, protocols supported are:
  • Microsoft RC6 protocol
  • NEC, Sony, SIRC, RC-5 protocol
  • Eight general purpose I/O ports
  • USB 2.0 Interface
  • Supports USB Full/High speed
  • Configurable vendor information via external EEPROM
  • Passes USB-IF certification
  • Signal 3.3V external power is required
  • 48-pin QFN (6x6 mm2) Green Package

Drivers

At present drivers of various quality can be found on the net although none have been known to work consistantly.

For the Zazz ezcap DVB-T FM DAB and Twintech UT30 the following driver works :

[[2]]

The driver at [[3]] seems to work fine under Ubuntu 12.04

Another version of it has support for the R820T tuner and is compatible up to kernel 3.8

It appears that the current LinuxTV Drivers support the RTL2832u chipset (sometimes identified as 2838 or RTL2838). Directions for installation are here: http://git.linuxtv.org/media_build.git

Remote Control

Devices using this chip support infrared remote controls, but unlike other cases, the infrared signal is captured and passed to the kernel without any processing, delegating the detection and decoding of the protocol to the kernel. This means that no default remote control is configured and the user must configure the mapping of the commands to keyboard events manually.

Steps to follow:

  • Plug you device and check dmesg for the proper messages:
[ 1573.042013] usb 2-1.1: New USB device found, idVendor=1f4d, idProduct=b803
[ 1573.042019] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1573.042025] usb 2-1.1: Product: RTL2838UHIDIR
[ 1573.042030] usb 2-1.1: Manufacturer: Realtek
[ 1573.042035] usb 2-1.1: SerialNumber: 00000001
[ 1573.042299] usb 2-1.1: usb_probe_device
[ 1573.042305] usb 2-1.1: configuration #1 chosen from 1 choice
[ 1573.045841] usb 2-1.1: adding 2-1.1:1.0 (config #1, interface 0)
[ 1573.047764] usb 2-1.1: adding 2-1.1:1.1 (config #1, interface 1)
[ 1573.056506] dvb_usb_rtl28xxu 2-1.1:1.0: usb_probe_interface
[ 1573.056512] dvb_usb_rtl28xxu 2-1.1:1.0: usb_probe_interface - got id
[ 1573.056522] usb 2-1.1: dvb_usb_v2: found a 'G-Tek Electronics Group Lifeview LV5TDLX DVB-T' in warm state
[ 1573.056542] dvb_usb_rtl28xxu 2-1.1:1.1: usb_probe_interface
[ 1573.056545] dvb_usb_rtl28xxu 2-1.1:1.1: usb_probe_interface - got id
[ 1573.056574] usbcore: registered new interface driver dvb_usb_rtl28xxu
[ 1573.098049] usb 2-1.1: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer
[ 1573.098063] DVB: registering new adapter (G-Tek Electronics Group Lifeview LV5TDLX DVB-T)
[ 1573.102316] usb 2-1.1: DVB: registering adapter 0 frontend 0 (Realtek RTL2832 (DVB-T))...
[ 1573.110906] i2c i2c-19: fc0012: Fitipower FC0012 successfully identified
[ 1573.123087] Registered IR keymap rc-empty
[ 1573.123200] input: G-Tek Electronics Group Lifeview LV5TDLX DVB-T as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/rc/rc0/input24
[ 1573.123268] rc0: G-Tek Electronics Group Lifeview LV5TDLX DVB-T as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/rc/rc0
[ 1573.124312] IR NEC protocol handler initialized
[ 1573.124313] IR RC5(x) protocol handler initialized
[ 1573.124314] IR RC6 protocol handler initialized
[ 1573.125273] IR JVC protocol handler initialized
[ 1573.125331] IR SANYO protocol handler initialized
[ 1573.125425] IR MCE Keyboard/mouse protocol handler initialized
[ 1573.125517] input: MCE IR Keyboard/Mouse (dvb_usb_rtl28xxu) as /devices/virtual/input/input25
[ 1573.125595] usb 2-1.1: dvb_usb_v2: schedule remote query interval to 400 msecs
[ 1573.125645] IR Sony protocol handler initialized
[ 1573.126330] lirc_dev: IR Remote Control driver registered, major 250 
[ 1573.126605] rc rc0: lirc_dev: driver ir-lirc-codec (dvb_usb_rtl28xxu) registered at minor = 0
[ 1573.126608] IR LIRC bridge handler initialized
[ 1573.138186] usb 2-1.1: dvb_usb_v2: 'G-Tek Electronics Group Lifeview LV5TDLX DVB-T' successfully initialized and connected

Here we can see the different steps in the detection and initialization of the hardware, from the USB discovery, to the DVB driver being loaded, and the different IR protocol decoders.

  • Checking the remote: now that we know the system knows about the hardware, we need to check if the remote control subsystem is up and running, for this we need to invoque the utility ir-keytable as root:
ir-keytable 
Found /sys/class/rc/rc0/ (/dev/input/event12) with:
	Driver dvb_usb_rtl28xxu, table rc-empty
	Supported protocols: NEC RC-5 RC-6 JVC SONY SANYO LIRC other 
	Enabled protocols: NEC RC-5 RC-6 JVC SONY SANYO LIRC other
	Repeat delay = 500 ms, repeat period = 125 ms

Make sure all protocols available are enabled, also check the remote control deice (rc0), the event device (event12) and the driver name (dvb_usb_rtl28xxu). This values may differ between systems but just in the number at the end of the devices names. To check the reception of remote control codes, run the same utility in test mode, modify the device name if neccesary:

ir-keytable -s rc0 -t
Testing events. Please, press CTRL-C to abort.
1370640168.669141: event MSC: scancode = 2bd09
1370640168.669141: event sync
1370640171.109126: event MSC: scancode = 2bd07
1370640171.109126: event sync
1370640171.922873: event MSC: scancode = 2bd15
1370640171.922873: event sync

These events lines should appear when pressing keys in the remote control. If they do not appear check you have all the IR protocol decoders loaded and active, and the remote has batteries (Trick: most digital cameras see the infrared, just point it to your mobile phone, or webcam and see if the led blinks when pressing a key). There is a small chance your remote is using a not yet supported protocol, try with other remote controls in your home just in case.

  • Configure the keymap: knowing the remote control commands are detected, we need to convert then to keyboard events, for this we need to load a keymap to translate them. If you are using the remote control supplied with the device, there is a high chance you already have a file with this mapping, if not you can always write your own. First we will try if we already have the mapping file. Choose a key in yor remote control and write down the scancode reported by ir-keytable. In this case i will use the scan code 2bd15 wich appears when pressin the OK key in my remote control.

Now look for this scan code in the keymap files of your system:

grep -i 2bd15 /etc/rc_keymaps/*
/etc/rc_keymaps/terratec_slim:0x02bd15 KEY_OK
/etc/rc_keymaps/total_media_in_hand:0x02bd15 KEY_OK

Bingo!, not only one but two keymaps match both the scancode and the expected key. To see which would be a better choice make a diff of both files and check the differences. In my case the key for "POWER" is different in each file, and with the help of ir-keytable -t I can see the configuration file matching the scancode in my remote is "/etc/rc_keymaps/terratec_slim". Now loading the file is as easy as ir-keytable -s rc0 -w /etc/rc_keymaps/terratec_slim:

r-keytable -s rc0 -w /etc/rc_keymaps/terratec_slim
Read terratec_slim table
Wrote 28 keycode(s) to driver
Protocols changed to NEC 

Repeting the test:

ir-keytable -s rc0 -t
Testing events. Please, press CTRL-C to abort.
1370641923.915169: event MSC: scancode = 2bd15
1370641923.915169: event key down: KEY_SPACE (0x0039)
1370641923.915169: event sync
 1370641924.164968: event key up: KEY_SPACE (0x0039)
1370641924.164968: event sync
1370641927.141085: event MSC: scancode = 2bd00
1370641927.141085: event key down: KEY_1 (0x0002)
1370641927.141085: event sync
11370641927.390980: event key up: KEY_1 (0x0002)
1370641927.390980: event sync
1370641928.759008: event MSC: scancode = 2bd06
1370641928.759008: event key down: KEY_7 (0x0008)
1370641928.759008: event sync
71370641929.008949: event key up: KEY_7 (0x0008)
1370641929.008949: event sync
1370641930.376940: event MSC: scancode = 2bd45
1370641930.376940: event key down: KEY_POWER2 (0x0164)
1370641930.376940: event sync
1370641930.626916: event key up: KEY_POWER2 (0x0164)
1370641930.626916: event sync

See the space and extra '1' and '7' leading the key up lines? those are keypress from the remote!!, also the name of the key press is printed next to the scan codes.

  • No matching keymap file: if you are using a remote control not listed among the suplied keymaps, you will need to write your own, for this write a file in /etc/rc_keymaps with this structure:
# table TTTT, type: UUUU
0xAAAAAA KEY_XXXXX

Where TTTT is the name of the table you choose to use, UUUU is the protocol, for this load only one protocol at a time with ir-keytable -p UUUU until you get scancodes during the test mode again. Then one per line, add the scancode you got from the test mode of ir-keytable ,preceded by '0x', and separated by a tab or spaces the name of the key you want to emulate. For a list of theys vist Remote_Controllers or [4]. Save the file and load it as shown before.

  • Loading the keymap automatically: to load the keymap automatcally, you need to edit the file /etc/rc_maps.cfg adding the line:
dvb_usb_rtl28xxu  *   terratec_slim

The values are: the driver name, the tabke name (* for any) and the keymap filename.

All this information is not but an adaptation of the one privded here[5].

Original Vendor-released driver

Unknown

Missing drivers

External Links

Personal tools