Shop OBEX P1 Docs P2 Docs Learn Events
FM Receiver Module documentation — Parallax Forums

FM Receiver Module documentation

Ron CzapalaRon Czapala Posts: 2,418
edited 2012-11-05 07:50 in General Discussion
Has anyone found detailed information about the RDA5807SS tuner chip in this module?

I found the datasheet but it doesn't discuss the register settings.
The Parallax documention is helpful, but I would like to see the RDA documentation.

The Parallax examples for the BS2 and Propeller have some default settings but I have questions about usage of the GPIO pins.

Also the examples set the 0x04 register to 0x0400 which sets bit 10 high but Parallax documentation does not show what bit 10 is used for...

Comments

  • TimCTimC Posts: 77
    edited 2011-06-05 06:35
    Ron,
    I just started working with the tuner chip. I must say it works quite well with just a 3" wire for an antenna. I searched for the RDA5807SS data sheet and did not find anything good. Just a pre-release PDF.
    My frustration started when I wanted to to use the instruction I2CIN on my BS2PX just to read the status registers. Seems as though the RDA5807SS doesn't follow the standard I2C addressing conventions. $Licensing maybe?? But there is a setting to change that. Very strange.

    <dream on>
    Oh Parallax Can you please tell "Parallax HK ltd., SZ RO" who wrote the RDA5807ss.bs2 example code on 2011-03-04 to tell us about the mystery registers and an example on how to use the regular I2C commands??
    <dream off>

    Regards
    Tim C
  • Mike GreenMike Green Posts: 23,101
    edited 2011-06-05 07:08
    TimC,
    Read the documentation supplied on Parallax's webstore page for the module. It's not anywhere complete, but it does give the register layouts for the commonly used registers used in the sample code. The BS2 sample code has to do the I2C protocol by "bit banging" because the BS2 doesn't have built-in I2C support as the BS2p series modules have. The "bit banging" method will work on all models of the Stamp. If you look through the sample code, you'll see that the I2C address used is %00100000.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2011-06-05 10:55
    TimC,

    I sent a private message to Jessica asking if she could provide us more info on the registers or point us in the right direction.

    Here is a video you might find interesting
  • Kevin CookKevin Cook Posts: 159
    edited 2011-06-20 12:57
    @ Tim

    There is nothing mysterious about the registers, the documentation we have outlines them very well. If you look at our sample code, both the BS2 and SPIN, you can see how the registers are setup (RDA5807SS_Driver2.Spin & ParallaxFMRadio.bs2). Compare the values of the code to the documentation (convert to binary) and you will see how the FM module is setup. You can adjust these registers easily to change the way the FM module operates.

    Can you clarify what you mean by "regular I2C commands"?
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2011-06-20 13:43
    I PM'd Jessica Uelmen about these since register 0x04 bit 10 is set in the example code but not referenced in the documentation.

    Here are her comments:
    Very interesting. This product was designed by our engineers in Parallax Hong Kong, I'll send them an email.

    I do have a second set of documentation, but unfortunately the company doesn't allow us to share the actual document (plus, it's in Chinese). I just rechecked it, and they also don't have bit 10 referenced.

    I'll send an email to the engineers that designed this product & get you an answer!
    But I heard back from the engineers that designed it, and basically they set the code that way because the Chinese programming guide recommended to set that bit by default. In doing some research with similar chips, it seems that bit may disable the Auto Gain Control, but our engineers over there tried it and didn't notice a difference.

    So unfortunately I have no good answer, except that it doesn't appear to do anything. :\
  • TimCTimC Posts: 77
    edited 2011-06-25 19:34
    @Kevin
    My problem with the I2C commands is I could not get I2C in to work using the BS2px chip. The reason I wanted to use the BS2px is because I was running out of ram and code space.

    Working with the Stamp example code I first switched pins 0 and 1 so SDA is on pin 0. Then I replaced the read status subroutine with:

    I2CIN 0, %00100000, $0A, [Status.Highbyte(0),Status.Lowbyte(0),status.Highbyte(2),status.Lowbyte(2)]

    Maybe my code is wrong but I think the problem is the RDA5807SS chip does not use the I2C change of direction bit. I2C convention says the read address is +1 of the base address. I believe the basic stamp I2C command automatically adds the change of direction bit. When I did get the chip to read back the status I used a low order address bit of 0.

    It also did not seem to matter the address of the register I was trying to read back. So if I only wanted the second status byte I would have to read the first byte as well. Also I could not read any of the config words only write to them.

    There is a I2S_ENABLED bit in register 4 and I assume this means I2C but I could not get it to work.

    There are a lot of bits in the configuration registers that are just not mentioned. They should be labeled RESERVED or something.

    REG2 bits:2,3
    REG4 bits:10,13,15
    REGB bits: 0-6

    REG6 is very strange. The basic stamp example sets it at $40,$00. The spin code has it at $0000 The documentation says nothing about REG6

    Regards
    Tim
  • TimCTimC Posts: 77
    edited 2011-06-26 17:54
    I have made some progress using I2CIN and I2COUT commands. The rule of thumb I am using is:

    When reading use an address byte. When writing do not use an address byte.

    The following snip-it works:
    '========================[Write/Read data to/from FM module ]=====================
    Write_ConfigRegs: ' Write Data to Configure Registers
    I2COUT SDA, WrFM, [Conf2.Highbyte, Conf2.Lowbyte, Conf3.Highbyte, Conf3.Lowbyte, Conf4.Highbyte, Conf4.Lowbyte, Conf5.Highbyte, Conf5.Lowbyte, Conf6.Highbyte, Conf6.Lowbyte]
    RETURN

    Read_Status:
    I2CIN SDA, RdFM, 0, [Status1,Status2,status3,status4]
    DEBUG CRSRXY,10,1,"Status : ", HEX2 status1, " ", HEX2 status2, " ", HEX2 status3, " ", HEX2 status4, " "
    RETURN
    '==========================================================================

    The read address does not matter. $0A is what you are reading but it could be anything.

    Two things slowed me down. My BS2px chip (1.0) does not work with this code, my BS2p (1.3) does. I2C commands and sub scripted word variables did not seem to work very well for me. The manual only mentions using STR variable\n but that did not work either.
  • TimCTimC Posts: 77
    edited 2011-06-27 17:35
    @ Kevin

    Don't forget to add these two bits to the documentation. They are both in the stamp code but would be best to be written down.

    Register 2 bit 9 SEEK_DIRECTION 1 = Seek UP, 0 = Seek DOWN
    Register 2 bit 8 SEEK 1 = Seek Enable
  • Kevin CookKevin Cook Posts: 159
    edited 2011-06-28 10:44
    Hey Tim,

    I'll have the document updated with the missing bits, including any bits that are reserved or not used. You're right it would be nice to have all of them listed.

    Thanks for all of your feedback!
  • edited 2011-06-30 06:44
    Hi Tim,

    I only have BS2p in the office. I don't know, but I believe you can run the code in BS2px.

    Because of the documents are "Confidential", so Parallax does not show the document to you. But Parallax will take no responsibility if you download these documents from other places. In fact, it's not that hard to find these documents in China. The chip is popullar in China, a lot people talk about this chip and share their files.

    Here is one of the links to these files, including Datasheet, Programming Guide, Demo code etc.
    (this link have many useful documents, but before the download process, you need to wait 30s, and some of the documents were written in Chinese.)

    FM Receiver Document Link

    Since the official programming guide was written in Chinese, you may not want to read it. So just want to remind you that RDA5807ss has two MAIN I2C addresses(I also mentioned about this in the Spin code). One I2C address($20/$21) use for Continue Read/Write, another one is use for Standard Read/Write($22/$23).
      '========================[Write/Read data to/from FM module ]=====================
    
    Write_ConfigRegs:                                ' Write Data to Configure Registers
    
      I2COUT SDA,%00100010,$02,[ConfigRegs.HIGHBYTE(0),ConfigRegs.LOWBYTE(0)]
      I2COUT SDA,%00100010,$03,[ConfigRegs.HIGHBYTE(2),ConfigRegs.LOWBYTE(2)]
      I2COUT SDA,%00100010,$04,[ConfigRegs.HIGHBYTE(4),ConfigRegs.LOWBYTE(4)]
      I2COUT SDA,%00100010,$05,[ConfigRegs.HIGHBYTE(6),ConfigRegs.LOWBYTE(6)]
      I2COUT SDA,%00100010,$06,[ConfigRegs.HIGHBYTE(8),ConfigRegs.LOWBYTE(8)]
    
     RETURN
    
    Read_StatusRegs:                                 ' Read StatusRegsRegs
    
      I2CIN SDA,%00100011,$0A,[StatusRegs.HIGHBYTE(0),StatusRegs.LOWBYTE(0)]
      I2CIN SDA,%00100011,$0B,[StatusRegs.HIGHBYTE(2),StatusRegs.LOWBYTE(2)]
    
     RETURN
    

    I also got some other information about this IC want to share with you guys. When I tested the FM Receiver Module, I also read some documents for Silicon Labs Si4702. The Register Map is really similar to RDA5807ss.

    More, RDA5807ss also compatible with NXP TEA5767, same I2C Address(another I2C address again, three address in total), same Register Map. Let's say you already have the code for TEA5767, you can drive the RDA5807SS without changing anything. In China many people try to use RDA5807 replace the TEA5767.

    I recommend that let it work in RDA5807ss mode. If you want to make it work in TEA5767 mode, you can try and enjoy it!

    Here is the BS2p Test code:RDA5807SS_BS2P.bsp
  • TimCTimC Posts: 77
    edited 2011-07-01 09:24
    John,
    Thank you so much for your support! This is just the answer I was looking for.

    I have scanned through all of the data sheets. There is so much to review.
    Some tidbits I have read so far are:
    Top I2C speed: 400Khz
    A lot of the mystery registers are really for compatibility with the other FM radio chips.
    The max current draw of the chip is low and may not support LED's attached directly to the GPIO pins.
    Register 4 Bit 10 might also be for AGC Enable (from the Si4702 datasheet)
    Register 6 is less of a mystery. If it does not exist does it still need to be cleared?

    One of the main reasons I was looking to use standard I2C syntax was to use less code and shorten the amount of data passed back and forth. A quick change in frequency while updating signal strength and stereo signal should be more responsive.

    I gave up on using subscripts within the I2C commands. Variable space is too precious and the basic stamp sub-scripting "rules" forced me to be inefficient.

    Someone who is willing to potentially sacrifice their chip could run a test on the GPIO lines. As a start attach a LED+Resistor to each of the 3 GPIO lines then write "101010" to the 5 low bytes of register 4. A warning should be sent out in the Parallax instructions not to attach a heavy load to the GPIO lines if the chip fizzles on any of the tests.

    Would be interesting to see if this chip actually had RDS in it. Hmmmm

    Thanks again John
  • walidelmasrywalidelmasry Posts: 2
    edited 2012-02-17 16:38
    First thank you all for useful and helpful topic and posts.
    Recently i have bought the module version part code (#27984) at "parallex.com".
    I already succeed interfacing it but have problems.

    1- If INT _MODE is set to 1 then the interrupt lasts until read register 0x0C occurs but 0x0C is not mentioned at all!.

    2- When reading the status registers,Whatever i do it return a certain value that never changes, and i tried two ways in reading.
    a) Send command write then Address to read(assume 0x0A) then Command read and after that reading 16 bit data back and do the same for 0x0B and 0x0C but in this way i get 23FF for all registers.
    b) The same as the last method but after reading 1st 16 bit data i continuously read the other 2 registers and in this case i get back 23FF FF FF.

    3- Whatever i write to 0X06 or not the module work fine!.

    4- In the CLK_MODE[2:0] i assumed am using 32.768kHz crystal which already mounted on the module but with no label on it and it worked fine unless if someone have different opinion about that.

    5- Is there an initialization process i have to do it cause i noticed that the module work after i do master clear after the power up, its may be a power problem but i need to make sure if am missing something.

    6- Unfortunately i can't understand the basic stamp code, am using pic16877a and was building a library to interface the module in C and already done with the write part which work as the following
         set_REG0x02(HI_Z_OFF,MUTE_OFF,MONO_OFF,BASS_ON,SEEK_DOWN,SEEK_OFF,SKMODE_WARP,CLKM_32KHz,SOFTRST_OFF,ENABLE_ON);
         set_REG0x03(996,TUNE_ON,BAND_76_108,SPACE_100KHz);
         set_REG0x04(STCIEN_ON,DE_75us,I2S_OFF,GPIO3_MS_I,GPIO2_INT,GPIO1_H);
         set_REG0x05(INT_READ,0b00001000,LNA_ANT,LNA_2_5mA,0b00001111);
         FM_Write(Cmd_WRITE,0x02,0,1); // 0~9 are address within array hold the configurations edited using set_REG0xXX
         FM_Write(Cmd_WRITE,0x03,2,3);
         FM_Write(Cmd_WRITE,0x04,4,5);
         FM_Write(Cmd_WRITE,0x05,6,7);
         FM_Write(Cmd_WRITE,0x06,8,9);
    

    i hope someone can help so i can finish it and start building an application!
  • walidelmasrywalidelmasry Posts: 2
    edited 2012-02-20 06:58
    I hope if someone could tell me the instructions to read from the module in details please!.
  • djdancedjdance Posts: 1
    edited 2012-11-05 07:50
    Good news folks! :)
    Thank you all for solved problem.

    I spent two days to get it to sizzle, but more than anything I could not.

    So
    It turns out, forget about all these registers and just send 5 bytes. In my case - at 0x60. And read from the same 5 bytes. Everything works. Table is fully consistent with TEA5767 (at the end of the file http://www.rockbox.org/wiki/pub/Main/DataSheets/application_note_tea5767-8.pdf)


    PS And yet, how to save to register on the Arduino C language?

    P.P.S Example:
    frequency=106.2;


    frequencyB=4*(frequency*1000000+225000)/32768+1;


    frequencyH=frequencyB>>8;
    frequencyL=frequencyB&0XFF;


    Wire.beginTransmission(0x60);
    Wire.write(frequencyH);
    Wire.write(frequencyL);
    Wire.write(0xB0);
    Wire.write(0x1F);
    Wire.write(0x00);
    Wire.endTransmission();
Sign In or Register to comment.