TSA6057 PLL I2C library

Hi everybody!
I am trying to build a PLL frequency synthesizer based on the popular TSA6057 IC. The electronic part seems to work fine, but
i can't start communication between my arduino and TSA6057. I'm using wire.h library but it doesn't work. It's probably necessary to use some other library dedicated to i2c philips chips. Maybe someone already encountered this problem and could suggest some solution? Best greetings , Greg .

How can you be sure that the hardware part is done correctly if you cannot communicate with the device?

I'm missing the source code of the sketch you used to find out that it doesn't work. BTW, that library is written Wire.h, C(++) is case-sensitive. Even if you OS is so antiquated that it doesn't care for it on the filesystem layer you should take care because other's trying to help you may have a more modern OS.

'Many thanks for answer!'

<How can you be sure that the hardware part is done correctly if you cannot communicate with the device?>

'''The circuit has been assembled and the VCO works by generating a random frequency. PIN 13 generates the control pulses and PIN 10 generates the frequency reference. The IC properly powered should probably respond to the transmission returning the status of the communication port. The Arduino generates pulses on the SDA and SCL, and these are connected to the IC bus In addition, the IC was tested in another device where it worked properly.'''

<I'm missing the source code of the sketch you used to find out that it doesn't work.>
'Here is the full program based on the code found here: '
'i2c/tsa6057.c at master · gitpan/i2c · GitHub '

'TSA6057.h:'

'#ifndef _TSA6057_h'
'#define _TSA6057_h '
'#pragma once'
'#include "Arduino.h" '

'#define TSA6057_ADR 0xC4 // Adress default 196 , (198) '
'#define TSA6057_AM 16 // AM '
'#define TSA6057_FM 32 // FM'
'#define TSA6057_R01 0 // Raster 1 KHz'
'#define TSA6057_R10 64 // Raster 10 KHz'
'#define TSA6057_R25 128 // Raster 25 KHz'
'#define TSA6057_BS 4 // Bandswitch'
'#define TSA6057_4MHz 100 // XTAL 4MHz'
'#define TSA6057_5MHz 80 // XTAL 5MHz'
'#define TSA6057_DEFF 116160000 // Default f '

' struct tsa6057 {'

'int adr; // Adress = 196'
' int sadr; // Sub-Adress = 0'
' int raster; // Raster 1 / 10 /25 KHz'
' int db0; // Teiler und ChargePump'
' int db1; // Teiler '
' int db2; // Raster /FM/AM / Teiler'
' int db3; // TestByte = 0'
'};

'void tsa6057_init(struct tsa6057 *sp,int Raster,int Mode); // Raster & Mode'
'void tsa6057_calc(tsa6057 *sp,long Freq,int Xtal); '
'char tsa6057_send(tsa6057 *sp,int Adr_Off); // Sendet die Daten an die PLL

'#endif

'TSA6057.c :'

'#include "Arduino.h" '
'#include <Wire.h> '
'#include "tsa6057.h" '

'void tsa6057_init(struct tsa6057 *sp,int Raster,int Mode) // Raster & Mode '
'{'
' memset(sp,0,sizeof(tsa6057)); // Struckt. 0 settings '
' sp->adr=TSA6057_ADR; '
' sp->sadr=0; '
' sp->db2=Raster+Mode+TSA6057_BS; // Raster / Mode / BS on'

' switch(Raster)'
' {'
' case 0: sp->raster = 1000;'
' break;'
' case 64: sp->raster = 10000;'
' break;'
' case 128: sp->raster = 25000;'
' break;'
' default: sp->raster = 10000; '
' } '

'}'

'void tsa6057_calc(struct tsa6057 *sp,long Freq,int Xtal)// Calculate divide factor in sp , '
'{'
' int n;'
' //Freq = (Freq
Xtal)/100;//Xtal 5MHz , raster 12.5kHz'
' n = (Freq / sp->raster); // Berechnet wird ein ganzzahliger Teiler.'
' sp->db0 = ((n & 127) << 1)+1; // 1. 6 Bits '
' sp->db1 = (n & 32640) >> 7; // Oberes Nibble holen n0-n7'
' sp->db2 = sp->db2 +((n & 98304) >> 15); // n14-n8'
'} '

'char tsa6057_send(struct tsa6057 *sp,int Adr_Off) // Send data to PLL'
'{
'unsigned char status = ' ';'

'delay(1);'
'Wire.beginTransmission(sp->adr);'
'Wire.write(sp->adr);'
'Wire.write(sp->sadr);'
'Wire.write(sp->db0);'
'Wire.write(sp->db1);'
'Wire.write(sp->db2); '
'Wire.write(sp->db3);'
'status = Wire.endTransmission();'
'delay(1);'
'return(status); // 0 – Sukces '
'} '

'Test program: '
'#include <Wire.h>'
'#include "TSA6057.h" '

'long f = TSA6057_DEFF; '
'unsigned char status = ' '; '
'tsa6057 tsa; '
' long fd = TSA6057_DEFF*1.25; // PLL frequency for 5MHz crystal,12.5kHz raster '
'void setup() { '

' Wire.begin(TSA6057_ADR); '
' Serial.begin(9600); '
' tsa6057_init(&tsa,TSA6057_R10,TSA6057_FM); // Daten initialisieren Datenstruktur '

'} '

'void loop() { '

' tsa6057_calc(&tsa,TSA6057_DEFF,TSA6057_5MHz); '
' status = tsa6057_send(&tsa,TSA6057_ADR);'
' Serial.print("Status: ");'
' Serial.println(status);'
' delay(3000);'
'}'

<Even if you OS is so antiquated that it doesn't care for it on the filesystem layer you should take care because other's trying to help you may have a more modern OS.>

'''I'm using Windows 7 , until now, all my arduino programs are worked properly.
Mary Christmas an Happy New Year for everybody! Greg SP9CNN'''

Please edit your post and insert code tags!

This cannot work. I2C addresses are 7bit values, your address doesn't fit into 7 bits. Try with 0x44. The original code was written in C and definitely not for the Arduino IDE. So I guess it uses the wrong term address for what actually is the first byte in the protocol (which holds the address and the read/write bit).

On the master (in your case the Arduino is the master) you should call Wire.begin() without an argument.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.