AlexOrlo
Posts: 1
Joined: Mon May 07, 2018 2:35 pm

I2C programming of SP5055 chip

Mon May 07, 2018 3:26 pm

Hello!

I use Pi 3 platform with Pi4J. For my project I need to take control of SP5055 chip - is synthesiser for TV tuners.
In my case it synthesiser in Lawmate RX 1.2Ghz (analog video receiver).

So I try to communicate with sp5055 by i2c. According datasheet, reading and writing carried by different addresses.
To read I need set last bit in "1" and to write "0".

My Pi3 detect it device like two different devices: 0x61 and 0x63.
But is wrong addresses by my calculation...

On P3 I have 0.67 volt. By datasheet it mine that my address for write is 11000100 (0xC4) and for read 11000101 (0xC5).
This my code each I try

Code: Select all

   public class SP5055
   {
     static I2CDevice device;
     
     public static void main(String args[]) throws Exception
     {
      I2CBus bus = I2CFactory.getInstance(I2CBus.BUS_1)
      device = bus.getDevice (0x63); // I try 0x61 not help, 0xC4 give error
      Thread.sleep(1000);
      
      Scanner scan = new Scanner(System.in);
      while(true){
        System.out.println(Enter needed frequency in Mhz );
        String inStr = scan.next();
        
        if(inStr.equals("exit"))
           break;
           
        long chanF = Long.parseLong (inStr);
        chanF=chanF*1000000;
        
        long divider = chanF/125000;   //calculate divider according local oscillator (in my case 4MHz). 
        byte divLSB = (byte) divider;
        
        byte divMSB = (byte)(divider >> 8);
        divMSB = (byte)(divMSB & 0x7F);   //first bit must to be "0"
        
        byte[] data = { divMSB, divLSB, (byte)0x8E, (byte)0x00  };  //here I try to put first byte before divMSB 0xC4 or 0x63, not help
        device.write(data);
      }
    }
}     
I found example of this on C with Tiny library and after that on Python. But them use Start and Stop command and simple put bytes one by one. On each example them use different addresses.

Please, if some body know how to do it, help me.

Thank you!

Return to “Java”

Who is online

Users browsing this forum: No registered users and 1 guest