
Help porting Arduino code for FM radio module
#1
Posted 04 October 2011 - 11:11 AM
#2
Posted 04 October 2011 - 11:20 AM

My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#3
Posted 04 October 2011 - 11:36 AM
Hi Ken,
I read you need help, on which level? How far is your current progress, can you post something about that already?
To begin, I need help with hook it up to Netduino and get them to "talk", sending the command I can properly figure out. My goal is to tune in a frequency, get signal level and read simple RDS data.
#4
Posted 04 October 2011 - 12:26 PM
-- H.L. Mencken, "What I Believe"
#5
Posted 04 October 2011 - 12:58 PM
#6
Posted 04 October 2011 - 01:24 PM
#7
Posted 04 October 2011 - 09:48 PM

Attached Files
#8
Posted 05 October 2011 - 07:16 AM
I've attached the 3 files I think you need to get started - I've tried to keep it close to the Arduino code so it's easy to
Thanks Jeremy! I give it a try tonight. How come you use Analogue port on Netduino?
/Ken
#9
Posted 05 October 2011 - 07:41 AM

#10
Posted 05 October 2011 - 10:46 AM
Hi Ken
A4 and A5 are the pins for I2C - there's a great post here
http://forums.netdui...5-pinout-cards/
I have the netduino plus card printed out and refer to it pretty much every day
Jeremy
Yes I got it that A4, A5 is for IC2, just curious if that data is really analogue.
/Ken
#11
Posted 05 October 2011 - 10:52 AM

#12
Posted 05 October 2011 - 11:11 AM
A4 and A5 pins have several usage 'modes':Yeah that's a good question, I think that A5 is a clock pulse so it's not analogue. I think the A4 (SDIO) sends logic pulses, rather than a clock signal.
- When I2C is instantiated, they are physically switched to microcontroller's I2C pins,
- When passed to AnalogInput, they are A/D converter inputs,
- When passed to Port-derived class (InputPort, OutputPort, TristatePort, InterruptPort), they are digital I/O.
#13
Posted 05 October 2011 - 12:15 PM
Heya! Small question and perhaps a bit offtopic, but I recently read that when switching to I2C it physically switches to +5V tolerant pins. Does the same count for GPIO?A4 and A5 pins have several usage 'modes':
- When I2C is instantiated, they are physically switched to microcontroller's I2C pins,
- When passed to AnalogInput, they are A/D converter inputs,
- When passed to Port-derived class (InputPort, OutputPort, TristatePort, InterruptPort), they are digital I/O.
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#14
Posted 05 October 2011 - 03:47 PM

-- H.L. Mencken, "What I Believe"
#15
Posted 06 October 2011 - 09:52 AM
Yeah that's a good question, I think that A5 is a clock pulse so it's not analogue. I think the A4 (SDIO) sends logic pulses,
Jeremy
Hi Jeremy,
I now got the FM module to work, I can set channel and the radio plays. But it report mono and no RDS. I hear stereo in the headphones and I got strong signal (my iPod show RDS)
I try to pull "DisplayStatus()" with a timer, but I get same result only RSSI changes (Received Signal Strength Indicator)
Channel = 1014 (No RDS) (Seek Successful!) (Mono) (RSSI=54 of 75)
Jeremy, do you get RDS and stereo? I not sure if the RDS is enabled.
/Ken
#16
Posted 06 October 2011 - 10:20 AM
#17
Posted 06 October 2011 - 10:58 AM
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 don't get in so I can read RDS, is my code correct? And why does it say that the station I receive is in "mono"?
this.ReadRegisters(); if((byte)(Si4703_Registers[STATUSRSSI] & (1<<RDSR))>0) { //Read RDS }
Here is the Ardino code for reading RDS
void readRDS(char* message, long timeout); // message should be at least 9 chars // result will be null terminated // timeout in milliseconds void Si4703_Breakout::readRDS(char* buffer, long timeout) { long endTime = millis() + timeout; boolean completed[] = {false, false, false, false}; int completedCount = 0; while(completedCount < 4 && millis() < endTime) { readRegisters(); if(si4703_registers[STATUSRSSI] & (1<<RDSR)){ // ls 2 bits of B determine the 4 letter pairs // once we have a full set return // if you get nothing after 20 readings return with empty string uint16_t b = si4703_registers[RDSB]; int index = b & 0x03; if (! completed[index] && b < 500) { completed[index] = true; completedCount ++; char Dh = (si4703_registers[RDSD] & 0xFF00) >> 8; char Dl = (si4703_registers[RDSD] & 0x00FF); buffer[index * 2] = Dh; buffer[index * 2 +1] = Dl; // Serial.print(si4703_registers[RDSD]); Serial.print(" "); // Serial.print(index);Serial.print(" "); // Serial.write(Dh); // Serial.write(Dl); // Serial.println(); } delay(40); //Wait for the RDS bit to clear } else { delay(30); //From AN230, using the polling method 40ms should be sufficient amount of time between checks } } if (millis() >= endTime) { buffer[0] ='\0'; return; } buffer[8] = '\0'; }
#18
Posted 06 October 2011 - 12:32 PM
#19
Posted 06 October 2011 - 04:02 PM
Have you tried polling, say for 60 seconds to see if anything appears in the RDS registers?
Jeremy
Hi,
I try pulling for 10 minutes, even on a local transmitter with RDS (RSSI is about 65). I work with broadcast so I put up a small FM transmitter in my lab...
But I question the quality of the FM board, I have one more that I tested with, but that don't even tune in a station... So I ordered one more FM-board to test with that.
/Ken
#20
Posted 11 October 2011 - 07:40 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users