43oh

# Change Frequency to SI570 DXO on I2C. (not fully fonctionnal).

## Recommended Posts

Hi all !

some of you have need I share my work. it's ok... ;-) look attachment file.

For understand my work, i preconise to read the datasheet.

The SI570 have 2 mode for change frequency, i use the "long" mode. I recalc all parameters in every change frequency.

But i simplify the calcul by the systematic use of initial frequency in place of read all registers for determinize actual ferquency to recalc new freq. (I think attiny/softrock already uses this trick.)

but, I have 2 problems (in Fxtal_init) , and 1 function not implemented (in SetFrequency). I do not have time to look for now.

but this is a good example of driving SI570, all logic is present.

this code is divide in function. the principal is :

• void Init_FXTAL( void ) => read and calcul your Fxtal. this frequency is different for every SI570... (98% finish, but not fonctionnal)
• void setFrequency(float FOUT_NEW) => Change to your frequency in parameters (Mhz) (80% finish but not fonctionnal)
• void Set10(void) => Set SI570 to 10Mhz. fonctionnal with my SI570.
• void Set20m(void) => loop frequency 20m band (13.5Mhz to 14.5 Mhz by 100Khz). fonctional with my SI570.
1. first problem :
```  uint64_t RFREQ_INIT = 0x0;
RFREQ_INIT = ((i2cInitBuf[2] & 0x3F) << 32);
RFREQ_INIT = RFREQ_INIT | (i2cReadBuf[3] << 24);
RFREQ_INIT = RFREQ_INIT | (i2cReadBuf[4] << 16);
RFREQ_INIT = RFREQ_INIT | (i2cReadBuf[5] << 8);

this result is not good. i think i have a problem with "unsigned".... bug ?

2. Second problem :

`(float) RFREQ_MHZ_INIT = (uint64_t) RFREQ_INIT / 268435456;  // 268435456 = 2^28`

if RFREQ is ok but the result is wrong... lack precision ? rounded ?

Fonction not implemented :

for change frequency to all value, the N1_DIV and HS_DIV must be calculed before change registers.

i not program this part, i expect my correction (or your ;-) ) of my precedents problems for think it. ;-)

in clonclusion :

this code is not finished, but I do not have time now.
This version provides all the elements of SI570 register read/write register comprehension.
I think many things can be improved, it is only a draft of a future library maybe. but for now, it allowed me to test my trap and filter. time spent / results and so far positive report.

I probably would end one day, when I need more function, or more accurately.

I hope that this code you'll help to understand the Si570. good luck! and if you made ??a full library, think warn me! ;-)

more explain/comment in code, good read ! ;-)

Jean-Yves

F4DTR.

ps: sorry for my bad english. if you don't understand mail me, or if you want to correct me (english or code), youre welcome !

si570.ino

##### Share on other sites

Try this:

```const uint64_t RFREQ_INIT =
((uint64_t)(i2cInitBuf[2] & 0x3F) << 32)

```
`  const float FREQ_MHZ_INIT = (float)RFEQ_INIT / 268435456.0;  // 268435456 = 2^28`
##### Share on other sites

Hi,

Great work Jean-Yves.

I have no time to work on MSP430 right now being busy with other micro-controllers projects and a website development (http://www.qscope.org/).

However, I will give it a try as soon as possible.

73,

Yan - XV4Y.

##### Share on other sites

Hi,

thanks oPossum ! i will try your good idea this night.

Yan, if you want more detail in french, you can use my blog : http://f4dtr.wordpress.com/2013/09/18/pilotage-dun-si570-par-arduino-ou-energia/

but, i think you have already a good understanding to SI570, I do not pretend to innovate...

bye,

Jean-Yves.

F4DTR.

##### Share on other sites

Hi Jean-Yves,

Looking over your code in the ino file, I think you might be writing to the wrong register to freeze the DCO; around line 167 you use register 135 instead of 137. Likewise for unfreezing the DCO. While some sample code I was playing around with didn't seem to matter for the register values I was playing with (jumping from 10 MHz to 14.2 MHz), the way I read the data sheet for the SI570 indicates that for large frequency change you should freeze 0b00010000 (0x10).

So maybe use this instead? (untested - I was playing outside of energia):

```   //Freeze DCO
err |= SI570_WriteRegister(137, 16);
Wire.beginTransmission(SI570);
//  ...
// Unfreeze DCO
err |= SI570_WriteRegister(137, 0);

```
##### Share on other sites

By the way, thank you for posting this. Your code gave me enough information to debug my code so that I could do the initial setting of si570 and make sure that my I2C connections were going to the right place. I can't tell you how pumped I was when I saw my frequency meter jump to 14.2 MHz after reflashing the launchpad!

##### Share on other sites

Hi Jean-Yves,

Looking over your code in the ino file, I think you might be writing to the wrong register to freeze the DCO; around line 167 you use register 135 instead of 137. Likewise for unfreezing the DCO. While some sample code I was playing around with didn't seem to matter for the register values I was playing with (jumping from 10 MHz to 14.2 MHz), the way I read the data sheet for the SI570 indicates that for large frequency change you should freeze 0b00010000 (0x10).

So maybe use this instead? (untested - I was playing outside of energia):

```   //Freeze DCO
err |= SI570_WriteRegister(137, 16);
Wire.beginTransmission(SI570);
//  ...
// Unfreeze DCO
err |= SI570_WriteRegister(137, 0);

```

hi Pimmel,

in P15 for the small change, it says :

`1. Freeze the `

## Join the conversation

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×
• Blog

• #### Activity

×
• Create New...