xFM Radio v04 (HTC X1)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scott8813
    InsomniAddict
    • Feb 07
    • 1061

    [RELEASE] xFM Radio v04 (HTC X1)

    xFM Radio v0.4 (HTC, X1...)


    Pic:

    RDS FM Radio research: Get radio text, Alt Freqency, Traffic Message
    This is a project that still on research & analysis stage.
    Many people ask questions about FM radio in the forum can be solved by this project.
    Problems to be solved by this project for on HTC diamond/Raphael/blackstone etc:
    1. Does FM Radio supports RDS text and traffic information?
    2. Does FM Radio supports more than 20 saved channels?
    3. Can I give a channel a friendly alias, such as "BB Radio 4" rather than 920.2MHz ?
    4. Does FM Radio supports automatically or manually change frequency when signal getting pool during traveling?
    5. Does FM Radio works without earphone?
    6. Does FM Radio support RDS-TMC traffic information for navigation system?
    The answer is yes. The Bluetooth/FM radio chip BRF6350 on your phone is very powerful but HTC FM radio only provides basic functionality, worse than other platforms like nokia phones or your in-car FM radio.
    Unfortunately HTC doesn't publish FM Service API to us.
    So I disassembled FM player by using IDA pro and know usages of FMS api.
    After a week sleepless night, I wrote my FM radio tool, xFMRadio, utilizes most functions provided by FMS API, provides RDS and other data for further research.
    Download xFM Radio v0.3
    Brief user guide for xFMRadio 
    Default settings: Audio Source: 1 (earphone), RDS =1, Verbose =1, AF = 1. ( but I don't know if automatic AF is working. have to verify during long distance traveling.)
    Verbose: 0 -no log; 1 - status only; 2 - TMC raw data; 3 - all types of log
    Row 1: Input argument. Set Frequency in KHz, AF list: alternative frequencies for the current station. 
    Row 2: Frequency, station name, Band: World/Japan - use this to listen police station etc
    Row 3: Signal Strength, Stereo/Mono, UTC Date/Time (update once per min if supported)
    Row 4: -100KHz, Previous Channel, Next Channel, +100Hz, Mute, Mono/Stereo
    Row 5: Headset/Speaker, De-emphasis, Stereo blend 
    Row 6: Radio Text
    Row 7: status such as Music/Speech, TP, TA, PTY etc
    Check if the station support TMC: set the top left input box to 2, and click on Menu->Verbose.
    To see RDS raw data, set the top left input box to 3, and click on Menu->Verbose.
    You can use Save log menu to save log data.
    FMS API version is displayed in the About dialog.

    Supported devices
    HTC Diamond
    HTC Raphael (not CDMA yet)
    HTC Blackstone (confirmed by kaefert)
    HTC Polaris (confirmeded by iseeka)
    SE Xperia X1 (confirmed by fards)
    HTC Rhodium
    HTC Topaz
    Maybe more

    Call other device owners to test on your device.
    If cannot run it, you may need to download and copy FMS.dll and FMS_API.DLL into your device (see johnpatcher's post below).

    History
    Update on 22 April 09:
    xFMRadio 0.4
    Implemented AF parser
    Improved AF selection usability
    Support TMC status - so you don't have to change verbose to check if a station supports TMC
    Integrate with system volume control 
    Setting of RSSI search level - default 10.
    Fix bug: Application didn't show at foreground if run app again.

    Update on 18 April 09:
    xFMRadio 0.3.
    Use RDS parser. It gets much more information and must faster from RDS than build in API now.
    Add Bigger box for RT.
    Add Status box for TP, TA, PTY etc
    Display station Date/Time and timezone
    Display TMC raw data if verbose >
    Display ProgramItem, paging id, language id etc in log if the station supports them.
    Radio 0.3 API

    Update on 5 April 09:
    I've uploaded FMRadioAPI wrapper.
    It is a C++ class. Please read comments in the header file, which should provide sufficient information to use it.
    You may implement FMRadioAPI::IFMEvents::OnFMRadioRDSData(const FMRadioAPI::TFMRDSData & aRDSData) to get raw RDS data.
    Note that event functions are running in different thread so you may need synch objects.

    Known issues
    * SetVolume doesn't work. It is overrided by system volume control. Maybe have to use waveOutSetVolume?
    * Stereo/Mono state and settings seems not working. Maybe it is not supported by device.

    Troubleshooting ,
    * Cannot start
    copy FMS.DLL and FMS_API.DLL into same directory. See johnpatcher's post.
    Try soft reset?
    * No sound
    Plug your earphone in before running this app
    Turn volume up
    Try Soft reset?
    * No RDS data
    Please make sure you are in a place that have strong FM Radio signal.
    Wait for longer time
    Check Raw RDS output

    FAQ >
    1. What is RDS?
    Radio Data System, FM radio station sends digital data during broadcasting.
    Search in wikipedia to know more.
    2. What digital data does RDS transfer?
    * PS - Name of channel. 8 ANSI characters. Fixed length
    * AF - Alternative frequencies: you can choose one or radio itself automatically choose a better frequency when signal getting poor
    * PT - Program type
    * RT- Radio text. can be replaced or appended.
    * TA - Traffic Announcement: when radio program starting announce traffic info, it reminds you.
    * TMC - Traffic Message Channel: provide digital traffic information like TOMTOM traffic.
    * CT - clock time *
    ...And more you can find from wikipedia
    3. where can I find those radio stations support RDS?
    RDS is a EU standard so it is popular in EU.
    US has a modified version of RDS, RBDS, which has slight different protocol.
    4. What is xFMRadio?
    It is a analytical tool help me validate FMS API, and RDS data.
    It supports RSSI, PS, AF, RT, PI, Raw RDS data etc.
    I don't know what name shall I use so I use a letter x. eXperience, xda-developers.. whatever.

    5. What is...
    RSSI: Received signal strength indication. Maximum value still unknown. I guess it is 32.
    PI: Programme Identification the unique code that identifies the station.
    See #2 for others
    6. What's next?
    Write a powerful FM Radio application, maybe a tab in the manila UI?
    Analyze RDS raw data and write a parser to extract more useful data.
    Redirect RDS-TMC data to navigation software.
    7. what is format of raw RDS?
    RDS is a complicated format to broadcast narrow band with repeat data.
    Its transfer speed is just 1.1Kbps, with large proportion of flow control bits.
    e.g. when it sends a station's name, it sends every two ANSI characters in a 104 bits coding structure, and usually do not consequently send all strings together.
    Currently decoding is done by FMS.dll, only provides limited features.
    The RAW RDS format is different from RDS standard. each data package is in a form of 16 bits data + 8 bits type, instead of 16 bits data + 10 bits offset.
    You can find kolomparrudi's analysis in this thread. )
    8. I don't have diamond/raphael/blackstone. Does it work with my phone?
    I considered resolution so the program should work on QVGA devcies.
    Your phone must have BRF6350 chipset with FMS.dll and FMS_API.dll.
    9. can it support TMC and provide traffic data to my navigation system?
    This is technically feasible now.
    Thank kolomparrudi for successfully extracting TMC data from RDS raw data stream.
    If you can find "PI PI 20 8X YY 21..." in the raw data stream, X<8, the data after that is TMC data. ("PI PI" appears every 12 bytes)
    10. Can I use it without earphone?
    Theoretically yes. But you need plug a USB cable in as antenna.
    FM Radio wave length is much longer than GSM/BT/WIFI etc so it needs a long antenna.
    Also the current version cannot play radio without earphone although RDS works.
    * UI is ugly
    Yeah. This is a testing utility so UI will be the last thing to be considered.
    I will write a nice UI in a real radio player - is there any c++ HTC T3D style UI library available?
    If not I will have to write my own.
    * location (GPS/AGPS) based frequency switch and stations list.
    Feasible.

    * Adjust system clock
    Feasible.
    Code:
    http://forum.xda-developers.com/showthread.php?t=497977



    [ Last edited by holy1661 on 2009-04-23 07:54 ]


    Attached Files
    sigpic

Working...