1

I've got an Si4703 breakout from Sparkfun, which communicates via I2C. I have gotten it to work very easily using a regular 3.3V Arduino Pro Mini, but am now trying to move everything over to an ATtiny85. It seems this should be possible, but my I2C knowledge is basically zero.

SETUP
I have everything laid out on a breadboard:

  • ATtiny chip with 3.3V power and ground from a good power supply
  • Si4307 on the breadboard too
  • SDIO on digital pin #0 (pin 5 on the chip) with a 4.7K pullup running to 3.3V and out to the breakout
  • SDLK on digital pin #2 (pin 7 on the chip), same as SDIO
  • A reset pin for the breakout, running from digital pin #1

I've verified this with the Pro Mini and it works great, so I'm doubtful the problem is here.

SOFTWARE
My ATtiny is set up using the TinyWireM library for I2C, and using a customized version of the Sparkfun Si4703 library. <-- if I had to guess, this is where the problem probably is... I think

My modded library files are here (too long to paste in the forum):
https://gist.github.com/jeffThompson/5e48c8915148e6e0bac7d85c9a3da948
https://gist.github.com/jeffThompson/10934cf8f07b3000e7e61601266b2b2c

And my Arduino code:

#include <TinyWireM.h>
#include <Si4703_ATtiny.h>

int SDA =   0;       // I2C data pin on ATtiny85
int SCK =   2;       // I2C clock pin on ATtiny85
int reset = 1;       // can probably be any digital pin

Si4703_ATtiny radio(reset, SDA, SCK);

void setup() {
  TinyWireM.begin();    // need this?
  radio.powerOn();
  radio.setChannel(937);
}

void loop() {
  radio.setVolume(15);
  delay(1000);
  radio.setVolume(0);
  delay(1000);
}

TESTING
I've tested both the Pro Mini and ATtiny85 version using my scope, but I'm pretty new to that tool, especially for I2C. I see similar clock and data patterns from both versions, and can see that there is readable I2C data from the ATtiny on my scope (it is finding readable hex data and sees it is ACK-ed, at least some of the time). I have programmed ATtiny chips through the Arduino IDE before, so I'm pretty familiar with that process, and double-checked things are outputting using an LED.

TLDR
I'm not anywhere near an I2C expert, and have never built an Arduino library, so I'm guessing I need some help with my modded library (unless I'm missed something else obvious).

  • Why all this trouble ? The ATtiny85 is not officially supported by Arduino and a ATmega328p in a small package is also very small. – Jot Jun 5 '17 at 2:17
  • You haven't explained your problem! – Gerben Jun 5 '17 at 12:07
  • @Jot – the ATtiny85 is still cheaper, and doesn't require an external crystal. – JeffThompson Jun 5 '17 at 12:08
  • @Gerben – the problem is it doesn't work! Since the ATtiny85 doesn't have serial, I can't easily see what the problem is. Was hoping someone with more knowledge could help find where the issue might be (the modded library code, etc). – JeffThompson Jun 5 '17 at 12:09
  • 1
    The Si4703 has an approach that I'm not used to. It reads for example 32 bytes, and waits for ever after the requestFrom. You can remove that wait loop, it has no use. It uses millis in the wrong way. I think that the TinyWireM can do only 16 and not 32 bytes with requestFrom. Could you try other Si4703 code that is more "normal" ? – Jot Jun 6 '17 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.