Teensy 3.0 & si4707 breakout board - hangs on Wire.endTransmission()

Status
Not open for further replies.

hagenkaye

New member
Hello,

Just got my Teensy 3.0 board a few days ago and I've been having fun with it. Pretty awesome stuff. I've hooked up a bunch of sensors and such and everything is going well. However, I'm stumped at getting the Sparkfun si4707 breakout board going (it's a Weather Radio with SAME).

I've put a bunch of Serial.println statements here and there to see why it's not working. In the si4707_system_functions.cpp file-

// Read a specified number of bytes via the I2C bus.
// Will timeout if there is no response from the address.
void i2cReadBytes(byte number_bytes, byte * data_in)
{
int timeout = 1000;

Wire.requestFrom((byte) SI4707_ADDRESS, number_bytes);
while ((Wire.available() < number_bytes) && (--timeout))
;
while((number_bytes--) && timeout)
{
*data_in++ = Wire.read();
}
Wire.endTransmission();
}

// Write a specified number of bytes to the Si4707.
void i2cWriteBytes(uint8_t number_bytes, uint8_t *data_out)
{
Wire.beginTransmission(SI4707_ADDRESS);
while (number_bytes--)
{
Wire.write(*data_out++);
}
Serial.println("before end");
Wire.endTransmission();
Serial.println("after end");
}

The code calls i2cReadBytes to get a status byte, that works. The chip reports back 0x80 which means data can be sent. Then it attempts to send a command and i2cWriteBytes is called. In the above, "before end" get output on the serial line, but "after end" doesn't. I'm concluding that it is hanging on Wire.endTransmission().

This is the first command that is sent to the board.

Hoping someone can shed some light on this.
 
I don't think the Wire.endTransmission() should be at the end of the i2cReadBytes function. Try taking it out and see what happens.

Pete
 
Awesome, that did the trick.

This is the sample code that Sparkfun provided. I'll have to send them a note about this.
 
You didn't mention how you wired it up. Teensy's tend to need the 4.7K pull-up resistors. You need two resistors. The first 4.7K resistor goes between A4 and the power rail. The second 4.7K resistor goes between A5 and the power rail. The Arduino Uno has built in pull-up resistors that the library enables, so you can get away with not having the resistors there (but from my reading, it is still a good idea to have the external resistors). I've seen some posts that say on a 3.3v Teensy you could lower the resistors (which are the defaults on 5v systems), but for the 3-4 i2c devices I've tried, 4.7K resistors worked fine.

Here is a post somebody did comparing the results for different i2c pull-up resistors: http://www.dsscircuits.com/articles/effects-of-varying-i2c-pull-up-resistors.html

Here is Nick Gammon's tutorial on i2c in general: http://www.gammon.com.au/i2c.

Fortunately it is a 3.3v device, so you don't have to worry about level shifting. I scanned the comments about the device, and it looks like 1-2 people also had issues with the device. So just in case, be sure to read the comments over at sparkfun.com.
 
Last edited:
With that 2K resistor in series, I don't see how this could work reliably with I2C on any board (not only Teensy). When I2C pulls the line low, the pin on the Si4707 will get 1.05V. Not good. It should really go to zero.

Just found the Sparkfun page:

https://www.sparkfun.com/products/11129

The comments at the top mention needing to short those 2K resistors to get it to work. Since Teensy 3.0 outputs 3.3 volt signals, you can safely just short those 2K resistors. But if you ever connect to a 5V Teensy 2.0 or Arduino, be careful not to drive the pins with more than 3.3V.
 
You might also look at trying the code we have posted for an alternative Si4707 board. Code can be downloaded here with sample sketch.

http://www.raydees.com/Weather_Radio.html

The board itself does not contain the pullup resistors or the headphone jack. It does however provide a BNC for actual antenna connection and allow you to setup your own audio amp circuit. Code will completely parse all sAME messages to the monitor and provides remote control features. Code also incorporates a patch obtained from silicon labs that eliminates a lot of false alerts we were getting with out it.
 
Last edited:
Status
Not open for further replies.
Back
Top