Jump to content
43oh

Wire Library Not working when Launchpad powered externally


Recommended Posts

Hi,

I am working with TEA5767 FM module to receive FM Audio. I have noticed a peculiar issue.

When the launchpad is powered by my Laptop the communication works (only MSP430 <-> TEA5767 on I2C ) and I am not using the Serial which will anyway require my laptop.

 

But when i power the Launchpad using a wall wart phone charger which is also @ 5V . It doesnt work at all. Since i am not using Serial. Laptop should not be required.

 

The code is given below:

#include <Wire.h>

unsigned char frequencyH = 0;
unsigned char frequencyL = 0;

unsigned int frequencyB;
double frequency = 0;
double channels[6]={91.1,93.5,94.3,98.3,101.0,107.4};
unsigned int i=0;
void setup()
{
 pinMode(PUSH2, INPUT_PULLUP);
 Wire.begin();
 // Serial.begin(9600);
 frequency = channels[0]; //starting frequency
  setFrequency();
  
}

void loop()
{
  if(!(digitalRead(PUSH2))) //If button Pressed
{
  while(!(digitalRead(PUSH2))) //Release the Kraken!!
  {
    delay(100);
  }
  if(digitalRead(PUSH2)) // Now Released .. Whoosh
  {
    if(i==6)
    {
      i=0;
    }
  frequency = channels[i]; //starting frequency
  setFrequency();
  //Serial.print("Current Channel: ")
  //Serial.println(channels[i]);
  i++;


  }

delay(1000); // Keep Going but slowly!
}
}

void setFrequency()
{
  frequencyB = 4 * (frequency * 1000000 + 225000) / 32768;
  frequencyH = frequencyB >> 8;
  frequencyL = frequencyB & 0XFF;
  delay(100);
  Wire.beginTransmission(0x60);
  Wire.write(frequencyH);
  Wire.write(frequencyL);
  Wire.write(0xB0);
  Wire.write(0x10);
  Wire.write((byte)0x00);
  Wire.endTransmission();
  delay(100);  
}

Thanks ! :)

Link to post
Share on other sites

Have you tried a different power adapter? I've had some noisy ones in the past that caused the device to not work - power might also not be sufficient for both devices.  See if you can get the blink example working on the external power with the same circuit - you should still have a load from the FM adapter.

Link to post
Share on other sites

Thanks guys ! So foolish of me to not suspect the power source ! It was the power adapter in fact and was insanely noisy. I replaced it with a Li-Ion battery (to remove all doubts of stability) and it has started rhyming again.

 

 

I have shared the code and video in a github repo if anyone needs it.

https://github.com/IndianTinker/FM430 

 

Thanks!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...