Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code that calculates the dcoFrequency when the si570 is calibrated for 10mhz #6

Open
sarfata opened this issue Mar 24, 2014 · 0 comments

Comments

@sarfata
Copy link
Collaborator

sarfata commented Mar 24, 2014

Mac - AE5PH reported:

Here are the register values I obtained from my Si570:

Register[7] = ad
Register[8] = 42
Register[9] = a8
Register[10] = db
Register[11] = fe
Register[12] = 17
HS = 9, N1 = 54
Reference Frequency (hex): 2A8DBFE17
Reference Frequency (double): 42.553710
Crystal Frequency (long int): 114208608 (Hz)

Version 0.03 would not work properly until I made the following
code change in Si570.cpp:

uint64_t Si570::getRfReq() {
  uint64_t dcoFrequency = 0;
//  dcoFrequency =  (uint64_t)(this->dco_reg[8] & 0x3F) << 32;
//  dcoFrequency |= (uint64_t)this->dco_reg[9]  << 24;
//  dcoFrequency |= (uint64_t)this->dco_reg[10] << 16;
//  dcoFrequency |= this->dco_reg[11] << 8;
//  dcoFrequency |= this->dco_reg[12];
  dcoFrequency = (uint64_t)(dco_reg[8] & 0x3F);
  dcoFrequency = (dcoFrequency << 8) | (uint64_t) dco_reg[9];
  dcoFrequency = (dcoFrequency << 8) | (uint64_t) dco_reg[10];
  dcoFrequency = (dcoFrequency << 8) | (uint64_t) dco_reg[11];
  dcoFrequency = (dcoFrequency << 8) | (uint64_t) dco_reg[12];
  return dcoFrequency;
}

It appears that the most significant bits (above bit 31) disappear. Perhaps unsigned, 64-bit shifts are not working properly.
As expected, I made the following change code change in radiono.ino:

  //vfo = new Si570(SI570_I2C_ADDRESS, 56320000);
  vfo = new Si570(SI570_I2C_ADDRESS, 10000000);

After this was done, I was able to change frequency and measure
frequency changes on the Si570. For example, setting the frequency
to 7.0000 MHz on the display yielded a Si570 frequency of 27 MHz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant