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

  • From: Dave <dave@xxxxxxxxxx>
  • To: minima@xxxxxxxxxxxxx
  • Date: Tue, 11 Feb 2014 01:49:03 -0800

Thomas:
The PICs have built in prescalars and the counters will go to at least 50 MHz. The microprocessor crystal is used for the timebase. They certainly may be off frequency a bit(especially the cheap micro crystals), but should not drift a lot in a hamshack where the temp doesn't change a lot. But, you would then have to calibrate the counter in addition to the Si570. Simpler, I think, to use the factory stored values in the Si570 and inputting the default freq. if not the standard. If you order a Si570 with a default frequency of 30 MHz, the receiver will start up tuned to WWV. Looking at the difference with the carrier(an audio freq. unless really far off) will give the error.

Dave - WB6DHW
<http://wb6dhw.com>

On 2/11/2014 1:24 AM, Thomas Sarlandie wrote:
That is a very interesting idea but I think the frequency error would be much larger than what we get with pre-calibrated output.

Take this page for example:
http://jorisvr.nl/arduino_frequency.html

Mentions an error of +105 ppm over 24 hours with a 16mhz quartz. I am assuming it was in a room where the temperature did not change much. The maximum error with factory calibration is specd to be lower than 61.5ppm over the full range of temperature of the chip.

How do the pic based frequency counter works? They must have some pre-scaler and a pretty stable clock?

thomas



On Tue, Feb 11, 2014 at 1:13 AM, Dave <dave@xxxxxxxxxx <mailto:dave@xxxxxxxxxx>> wrote:

    Steve:
      It should be possible to write a small routine(microprocessor
    pin would be needed) to do the frequency counting function.
    Accuracy would depend on the accuracy of the 16 MHz crystal. That
    could make the calibration automatic only requiring a button push
    to initiate.  The program could program a frequency that is low
    enough for the micro to count it(say 10 MHz), compare the measured
    to commanded and then calculate the Si570 crystal frequency.

    Dave - WB6DHW
    <http://wb6dhw.com>


    On 2/11/2014 12:07 AM, Steve VK2SJA wrote:

        Some random thoughts:-

        Two calibration methods exist.

        1. Manually enter the start-up frequency. Software uses this
        value along
        with additional values retrieved from the Si570 chip to
        calculate the
        actual reference crystal value.

        2. Instruct Si570 to output known frequency, say 10Mhz and
        adjust up and
        down the software crystal reference value until the output on
        a frequency
        counter is exactly 10Mhz.

        Both methods have some Pros and Cons.

        Method 1:-
        You don't need a Frequency Counter
        You need to know your Si570 start-up frequency (might prove
        awkward
        finding this out without a counter - negates not needing one)
        Accuracy is good. But Tomas's own results seem to show that
        +/- 300 Hz
        might not be an unreasonable expectation.

        Method 2:-
        You DO require a frequency counter of some sort.
        Accuracy will only be as good as the counter.
        You don't need to know the Si570 start-up frequency.
        It is probably reasonable to expect errors of only +/- 3 Hz
        after calibration

        Not every person owns a Frequency Counter. I will even allow
        that it is
        possible that someone building a Minima may not own one.

        So I would actually suggest having both methods available via
        a Firmware
        set-up routine. Since most of the extra code would deal with
        changing a
        value via the VFO pot. And both methods require this. A
        significant
        portion of the code should be able to be shared between both
        methods.

        I'm thinking something along the lines of:-

        Press and hold Function button while powering up Minima to
        enter setup
        routine. Use VFO knob to cycle through setup options. Press
        enter to
        select the one you want. One option can be to exit setup.
        Something like
        this:-

        Setup
        Calibrate 1 -> Calibrate 2 -> Other Options we haven't thought
        of yet ->
        Quit -> Back to Calibrate 1

        When you enter either Calibrate 1 or 2 the user interaction is
        much the
        same. With one you are adjusting the crystal reference
        frequency up and
        down until you get exactly 10Mhz on the counter. With the
        other you are
        adjusting the value of the start-up frequency up or down until
        it matches
        your known Si570 start-up frequency. In both cases you press
        the Function
        button to accept and save the new value. Which returns to the
        top level
        setup menu.

        There is even a logical progression in doing both calibration
        routines in
        order 1 and 2. While entirely non-essential Calibrate 2 could
        use the
        calculated value produced by Calibrate 1 as its starting
        point. Which
        would put it very close to the correct value.


        Anyway just some random thoughts out loud.

        73, Steve.









            Thomas,

            Just to be clear, what I am suggesting is that the calibration
            procedure would initially present on the display a 'common'
            start-up frequency for the Si570.  As an example, the CMOS
            Si570 that is sold by KM5H
            
http://km5h.softrockradio.org/index.php?route=product/product&product_id=49
            has a start-up frequency of 56.32 MHz.  If it is agreed
            upon that
            that start-up frequency is commonly used, then that would
            be the
            frequency value initially presented to the operator.  If the
            Si570 actually being used has a different start-up frequency,
            then the operator can use the potentiometer to change the
            initial,
            value to the actual value.  For example, the CMOS Si570 that I
            have has an initial start-up frequency of 10 MHz, so I would
            adjust the frequency setting displayed accordingly prior to
            pushing the function button to accept the value displayed.  I
            hope this makes sense to you.

            73,

            Mac AE5PH

            On 02/10/2014 12:24 PM, Thomas Sarlandie wrote:

                Dan,

                Latest version of my code will always be available in
                my github
                repository:
                https://github.com/sarfata/radiono

                The code I was mentioning yesterday has already been
                merged by Farhan
                and so you will get all my changes in the official
                version which is
                available here:
                https://github.com/afarhan/radiono

                The rest of the discussion is about what is the best
                way to calibrate:
                  1 - Using factory calibration settings in the chip -
                but we need a
                way for the user to find out this frequency and give
                it to the program
                (maybe through a menu like what Mac suggested)
                  2 - Starting with no calibration and a fixed output
                frequency
                (10Mhz). Ask the user to adjust until it is perfectly
                10mhz.

                Both method will play nicely with my changes. Nothing
                was lost ;)

                best,
                thomas


                On Mon, Feb 10, 2014 at 9:50 AM, Dan Reynolds
                <on30ng@xxxxxxxxx <mailto:on30ng@xxxxxxxxx>
                <mailto:on30ng@xxxxxxxxx <mailto:on30ng@xxxxxxxxx>>>wrote:

                     Thomas, I would still like to see your code if
                possible.


                     73
                     Dan -- KB9JLO
                https://sites.google.com/site/on30ng/


                     On Sun, Feb 9, 2014 at 8:27 PM, Thomas Sarlandie
                     <thomas@xxxxxxxxxxxxx
                <mailto:thomas@xxxxxxxxxxxxx>
                <mailto:thomas@xxxxxxxxxxxxx
                <mailto:thomas@xxxxxxxxxxxxx>>>wrote:

                         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: