Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

<Jeremy>'s Content

There have been 31 items by <Jeremy> (Search limited from 17-June 23)


By content type

See this member's


Sort by                Order  

#19054 Help porting Arduino code for FM radio module

Posted by <Jeremy> on 11 October 2011 - 09:37 PM in General Discussion

Hi Ken - excellent news! I'll update my code here as well, I'm happy you've found how to make it better :D

What might be interesting to you as well is if you want to see the radio text information, you can use

if ((this.Si4703_Registers[RDSB] >> 11) == 4 || (this.Si4703_Registers[RDSB] >> 11) == 5)
            {
                int Ch = (this.Si4703_Registers[RDSC] & 0xFF00) >> 8;
                int Cl = (this.Si4703_Registers[RDSC] & 0x00FF);
                int Dh = (this.Si4703_Registers[RDSD] & 0xFF00) >> 8;
                int Dl = (this.Si4703_Registers[RDSD] & 0x00FF);

... and convert to ascii, and then the rest of the code goes here, with minor modifications :)

That's an interesting question about the two boards from one Netduino. I don't know enough about the I2C protocol right now to answer that unfortunately. If you've got two FM boards (even if the first one is only partially working) you might be able to try it, but I guess you might have to revisit the original code and try to eliminate static variables. I don't know how two devices with the same device identifier on the same I2C pins would work - I'd guess it would conflict, because the netduino can't determine which device to talk to at any one time? But it's just a guess.

Cheers,
Jeremy



#18853 Help porting Arduino code for FM radio module

Posted by <Jeremy> on 06 October 2011 - 10:20 AM in General Discussion

Hey Ken Well done, and 54 out of 75 is higher than anything I got out in the wilds of the countryside! What I found with the RDS was that I had to tell the device to listen for it for a while. I've written some proof of concept code for it, but as I said before it's a bit of a tangled mess, but it definitely gets text out of the signal. I'll look at the code again this weekend and have a go at tidying it up - but as I remember, the process is: 1. Look at the RDS bit after tuning to a strong channel - keep polling until it until it indicates there's RDS data. 2. When it finds there is RDS data, look at the RDSA, RDSB, RDSC and RDSD registers (details are in data sheet). 3. First look at the RDSA register, shift by 11 bits, if it equals 0 or 1 then it's the station name, if it's 5 or 6 then it's the station information. 4. If you're looking at the station information, then look at the values of the RDSD register - split the dataword into two bytes, convert each from a byte to corresponding ascii character. 5. If you're looking at the station information, then look at the values of the RDSC and RDSD register - split the two datawords into four bytes, convert each from a byte to corresponding ascii character. 6. Build up consecutive letters to make up the station name and information. I've found that station name only ever has 8 characters, station information has many more. I imagine you'll actually have it cracked by this weekend anyway, let me know if you do, but if not I'll try to help out. Hope this is helpful, Jeremy



#19047 Help porting Arduino code for FM radio module

Posted by <Jeremy> on 11 October 2011 - 08:08 PM in General Discussion

Hey Ken

Try this, it's only a proof of concept I put together in 20 minutes, so it's not good code or even remotely robust, but it'll get you started I hope:

Add "using System.Collections;" to the Si4703 class I uploaded before.

Also add this code to the same class.

public string PrintRadioName()
        {
            int j = 0;
            string token = "";
            string fullRadioName = "";
            while (true && j < 500)
            {
                j++;
                this.ReadRegisters();
                if ((this.Si4703_Registers[Si4703.STATUSRSSI] & (1 << Si4703.RDSR)) > 1)
                {
                    var radioNameSoFar = this.ReadRadioName();
                    if (radioNameSoFar != null)
                    {
                        if (token != (string)radioNameSoFar.Value)
                        {
                            token = (string)radioNameSoFar.Value;
                            fullRadioName += radioNameSoFar.Value;
                        }

                        if (fullRadioName.Length > 16)
                        {
                            return fullRadioName;
                        }
                    }
                }
            }
            return string.Empty;
        }

        public DictionaryEntry ReadRadioName()
        {
            if ((this.Si4703_Registers[RDSB] >> 11) == 0 || (this.Si4703_Registers[RDSB] >> 11) == 1)
            {
                int Dh = (this.Si4703_Registers[RDSD] & 0xFF00) >> 8;
                int Dl = (this.Si4703_Registers[RDSD] & 0x00FF);

                int infoOrder = (this.Si4703_Registers[RDSB] & 0x00FF);

                var radioName = new System.Text.UTF8Encoding();
                byte blockerrors = (byte)((this.Si4703_Registers[STATUSRSSI] & 0x0600) >> 9); //Mask in BLERA

                DictionaryEntry d;

                if (blockerrors == 0)
                {
                    if ((Dh >= 32 && Dh <= 127) && (Dl >= 32 && Dl <= 127))
                    {
                        var radioChars = radioName.GetChars(new byte[] { (byte)Dh, (byte)Dl });
                        d = new DictionaryEntry(infoOrder, "" + radioChars[0] + radioChars[1]);
                        return d;
                    }
                }
            }
            return null;
        }

And call the "PrintRadioName" method after you tune to a radio station with a strong signal. If there's something there, it should return it into a string variable. I was able to get some RDS information with this, so hopefully it'll work in your part of the world too. Anyway, give it a try and let me know what happens.

Jeremy



#18868 Help porting Arduino code for FM radio module

Posted by <Jeremy> on 06 October 2011 - 12:32 PM in General Discussion

Hi Ken To be honest, everything you've put in the last post pretty much covered I've got at home on RDS. Certainly I think your code looks ok - I've found that some channels initially report 'No RDS', but if I poll for a few seconds like in the Arduino code, the RDS comes up. Have you tried polling, say for 60 seconds to see if anything appears in the RDS registers? Jeremy



#32432 Netduino Firmware v4.2.0 RC5 (Netduino + Netduino Plus)

Posted by <Jeremy> on 21 July 2012 - 06:26 PM in Beta Firmware and Drivers

Thanks Chris, that's great. Jeremy



#32410 Netduino Firmware v4.2.0 RC5 (Netduino + Netduino Plus)

Posted by <Jeremy> on 21 July 2012 - 09:56 AM in Beta Firmware and Drivers

Is there anywhere I can download the source for this firmware? I've seen a couple of other people post this question but I haven't seen an answer. Or is the firmware source not going to be released until it goes gold? Thanks Jeremy




home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.