Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

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

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    3

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

    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.

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,243
    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

  3. #3
    Junior Member
    Join Date
    Dec 2013
    Posts
    3
    Awesome, that did the trick.

    This is the sample code that Sparkfun provided. I'll have to send them a note about this.

  4. #4
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,533
    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/...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 by MichaelMeissner; 12-04-2013 at 02:29 AM.

  5. #5
    Junior Member
    Join Date
    Dec 2013
    Posts
    3
    I just wired it directly to the Teensy 3.0 board. (as per Sparkfun's tutorial) The schematic of the si4707 board is here-

    http://dlnmh9ip6v2uc.cloudfront.net/...eakout-v11.pdf

    There is a 4.7K pull up resistor on the board. However this board also has a resistor (2K) in series.

    I wonder if this is causing problems.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,466
    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.

  7. #7
    Junior Member
    Join Date
    Jan 2014
    Posts
    6
    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 by aiw; 01-13-2014 at 10:47 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •