[minima] Re: Auto-calibration of the Si570 + some refactoring

  • From: Thomas Sarlandie <thomas@xxxxxxxxxxxxx>
  • To: "minima@xxxxxxxxxxxxx" <minima@xxxxxxxxxxxxx>
  • Date: Sun, 9 Feb 2014 19:40:48 -0800

Farhan,

Thanks for pulling my changes!

If I understand correctly the process in your video, you are basically
re-calibrating the Si570 and not using the values that were set at the
factory. Is this correct?

I have found the factory calibration values to be very accurate:
https://docs.google.com/spreadsheet/ccc?key=0As9CZnZ-A5a2dEZaM1dlWVdVX3pXaUlJMXd0cHNscHc#gid=2
Do you have any reason to stay away from the factory calibration?

I think the advantage of working with this factory frequency and the
factory set calibration are:
 - You do not need to make precise measurement of frequencies - you just
need to find out what "type" of si570 you have (10mhz, 56.320mhz, etc)
 - It's easier for the "operator": You do not need to understand how the
si570 works internally and do the maths. It's not super-complicated but it
will waste at least a few hours of everyone.

We just need to figure out what are the possible "factory frequencies" and
we could have a menu that asks you to choose (or enter) yours the first
time you run the radiono. We can save that in the EEPROM or the calculated
xtal.
Of course, we could also leave the option for people who want to
re-calibrate their si570 manually to do so.

Very excited about the serial protocol. Almost started something today to
set the frequency from my computer when I was measuring the error at
different frequencies. We need this!

73,


On Sun, Feb 9, 2014 at 7:19 PM, Ashhar Farhan <farhanbox@xxxxxxxxx> wrote:

> thomas, i have pulled the changes. i was just wondering if there should be
> a caliberation procedure that is independent of the si570 marking. i have
> used this in sweeperino. check http://www.youtube.com/watch?v=qRNOp1F81i8a 
> 1:10 onwards. It caliberates a number of things, but essentially, the
> process is this:
> 1. Set the Si570 to 10 Mhz while using the hard-coded xtal value.
> 2. Measure the frequency. If the crystal freq. is the same as hard coded
> value, the output will be exactly at 10 Mhz. Let's consider the measured
> frequency to be M. If M is higher, the crystal's actual frequency is
> higher, if M is lower, it is lower.
> 3. The actual frequency of the internal crystal = (M/10,000,000) *
> XTAL_FREQ.
>
> Here is what I suggest we can do:
> 1. Store the xtal frequency in the eeprom memory of the radiono, (so that
> it does not forget it when powered down. (
> http://arduino.cc/en/Reference/EEPROM)
> 2. Using the serial port, send the newly calculated xtal frequency to
> radiono. radiono overwrites the original.
>
> The serial port protocol has to be written. I am starting a separate
> thread for that.
>
> - f
>
>
> On Mon, Feb 10, 2014 at 8:15 AM, Steve VK2SJA <vk2sja@xxxxxxxxxxx> wrote:
>
>> Great work Thomas. Thanks!
>>
>>
>>
>> > Hi everyone!
>> >
>> > Spent some time this week-end on the Radiono software. I found out
>> earlier
>> > this week that my Si570 had a very large error that grew linearly with
>> > frequency. We quickly found out that each module is different and you
>> need
>> > to use calibration information that is saved in the module. The current
>> > source code has Farhan's si570 calibration hardcoded in. That will most
>> > likely not work for you.
>> >
>> > I have updated the Radiono source code to automatically get the
>> > calibration
>> > information and calculate the crystal frequency every time we start the
>> > program. The only information that needs to be defined in the source
>> code
>> > is the default frequency programmed by the factory. In my case it was
>> > 56.320 but your mileage may vary.
>> >
>> > There are two ways to find this frequency:
>> >  - Spec: Look on the marking on your Si570 (mine says CAC000141) and
>> > lookup
>> > some tables online to find which frequency corresponds to your marking
>> (I
>> > cant find this table, if someone has it, please share!)
>> >  - Experimental: just remove the Arduino and apply power to the control
>> > board. Measure the frequency at the output of the Si570.
>> >
>> > I have updated the wiki: http://www.hfsignals.org/index.php/Si570
>> >
>> > The updated source code has been submitted to Farhan in a pull-request:
>> > https://github.com/afarhan/radiono/pull/4
>> >
>> > Full list of changes:
>> >
>> > Split the Si570 code in a separate class.
>> >
>> > In the Si570 class:
>> > * Use the factory-calibrated output frequency to automatically calculate
>> > the internal crystal frequency and use that instead of hard coded
>> values.
>> > * During initialization detect errors talking to the Si570.
>> > * Use multi-bytes i2c reads and writes when possible (ie: read/write
>> > multiple bytes without re-starting a transaction). Only works for
>> > read/writes in consecutive registers.
>> > * Use types with explicit size where that makes sense (uint8_t instead
>> of
>> > char, uint64_t, etc)
>> > * Added some debugging on the serial console through a "debug" function
>> >
>> > In the main sketch:
>> > * Show a message on the LCD if the Si570 is unreachable.
>> > * Initialize the serial port for debugging
>> > * Fix some compilation warnings with string litterals being casted to
>> > char*
>> > * Removed unused variables
>> >
>> >
>> > And now, back to the soldering iron!
>> >
>> > 73,
>> > thomas
>> >
>>
>>
>>
>>
>

Other related posts: