Browse files

Calibrated SPI for BOB-08745 version

- reduced SPI speed down to 250kHz if using an Uno/Mega + BOB-08745; as
the latter tends to be very slow due to its cheap design
- moved bool goodtune from .data to .bss, makes debugging easier
- updated documentation
  • Loading branch information...
1 parent 9bea6fb commit 820e4b6a04fc0e9d1174a658a65878c5c6d1e120 @csdexter committed Apr 17, 2012
Showing with 18 additions and 8 deletions.
  1. +4 −0 README
  2. +4 −3 Si4735.cpp
  3. +9 −4 Si4735.h
  4. +1 −1 examples/Si4735_Example/Si4735_Example.ino
@@ -27,6 +27,10 @@ HARDWARE NOTES:
If you're using the Shield, you should be ok save for a few fatal design
mistakes SparkFun introduced. There are various hacks around to work around
those, my personal recommendation is that you go for a real level shifter.
+ Please note that BOB-08745 is cheaper than BOB-10403 mainly because it's a
+ lot slower. For casual applications speed shouldn't matter, but if you need
+ to push the SPI interface to its limit, go for the expensive version if you
+ need to translate between a 5V I/O Arduino and the Si4735.
* If you're using the Breakout Board, make sure you tell the code whether or
not you connected a 32768Hz oscillator to the RCLK and DCLK pins. See the
schematic for the Shield for reference.
@@ -305,7 +305,7 @@ Si4735::Si4735(byte interface, byte pinPower, byte pinReset, byte pinGPO2,
-void Si4735::begin(byte mode, bool xosc){
+void Si4735::begin(byte mode, bool xosc, bool slowshifter){
//Start by resetting the Si4735 and configuring the communication protocol
if(_pinPower != SI4735_PIN_POWER_HW) pinMode(_pinPower, OUTPUT);
pinMode(_pinReset, OUTPUT);
@@ -357,8 +357,9 @@ void Si4735::begin(byte mode, bool xosc){
#if !defined(SI4735_NOSPI)
//Configure the SPI hardware
- //Datahseet says Si4735 can't do more than 2.5MHz on SPI
- SPI.setClockDivider(SPI_CLOCK_DIV8);
+ //Datahseet says Si4735 can't do more than 2.5MHz on SPI and if you're
+ //level shifting through a BOB-08745, you can't do more than 250kHz
+ SPI.setClockDivider((slowshifter ? SPI_CLOCK_DIV64 : SPI_CLOCK_DIV8));
//SCLK idle LOW, SDIO sampled on RISING edge
//Datasheet says Si4735 is big endian (MSB first)
@@ -443,10 +443,15 @@ class Si4735
* SW - 2.3 to 23 MHz
* FM - 87.5 to 107.9 MHz
* Parameters:
- * mode - The desired radio mode, one of the SI4735_MODE_* constants.
- * xosc - A 32768Hz external oscillator is present.
- */
- void begin(byte mode, bool xosc = true);
+ * mode - The desired radio mode, one of the SI4735_MODE_*
+ * constants.
+ * xosc - A 32768Hz external oscillator is present.
+ * slowshifter - A BOB-08745 is used for level shifting between an
+ * Uno/Mega and the Si4735. Use a 3.3V I/O Arduino or
+ * shift through a BOB-10403 to be able to go up to
+ * 1MHz by setting this to false.
+ */
+ void begin(byte mode, bool xosc = true, bool slowshifter = true);
* Description:
@@ -68,7 +68,7 @@ Si4735RDSDecoder decoder;
char command;
byte mode, status;
word frequency, rdsblock[4];
-bool goodtune = false;
+bool goodtune;
Si4735_RX_Metrics RSQ;
Si4735_RDS_Data station;
Si4735_RDS_Time rdstime;

0 comments on commit 820e4b6

Please sign in to comment.