- Netduino Forums
- → <Jeremy>'s Content
<Jeremy>'s Content
There have been 31 items by <Jeremy> (Search limited from 17-June 23)
#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
#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
#18853 Help porting Arduino code for FM radio module
Posted by <Jeremy> on 06 October 2011 - 10:20 AM in General Discussion
#18815 Help porting Arduino code for FM radio module
Posted by <Jeremy> on 05 October 2011 - 10:52 AM in General Discussion
#18868 Help porting Arduino code for FM radio module
Posted by <Jeremy> on 06 October 2011 - 12:32 PM in General Discussion
#19056 Help porting Arduino code for FM radio module
Posted by <Jeremy> on 11 October 2011 - 10:55 PM in General Discussion
( (this.Si4703_Registers[RDSB] & 0x00FF) & 0x3) * 2;
So this time, each of the pairs of letters will be associated with the numbers 0, 2, 4, and 6, and therefore you can determine the correct order of the letters and what letters come first.
Jeremy
#18809 Help porting Arduino code for FM radio module
Posted by <Jeremy> on 05 October 2011 - 07:41 AM in General Discussion
#19054 Help porting Arduino code for FM radio module
Posted by <Jeremy> on 11 October 2011 - 09:37 PM in General Discussion
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
#19047 Help porting Arduino code for FM radio module
Posted by <Jeremy> on 11 October 2011 - 08:08 PM in General Discussion
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
#18802 Help porting Arduino code for FM radio module
Posted by <Jeremy> on 04 October 2011 - 09:48 PM in General Discussion
Attached Files
- AbstractI2CDevice.cs 2.13KB 52 downloads
- Program.cs 971bytes 42 downloads
- Si4703.cs 12.75KB 71 downloads
#18765 Help porting Arduino code for FM radio module
Posted by <Jeremy> on 04 October 2011 - 12:58 PM in General Discussion
#32238 DHT11 Temperature Sensor
Posted by <Jeremy> on 18 July 2012 - 10:38 PM in Netduino 2 (and Netduino 1)
#32207 DHT11 Temperature Sensor
Posted by <Jeremy> on 18 July 2012 - 04:22 PM in Netduino 2 (and Netduino 1)
#17836 Working with UART
Posted by <Jeremy> on 10 September 2011 - 06:17 PM in Visual Studio
I've been having a look at the problem you've described (since I've been working on some serial port things myself).
First, I'm assuming you've got D0 (COM1 Rx) connected to D3 (COM2 Tx), and D1 (COM1 Tx) connected to D2 (COM2 Rx) here.
Given that, if you look in the SerialPortHelper.cs class, the serialPort variable is declared as static (as are buffer and
bufferlength). I think what's happening is that since you've instantiated two separate ports in your class, you're actually sharing
resources between them. So when an event is fired to say "data has been written to COM1", the code reacts to that event
by trying to read from COM2. If you leave the serialPort variable as static, and change the serialPort_DataReceived
method to look like the code below, you'll see what i mean:
private void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e) { // i expect these to both return the same port // if serial port is static, i find they're different. Debug.Print("serial port name = " + serialPort.PortName); Debug.Print("sender name = " + ((SerialPort)sender).PortName); lock (buffer) { if (serialPort.BytesToRead > 0) { int bytesReceived = serialPort.Read(buffer, bufferLength, bufferMax - bufferLength); if (bytesReceived > 0) { bufferLength += bytesReceived; if (bufferLength >= bufferMax) throw new ApplicationException("Buffer Overflow. Send shorter lines, or increase lineBufferMax."); } } } }
So basically I think if you use the method above, and remove the static modifier from the serialPort variable, you
should make some progress. You might want to remove static from the other two member variables too.
I guess you'll also have noticed I added a little bit to that code to check if there's at least one byte to read from serialPort.
Stepping through your program slowly in debug mode gives me different behaviour to when I just run it
without breakpoints - I found there was an exception in this method because whereas we've been notified that data has
been received, when I actually look at the serialPort.BytesToRead property I find that there's nothing there. I couldn't
work out why the event was being fired, if you have an answer I would be really interested to know!
But this looks like a great library, it's interesting to me as well.
I hope this helps - let me know how it works out.
Jeremy
#32361 Increasing the resolution of the system timer
Posted by <Jeremy> on 20 July 2012 - 03:18 PM in Beta Firmware and Drivers
#32859 Increasing the resolution of the system timer
Posted by <Jeremy> on 28 July 2012 - 11:31 PM in Beta Firmware and Drivers
#32863 Increasing the resolution of the system timer
Posted by <Jeremy> on 29 July 2012 - 12:27 AM in Beta Firmware and Drivers
#21554 HMC5883L Magnetometer Netduino Code
Posted by <Jeremy> on 10 December 2011 - 06:10 PM in Project Showcase
#18015 HMC5883L Magnetometer Netduino Code
Posted by <Jeremy> on 14 September 2011 - 09:54 PM in Project Showcase
Attached Files
- HMC5883L.cs 4.73KB 225 downloads
- AbstractI2CDevice.cs 1.9KB 170 downloads
- Program.cs 588bytes 173 downloads
#17851 Reading data chunks from a COM port question
Posted by <Jeremy> on 11 September 2011 - 11:39 AM in Netduino 2 (and Netduino 1)
#17758 Reading data chunks from a COM port question
Posted by <Jeremy> on 08 September 2011 - 01:58 PM in Netduino 2 (and Netduino 1)
#17784 Reading data chunks from a COM port question
Posted by <Jeremy> on 08 September 2011 - 10:14 PM in Netduino 2 (and Netduino 1)
#32239 This looks like a bug in InterruptPort
Posted by <Jeremy> on 18 July 2012 - 10:56 PM in General Discussion
#32272 This looks like a bug in InterruptPort
Posted by <Jeremy> on 19 July 2012 - 09:08 AM in General Discussion
#18153 My first project with netduino
Posted by <Jeremy> on 18 September 2011 - 07:23 PM in Project Showcase
- Netduino Forums
- → <Jeremy>'s Content
- Privacy Policy