Si5351A - Page 4


+ Reply to Thread
Page 4 of 7 FirstFirst ... 23456 ... LastLast
Results 46 to 60 of 96

Thread: Si5351A1968 days old

  1. #46
    AlanGC
    Guest AlanGC's Avatar

    0 Not allowed!

    Default Re: Si5351A

    Hi John

    Thanks for that , I'm only looking for around 30Mhz max I like the device. Yes I will be adding a filter on the output and buffer amp,
    with a bifilar transformer. Interesting with the harmonics grr .. I will check also on the SA.

    Thanks

    Alan

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #47
    david
    Guest david's Avatar

    0 Not allowed!

    Default Re: Si5351A

    Hi John,
    In theory your 3rd harmonic can only be 9.5dB down and your 5th would be 14dB down - as you mention it's not a lot. If you see any 2nd, 4th etc it indicates an asymmetrical square wave so rather than 50:50 you may have 47:53 - it doesn't take much to mess up the odd order suppression.
    I guess we're all waiting for a simple digital tracking filter that we can bolt on the output and not have to retune when we change frequency.

    If you can't live with square wave outputs then you may have to look at a DDS with a DAC generated sine output. This reduces filtering requirements to a fixed frequency low pass but the lights do dim a little when you power these beasts up.
    I would be curious to see what harmonic levels you find and how far out they go. I'm guessing that by about the 9th the rise/fall time will predominate and the harmonics should taper off more rapidly.

    Cheers,
    David

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #48
    AlanGC
    Guest AlanGC's Avatar

    0 Not allowed!

    Default Re: Si5351A

    Hi John

    I got the Si5351A going on my 18F452 , there was nothing wrong with the module. How are you finding the frequency accuracy ? I'm using the adafruit module now with a clock of 25Mhz.

    Alan

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #49
    Junior Member stefano's Avatar
    Join Date
    Dec 2005
    Posts
    51
    Thumbs Up
    Received: 1
    Given: 1
    Total Downloaded
    793.31 MB

    0 Not allowed!

    Default Re: Si5351A

    Hi,
    I tried your script in my "si5351A" circuit and pic 18f452 but does not work.

    Regards.
    Stefano


    Click image for larger version

Name:	stefsi5351.jpg
Views:	17
Size:	16.4 KB
ID:	3025

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #50
    david
    Guest david's Avatar

    0 Not allowed!

    Default Re: Si5351A

    Hi Alan,
    As you know, the Silabs device is numerically controlled so accuracy will depend on the crystal tolerance and any maths rounding/floating point/short-cuts. The frequency counter will also have a tolerance unless referenced to a GPS locked standard.
    The little on-board xtal will likely be a cheap AT cut device with about 50ppm tolerance and a high sensitivity around room temperature. (I couldn't see a specification for the xtal on the board). You may have to expect up to +/-1500Hz error at 30MHz (not including counter error) - is this in line with what you're seeing?

    There is a register for xtal load capacitance change. I think it defaults to maximum so if you're low in frequency you could tweak that to raise the xtal frequency slightly. Another option would be to set the register to minimum C and fit a small trimmer (2-6pF?) on one side of the xtal and manually adjust on to frequency.
    Good luck with your project.

    Cheers,
    David

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #51
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,887
    Thumbs Up
    Received: 91
    Given: 34
    Total Downloaded
    4.60 GB

    0 Not allowed!

    Default Re: Si5351A - 18F452 20Mhz no joy

    Hi David and Alan,
    I've not had time to put the output onto the spectrum analyser yet, but I will and report back.
    One experiment I did do was wave a hot air gun over the board and I was amazed how stable it was - I was listening to it on a SSB receiver on 146MHz. and listening to the fundamental. From memory I think it was about a kHz low but I haven't put the counter on it yet.
    I've been caught up with other priorities for a few days.
    David, I'm quite happy with high harmonic content at this point because my simple signal generator will need to also cover the 420-440MHz band and I can use third harmonic to do this. At present I cart my very heavy Sig gen to hilltops and I'm looking at making the project in a small die cast box. For many purposes good attenuation won't be necessary but I'll need to arrange a modulation system - probably phase mod and then multiply. Don't know yet, half the fun is in the planning.

    Alan can you post your 452 code. Did you have to change my version very much? It will probably help Stefano too.
    John

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #52
    AlanGC
    Guest AlanGC's Avatar

    0 Not allowed!

    Default Re: Si5351A - 18F452 20Mhz no joy

    Hi David

    Thanks for your reply , Im seeing a error of about 500hz max at some frequencies but mostly around 300 - 400 hz. It does vary with frequency tho. I completely understand
    the source of errors with code , crystal etc . I need it alot more accuarate than it is with the ada fruit board and a 25 MHZ clock as you say. Drift
    doesn't seem bad , Im using a Racal Dana frequency counter which is v accurate , I can also zero beat on receiver and the readings match.
    The guy at Qrp labs also suggests measuring the osc frequency then entering into the Xtal value so I might try that.I had read about the crystal cap value is
    setup in one of the registers.

    Stefano this is the 18F452 code that works on ada fruit pcb . Frequency accuracy varies upto about max 500 hz depending on what frequency you set. Les posted this earlier in the
    thread its just changed for my pic 18F452 device

    Thanks

    Alan

    Code:
    '****************************************************************
    '*  Name    : Si5351A.BAS                                       *
    '*  Author  : Les and Charlie with a few mods from me           *
    '*  Notice  : Copyright (c) 2016 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 13/04/2016                                        *
    '*  Version : 1.0                                               *
    '*  Notes   : frequency synthesiser si5351A                     *
    '*          : adjust cXTAL_FREQ to calibrate                    *
    '****************************************************************
       Device = 18F452
    
        Declare Reminders On
        All_Digital = true
        Xtal = 20
        
        Declare Optimiser_Level = 2
        Declare Dead_Code_Remove = 1
            
        Declare SDA_Pin PORTC.0      'may need adjustment
        Declare SCL_Pin PORTC.1
        Declare Slow_Bus On
          
        Declare LCD_CommandUs 2000
        Declare LCD_DataUs 50
                                     
    
        Declare LCD_Type 0            'text type
        Declare LCD_DTPin PORTD.4     'assigns data lines to B4..7  
        Declare LCD_ENPin PORTD.3     'enable pin
        Declare LCD_RSPin PORTD.2     'RS line pin
        Declare LCD_Interface 4       '4 or 8 input line interface
        Declare LCD_Lines 2           '2 line display
    
        
    $define cSI_CLK0_CONTROL     16              ' Register definitions
    $define cSI_CLK1_CONTROL     17
    $define cSI_CLK2_CONTROL     18
    $define cSI_SYNTH_PLL_A      26
    $define cSI_SYNTH_PLL_B      34
    $define cSI_SYNTH_MS_0       42
    $define cSI_SYNTH_MS_1       50
    $define cSI_SYNTH_MS_2       58
    $define cSI_PLL_RESET        177
        
    $define cSI_R_DIV_1          %00000000       ' R-division ratio definitions
    $define cSI_R_DIV_2          %00010000
    $define cSI_R_DIV_4          %00100000
    $define cSI_R_DIV_8          %00110000
    $define cSI_R_DIV_16         %01000000
    $define cSI_R_DIV_32         %01010000
    $define cSI_R_DIV_64         %01100000
    $define cSI_R_DIV_128        %01110000
    
    $define cSI_CLK_SRC_PLL_A    %00000000
    $define cSI_CLK_SRC_PLL_B    %00100000
    
    $define cXTAL_FREQ            25000000  ' Crystal frequency
    
    
    $define cI2C_WRITE           %11000000     ' I2C address for writing to the Si5351A
    $define cI2C_READ            %11000001 
       
    
    
        Dim dP1                     As Dword        ' Synth config register P1
        Dim dP2 As Dword                            ' Synth config register P2
        Dim dP3 As Dword                            ' Synth config register P3
    
    
        Dim bI2CRegister_Reg        As Byte
        Dim bI2CRegister_Data       As Byte
    
    
        Dim bOutputOff_Clk          As Byte
    
    
        Dim bSetupMultisynth_Synth  As Byte
        Dim dSetupMultisynth_Divider As Dword
        Dim bSetupMultisynth_Div    As Byte
        Dim dFreqM                  As Dword        ' display MHz
        Dim dFreqK                  As Dword        ' display kHz
    
        Dim dSetupPLL_PLL           As Byte
        Dim bSetupPLL_Mult          As Byte
        Dim dSetupPLL_Num           As Dword
        Dim dSetupPLL_Denom         As Dword
        Dim fSetupPLL_Num           As Float
        Dim fSetupPLL_Denom         As Float
    
    
        Dim dSetFrequency           As Dword
    
    
        Dim dSetFrequency_PllFreq   As Dword
        Dim dSetFrequency_L         As Dword
        Dim fSetFrequency_F         As Float
        Dim bSetFrequency_Mult      As Byte
        Dim dSetFrequency_Num       As Dword
        Dim dSetFrequency_Denom     As Dword
        Dim dSetFrequency_Divider   As Dword
        
        
        GoTo Main                                   ' Jump over the subroutines
        
    '---------------------------------------------------------------------------
    $define SI5351A_I2CSendRegister(pReg, pData) '
        bI2CRegister_Reg = pReg                  '
        bI2CRegister_Data = pData                '
        GoSub _SI5351A_I2CSendRegister
    
    
    
    
    _SI5351A_I2CSendRegister:
        BStart
        BusOut cI2C_WRITE
        BusOut bI2CRegister_Reg
        BusOut bI2CRegister_Data
        BStop
    Return
    
    
    '---------------------------------------------------------------------------
    $define SI5351A_I2CReadRegister(pReg, pData)'
        bI2CRegister_Reg = pReg                 '
        GoSub _SI5351A_I2CReadRegister          '
        pData = bI2CRegister_Data
    
    _SI5351A_I2CReadRegister:
        BStart
        BusOut cI2C_WRITE
        BusOut bI2CRegister_Reg
        BReStart
        BusOut cI2C_READ
        bI2CRegister_Data = BusIn
        BusNack
        BStop
    Return
    
    
    '---------------------------------------------------------------------------
    ' Set up specified PLL with mult, num and denom
    ' pMult is 15..90
    ' pNum is 0..1,048,575 ($FFFFF)
    ' pDenom is 0..1,048,575 ($FFFFF)
    '
    $define SI5351A_SetupPLL(pPll, pMult, pNum, pDenom)'
        dSetupPLL_PLL = pPll      '
        bSetupPLL_Mult = pMult    '
        dSetupPLL_Num = pNum      '
        dSetupPLL_Denom = pDenom  '
        GoSub _SI5351A_SetupPLL
    
    
    
    
    _SI5351A_SetupPLL:
        fSetupPLL_Num = dSetupPLL_Num
        fSetupPLL_Denom = dSetupPLL_Denom
        dP1 = (128 * (fSetupPLL_Num / fSetupPLL_Denom))
        dP1 = ((128 * bSetupPLL_Mult) + dP1 - 512)
        dP2 = ((128 * (fSetupPLL_Num) / fSetupPLL_Denom))
        dP2 = ((128 * dSetupPLL_Num) - (dSetupPLL_Denom * dP2))
        dP3 = dSetupPLL_Denom
    
    
    
    
        SI5351A_I2CSendRegister(dSetupPLL_PLL, dP3.Byte1)
        SI5351A_I2CSendRegister(dSetupPLL_PLL + 1, dP3.Byte0)
        SI5351A_I2CSendRegister(dSetupPLL_PLL + 2, dP1.Byte2 & $03) '(dP1 & $00030000) >> 16)
        SI5351A_I2CSendRegister(dSetupPLL_PLL + 3, dP1.Byte1)
        SI5351A_I2CSendRegister(dSetupPLL_PLL + 4, dP1.Byte0)
        SI5351A_I2CSendRegister(dSetupPLL_PLL + 5, ((dP3 & $000F0000) >> 12) | (dP2.Byte2 & $0F)) '((dP2 & $000F0000) >> 16))
        SI5351A_I2CSendRegister(dSetupPLL_PLL + 6, dP2.Byte1)
        SI5351A_I2CSendRegister(dSetupPLL_PLL + 7, dP2.Byte0)
    Return
    
    
    
    
    '---------------------------------------------------------------------------
    ' Set up MultiSynth with integer divider and R divider
    ' R divider is the bit value which is OR'ed onto the appropriate register, it is a $define
    '
    $define SI5351A_SetupMultisynth(pSynth, pDivider, pDiv) '
        bSetupMultisynth_Synth = pSynth     '
        dSetupMultisynth_Divider = pDivider '
        bSetupMultisynth_Div = pDiv         '
        GoSub _SI5351A_SetupMultisynth
    
    
    
    
    _SI5351A_SetupMultisynth:
        dP1 = (128 * dSetupMultisynth_Divider) - 512
        dP2 = 0                                         ' dP2 = 0, dP3 = 1 forces an integer value for the divider
        dP3 = 1
    
        SI5351A_I2CSendRegister(bSetupMultisynth_Synth,     dP3.Byte1)
        SI5351A_I2CSendRegister(b + 1, dP3.Byte0)
        SI5351A_I2CSendRegister(bSetupMultisynth_Synth + 2, (dP1.Byte2 & $03) | bSetupMultisynth_Div) '((dP1 & $00030000) >> 16) | bSetupMultisynth_Div)
        SI5351A_I2CSendRegister(bSetupMultisynth_Synth + 3, dP1.Byte1)
        SI5351A_I2CSendRegister(bSetupMultisynth_Synth + 4, dP1.Byte0)
        SI5351A_I2CSendRegister(bSetupMultisynth_Synth + 5, ((dP3 & $000F0000) >> 12) | (dP2.Byte2 & $0F)) '((dP2 & $000F0000) >> 16))
        SI5351A_I2CSendRegister(bSetupMultisynth_Synth + 6, dP2.Byte1)
        SI5351A_I2CSendRegister(bSetupMultisynth_Synth + 7, dP2.Byte0)
    Return
    
    
    '---------------------------------------------------------------------------
    ' Switches off Si5351a output
    ' Example: SI5351A_OutputOff(cSI_CLK0_CONTROL) will switch off output CLK0
    '
    $define SI5351A_OutputOff(pClk)   '
        bOutputOff_Clk = pClk         '
        GoSub _SI5351A_OutputOff
    
    
    _SI5351A_OutputOff:
        SI5351A_I2CSendRegister(bOutputOff_Clk, $80)        ' Refer to SiLabs AN619 to see bit values - $80 turns off the output stage
        BStop
    Return
    
    '---------------------------------------------------------------------------
    ' Set CLK0 output ON and to the specified frequency
    ' Frequency is in the range 1MHz to 150MHz
    ' Example: SI5351A_SetFrequency(10000000) will set output CLK0 to 10MHz
    '
    ' This example sets up PLL A and MultiSynth 0 and produces the output on CLK0
    '
    $define SI5351A_SetFrequency(pFrequency) '
        dSetFrequency = pFrequency           '
        GoSub _SI5351A_SetFrequency
    
    
    _SI5351A_SetFrequency:
        dSetFrequency_Divider = 900000000 / dSetFrequency                   ' Calculate the division ratio. 900,000,000 is the maximum internal
        If (dSetFrequency_Divider // 2) > 0 Then Dec dSetFrequency_Divider  ' Ensure an even integer division ratio
    
    
        dSetFrequency_PllFreq = dSetFrequency_Divider * dSetFrequency       ' Calculate the pllFrequency: the dSetFrequency_Divider * desired output frequency
    
    
        bSetFrequency_Mult = dSetFrequency_PllFreq / cXTAL_FREQ             ' Determine the multiplier to get to the required pllFrequency
        
        dSetFrequency_L = dSetFrequency_PllFreq // cXTAL_FREQ               ' It has three parts:
        
        fSetFrequency_F = dSetFrequency_L                                   ' bSetFrequency_Mult is an integer that must be in the range 15..90
        fSetFrequency_F = fSetFrequency_F * 1048575                         ' dSetFrequency_Num and dSetFrequency_Denom are the fractional parts, the numerator and denominator
        fSetFrequency_F = fSetFrequency_F / cXTAL_FREQ                      ' each is 20 bits (range 0..1048575)
        
        dSetFrequency_Num = fSetFrequency_F                                 ' the actual multiplier is  bSetFrequency_Mult + dSetFrequency_Num / dSetFrequency_Denom
        
        dSetFrequency_Denom = 1048575                                       ' For simplicity we set the denominator to the maximum 1048575
    
    
    
    ' Set up PLL A with the calculated multiplication ratio
    
        SI5351A_SetupPLL(cSI_SYNTH_PLL_A, bSetFrequency_Mult, dSetFrequency_Num, dSetFrequency_Denom)
       
    
    ' Set up MultiSynth dSetFrequency_Divider 0, with the calculated dSetFrequency_Divider.
    ' The final R division stage can divide by a power of two, from 1..128.
    ' reprented by constants cSI_R_DIV1 to cSI_R_DIV128 (see si5351a.h header file)
    ' If you want to output frequencies below 1MHz, you have to use the final R division stage
    '
        SI5351A_SetupMultisynth(cSI_SYNTH_MS_0, dSetFrequency_Divider, cSI_R_DIV_1)
       
        
    ' Reset the PLL. This causes a glitch in the output. For small changes to the parameters, you don't need to reset the PLL, and there is no glitch
    
        SI5351A_I2CSendRegister(cSI_PLL_RESET, $A0)
       
        
    ' Finally switch on the CLK0 output ($4F) and set the MultiSynth0 input to be PLL A
    
        SI5351A_I2CSendRegister(cSI_CLK0_CONTROL, $4F | cSI_CLK_SRC_PLL_A)
        
    Return
    
    
    DisplayFreq:       
         dFreqM=dSetFrequency / 1000000
         dFreqK=dSetFrequency - (dFreqM * 1000000)
         dFreqK=dFreqK / 10                         'to fit on 16 char display
         Cls
         Print At 1,1,"Freq=",Dec dFreqM,".",Dec dFreqK,"MHz"
    Return
    
    
    '----------------------------------------------------------------------------------------------------------
    Main:
        Clear
        dSetFrequency = 10000000'set the frequency of operation
        SI5351A_SetFrequency(dSetFrequency)
        GoSub DisplayFreq
        Stop 
    End
    Last edited by joesaliba; 6th May 2016 at 15:42.

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  15. #53
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,596
    Thumbs Up
    Received: 341
    Given: 162
    Total Downloaded
    1.99 GB

    1 Not allowed!

    Default Re: Si5351A - 18F452 20Mhz no joy

    It's so gratifying that the code I wrote has been adapted and used by Proton users. It's a pleasure to see it being of practical use.

  16. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  17. #54
    Junior Member stefano's Avatar
    Join Date
    Dec 2005
    Posts
    51
    Thumbs Up
    Received: 1
    Given: 1
    Total Downloaded
    793.31 MB

    0 Not allowed!

    Default Re: Si5351A

    Thanks & compliments to all !
    It works fine.

    Regards

    Stefano



    Code:
    '************************************************* ***************'* Name : Si5351A.BAS *
    '* Author : Les and Charlie with a few mods from me *
    '* Notice : Copyright (c) 2016 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 13/04/2016 *
    '* Version : 1.0 *
    '* Notes : frequency synthesiser si5351A *
    '* : adjust cXTAL_FREQ to calibrate *
    '* Stefano new device added: 18f448 & Fuse conf. 05/05/2016
    '************************************************* ***************
    ;-------------------------------------------------------------------------------
    
    
    ;**** Added by Fuse Configurator ****
    ; Use the Fuse Configurator plug-in to change these settings
    
    
    Device = 18F448
    
    
    Config_Start
      OSC = HS    ;HS oscillator
      OSCS = OFF    ;Oscillator system clock switch option is disabled (main oscillator is source)
      PWRT = OFF    ;PWRT disabled
      BOR = OFF    ;Brown-out Reset disabled
      BORV = 25    ;VBOR set to 2.5V
      WDT = OFF    ;WDT disabled (control is placed on the SWDTEN bit)
      WDTPS = 128    ;1:128
      STVR = On    ;Stack Full/Underflow will cause Reset
      LVP = OFF    ;Low-Voltage ICSP disabled
      Debug = OFF    ;Background Debugger disabled. RB6 and RB7 configured as general purpose I/O pins.
      Cp0 = OFF    ;Block 0 (000200-001FFFh) not code protected
      CP1 = OFF    ;Block 1 (002000-003FFFh) not code protected
      CPB = OFF    ;Boot Block (000000-0001FFh) not code protected
      CPD = OFF    ;Data EEPROM not code protected
      WRT0 = OFF    ;Block 0 (000200-001FFFh) not write protected
      WRT1 = OFF    ;Block 1 (002000-003FFFh) not write protected
      WRTC = OFF    ;Configuration registers (300000-3000FFh) not write protected
      WRTB = OFF    ;Boot Block (000000-0001FFh) not write protected
      WRTD = OFF    ;Data EEPROM not write protected
      EBTR0 = OFF    ;Block 0 (000200-001FFFh) not protected from Table Reads executed in other blocks
      EBTR1 = OFF    ;Block 1 (002000-003FFFh) not protected from Table Reads executed in other blocks
      EBTRB = OFF    ;Boot Block (000000-0001FFh) not protected from Table Reads executed in other blocks
    Config_End
    
    
    ;**** End of Fuse Configurator Settings ****
    ;-------------------------------------------------------------------------------
    
    
    
    
    Xtal = 20
    
    
    
    
    Declare Reminders On
    All_Digital = true
    
    
    
    
    Declare Optimiser_Level = 2
    Declare Dead_Code_Remove = 1
    
    
    Declare SDA_Pin PORTC.0 'may need adjustment
    Declare SCL_Pin PORTC.1
    Declare Slow_Bus On
    
    
    Declare LCD_CommandUs 2000
    Declare LCD_DataUs 50
    
    
    
    
    Declare LCD_Type 0 'text type
    Declare LCD_DTPin PORTD.4 'assigns data lines to B4..7 
    Declare LCD_ENPin PORTD.3 'enable pin
    Declare LCD_RSPin PORTD.2 'RS line pin
    Declare LCD_Interface 4 '4 or 8 input line interface
    Declare LCD_Lines 2 '2 line display
    
    
    
    
    $define cSI_CLK0_CONTROL 16 ' Register definitions
    $define cSI_CLK1_CONTROL 17
    $define cSI_CLK2_CONTROL 18
    $define cSI_SYNTH_PLL_A 26
    $define cSI_SYNTH_PLL_B 34
    $define cSI_SYNTH_MS_0 42
    $define cSI_SYNTH_MS_1 50
    $define cSI_SYNTH_MS_2 58
    $define cSI_PLL_RESET 177
    
    
    $define cSI_R_DIV_1 000000 ' R-division ratio definitions
    $define cSI_R_DIV_2 010000
    $define cSI_R_DIV_4 100000
    $define cSI_R_DIV_8 110000
    $define cSI_R_DIV_16 000000
    $define cSI_R_DIV_32 010000
    $define cSI_R_DIV_64 100000
    $define cSI_R_DIV_128 110000
    
    
    $define cSI_CLK_SRC_PLL_A 000000
    $define cSI_CLK_SRC_PLL_B 100000
    
    
    $define cXTAL_FREQ 25000000 ' Crystal frequency
    
    
    
    
    $define cI2C_WRITE 000000 ' I2C address for writing to the Si5351A
    $define cI2C_READ 000001 
    
    
    
    
    
    
    Dim dP1 As Dword ' Synth config register P1
    Dim dP2 As Dword ' Synth config register P2
    Dim dP3 As Dword ' Synth config register P3
    
    
    
    
    Dim bI2CRegister_Reg As Byte
    Dim bI2CRegister_Data As Byte
    
    
    
    
    Dim bOutputOff_Clk As Byte
    
    
    
    
    Dim bSetupMultisynth_Synth As Byte
    Dim dSetupMultisynth_Divider As Dword
    Dim bSetupMultisynth_Div As Byte
    Dim dFreqM As Dword ' display MHz
    Dim dFreqK As Dword ' display kHz
    
    
    Dim dSetupPLL_PLL As Byte
    Dim bSetupPLL_Mult As Byte
    Dim dSetupPLL_Num As Dword
    Dim dSetupPLL_Denom As Dword
    Dim fSetupPLL_Num As Float
    Dim fSetupPLL_Denom As Float
    
    
    
    
    Dim dSetFrequency As Dword
    
    
    
    
    Dim dSetFrequency_PllFreq As Dword
    Dim dSetFrequency_L As Dword
    Dim fSetFrequency_F As Float
    Dim bSetFrequency_Mult As Byte
    Dim dSetFrequency_Num As Dword
    Dim dSetFrequency_Denom As Dword
    Dim dSetFrequency_Divider As Dword
    
    
    
    
    GoTo Main ' Jump over the subroutines
    
    
    '---------------------------------------------------------------------------
    $define SI5351A_I2CSendRegister(pReg, pData) '
    bI2CRegister_Reg = pReg '
    bI2CRegister_Data = pData '
    GoSub _SI5351A_I2CSendRegister
    
    
    
    
    
    
    
    
    _SI5351A_I2CSendRegister:
    BStart
    BusOut cI2C_WRITE
    BusOut bI2CRegister_Reg
    BusOut bI2CRegister_Data
    BStop
    Return
    
    
    
    
    '---------------------------------------------------------------------------
    $define SI5351A_I2CReadRegister(pReg, pData)'
    bI2CRegister_Reg = pReg '
    GoSub _SI5351A_I2CReadRegister '
    pData = bI2CRegister_Data
    
    
    _SI5351A_I2CReadRegister:
    BStart
    BusOut cI2C_WRITE
    BusOut bI2CRegister_Reg
    BReStart
    BusOut cI2C_READ
    bI2CRegister_Data = BusIn
    BusNack
    BStop
    Return
    
    
    
    
    '---------------------------------------------------------------------------
    ' Set up specified PLL with mult, num and denom
    ' pMult is 15..90
    ' pNum is 0..1,048,575 ($FFFFF)
    ' pDenom is 0..1,048,575 ($FFFFF)
    '
    $define SI5351A_SetupPLL(pPll, pMult, pNum, pDenom)'
    dSetupPLL_PLL = pPll '
    bSetupPLL_Mult = pMult '
    dSetupPLL_Num = pNum '
    dSetupPLL_Denom = pDenom '
    GoSub _SI5351A_SetupPLL
    
    
    
    
    
    
    
    
    _SI5351A_SetupPLL:
    fSetupPLL_Num = dSetupPLL_Num
    fSetupPLL_Denom = dSetupPLL_Denom
    dP1 = (128 * (fSetupPLL_Num / fSetupPLL_Denom))
    dP1 = ((128 * bSetupPLL_Mult) + dP1 - 512)
    dP2 = ((128 * (fSetupPLL_Num) / fSetupPLL_Denom))
    dP2 = ((128 * dSetupPLL_Num) - (dSetupPLL_Denom * dP2))
    dP3 = dSetupPLL_Denom
    
    
    
    
    
    
    
    
    SI5351A_I2CSendRegister(dSetupPLL_PLL, dP3.Byte1)
    SI5351A_I2CSendRegister(dSetupPLL_PLL + 1, dP3.Byte0)
    SI5351A_I2CSendRegister(dSetupPLL_PLL + 2, dP1.Byte2 & $03) '(dP1 & $00030000) >> 16)
    SI5351A_I2CSendRegister(dSetupPLL_PLL + 3, dP1.Byte1)
    SI5351A_I2CSendRegister(dSetupPLL_PLL + 4, dP1.Byte0)
    SI5351A_I2CSendRegister(dSetupPLL_PLL + 5, ((dP3 & $000F0000) >> 12) | (dP2.Byte2 & $0F)) '((dP2 & $000F0000) >> 16))
    SI5351A_I2CSendRegister(dSetupPLL_PLL + 6, dP2.Byte1)
    SI5351A_I2CSendRegister(dSetupPLL_PLL + 7, dP2.Byte0)
    Return
    
    
    
    
    
    
    
    
    '---------------------------------------------------------------------------
    ' Set up MultiSynth with integer divider and R divider
    ' R divider is the bit value which is OR'ed onto the appropriate register, it is a $define
    '
    $define SI5351A_SetupMultisynth(pSynth, pDivider, pDiv) '
    bSetupMultisynth_Synth = pSynth '
    dSetupMultisynth_Divider = pDivider '
    bSetupMultisynth_Div = pDiv '
    GoSub _SI5351A_SetupMultisynth
    
    
    
    
    
    
    
    
    _SI5351A_SetupMultisynth:
    dP1 = (128 * dSetupMultisynth_Divider) - 512
    dP2 = 0 ' dP2 = 0, dP3 = 1 forces an integer value for the divider
    dP3 = 1
    
    
    SI5351A_I2CSendRegister(bSetupMultisynth_Synth, dP3.Byte1)
    SI5351A_I2CSendRegister(bSetupMultisynth_Synth + 1, dP3.Byte0)
    SI5351A_I2CSendRegister(bSetupMultisynth_Synth + 2, (dP1.Byte2 & $03) | bSetupMultisynth_Div) '((dP1 & $00030000) >> 16) | bSetupMultisynth_Div)
    SI5351A_I2CSendRegister(bSetupMultisynth_Synth + 3, dP1.Byte1)
    SI5351A_I2CSendRegister(bSetupMultisynth_Synth + 4, dP1.Byte0)
    SI5351A_I2CSendRegister(bSetupMultisynth_Synth + 5, ((dP3 & $000F0000) >> 12) | (dP2.Byte2 & $0F)) '((dP2 & $000F0000) >> 16))
    SI5351A_I2CSendRegister(bSetupMultisynth_Synth + 6, dP2.Byte1)
    SI5351A_I2CSendRegister(bSetupMultisynth_Synth + 7, dP2.Byte0)
    Return
    
    
    
    
    '---------------------------------------------------------------------------
    ' Switches off Si5351a output
    ' Example: SI5351A_OutputOff(cSI_CLK0_CONTROL) will switch off output CLK0
    '
    $define SI5351A_OutputOff(pClk) '
    bOutputOff_Clk = pClk '
    GoSub _SI5351A_OutputOff
    
    
    
    
    _SI5351A_OutputOff:
    SI5351A_I2CSendRegister(bOutputOff_Clk, $80) ' Refer to SiLabs AN619 to see bit values - $80 turns off the output stage
    BStop
    Return
    
    
    '---------------------------------------------------------------------------
    ' Set CLK0 output ON and to the specified frequency
    ' Frequency is in the range 1MHz to 150MHz
    ' Example: SI5351A_SetFrequency(10000000) will set output CLK0 to 10MHz
    '
    ' This example sets up PLL A and MultiSynth 0 and produces the output on CLK0
    '
    $define SI5351A_SetFrequency(pFrequency) '
    dSetFrequency = pFrequency '
    GoSub _SI5351A_SetFrequency
    
    
    
    
    _SI5351A_SetFrequency:
    dSetFrequency_Divider = 900000000 / dSetFrequency ' Calculate the division ratio. 900,000,000 is the maximum internal
    If (dSetFrequency_Divider // 2) > 0 Then Dec dSetFrequency_Divider ' Ensure an even integer division ratio
    
    
    
    
    dSetFrequency_PllFreq = dSetFrequency_Divider * dSetFrequency ' Calculate the pllFrequency: the dSetFrequency_Divider * desired output frequency
    
    
    
    
    bSetFrequency_Mult = dSetFrequency_PllFreq / cXTAL_FREQ ' Determine the multiplier to get to the required pllFrequency
    
    
    dSetFrequency_L = dSetFrequency_PllFreq // cXTAL_FREQ ' It has three parts:
    
    
    fSetFrequency_F = dSetFrequency_L ' bSetFrequency_Mult is an integer that must be in the range 15..90
    fSetFrequency_F = fSetFrequency_F * 1048575 ' dSetFrequency_Num and dSetFrequency_Denom are the fractional parts, the numerator and denominator
    fSetFrequency_F = fSetFrequency_F / cXTAL_FREQ ' each is 20 bits (range 0..1048575)
    
    
    dSetFrequency_Num = fSetFrequency_F ' the actual multiplier is bSetFrequency_Mult + dSetFrequency_Num / dSetFrequency_Denom
    
    
    dSetFrequency_Denom = 1048575 ' For simplicity we set the denominator to the maximum 1048575
    
    
    
    
    
    
    ' Set up PLL A with the calculated multiplication ratio
    
    
    SI5351A_SetupPLL(cSI_SYNTH_PLL_A, bSetFrequency_Mult, dSetFrequency_Num, dSetFrequency_Denom)
    
    
    
    
    ' Set up MultiSynth dSetFrequency_Divider 0, with the calculated dSetFrequency_Divider.
    ' The final R division stage can divide by a power of two, from 1..128.
    ' reprented by constants cSI_R_DIV1 to cSI_R_DIV128 (see si5351a.h header file)
    ' If you want to output frequencies below 1MHz, you have to use the final R division stage
    '
    SI5351A_SetupMultisynth(cSI_SYNTH_MS_0, dSetFrequency_Divider, cSI_R_DIV_1)
    
    
    
    
    ' Reset the PLL. This causes a glitch in the output. For small changes to the parameters, you don't need to reset the PLL, and there is no glitch
    
    
    SI5351A_I2CSendRegister(cSI_PLL_RESET, $A0)
    
    
    
    
    ' Finally switch on the CLK0 output ($4F) and set the MultiSynth0 input to be PLL A
    
    
    SI5351A_I2CSendRegister(cSI_CLK0_CONTROL, $4F | cSI_CLK_SRC_PLL_A)
    
    
    Return
    
    
    
    
    DisplayFreq: 
    dFreqM=dSetFrequency / 1000000
    dFreqK=dSetFrequency - (dFreqM * 1000000)
    dFreqK=dFreqK / 10 'to fit on 16 char display
    Cls
    Print At 1,1,"Freq=",Dec dFreqM,".",Dec dFreqK,"MHz"
    Return
    
    
    
    
    '----------------------------------------------------------------------------------------------------------
    Main:
    Clear
    dSetFrequency = 40000000'set the frequency of operation
    SI5351A_SetFrequency(dSetFrequency)
    GoSub DisplayFreq
    Stop 
    End
    Click image for larger version

Name:	si5351_ok.jpg
Views:	16
Size:	47.0 KB
ID:	3027
    Last edited by stefano; 5th May 2016 at 18:55.

  18. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  19. #55
    AlanGC
    Guest AlanGC's Avatar

    0 Not allowed!

    Default Re: Si5351A

    Hi Stefano

    Glad its finally working .. How accurate is your frequency output ?

    This is interesting under the calibration section how to modify your 27 MHz clock .. http://www.qrp-labs.com/images/qcu/assembly_qcu.pdf

    Alan

  20. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  21. #56
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,887
    Thumbs Up
    Received: 91
    Given: 34
    Total Downloaded
    4.60 GB

    0 Not allowed!

    Default Re: Si5351A

    Thank you Les, I doubt I would have gotten it going by myself.
    Alan, early on in my experiments I did play with the crystal frequency but only used a receiver for checking the frequency and netted it at 146.000MHz but I'm fairly sure the RX is about 300Hz high. Anyway I could adjust the frequency by just altering the crystal value in the code. Not sure how legitimate that is though. I think the best approach is to follow David's advice.
    John
    On my tablet having breakfast!
    Last edited by John Drew; 5th May 2016 at 23:15.

  22. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  23. #57
    AlanGC
    Guest AlanGC's Avatar

    0 Not allowed!

    Default Re: Si5351A

    Hi John

    I like a guy who starts early !

    The frequency accuracy seems quite poor , I know as you said you can tweak
    the crystal value in the code which can improve the accuracy on that particular
    Frequency but as soon as change frequency back to square one. I'm looking at the
    Si device to function as a VFO , the other Analogue Devices IC's I have used work great.
    I know others are using this device in VFO"s with accuracy in the range of Hz across a wide
    Frequency range. Probably as Davis said a combination of errors.

    Alan

  24. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  25. #58
    david
    Guest david's Avatar

    0 Not allowed!

    Default Re: Si5351A

    Hi guys,
    Adjusting for the clock frequency value should be valid across all output frequencies and is quite legitimate given the tolerance of the xtal. If it appears to be good at one frequency but worse (in ppm) at another then something else would appear to be coming in to play.
    I've not been right through the code but can see there are two values declared as floats - are these involved in the output frequency and can you live with the limited resolution?

    You have the option of feeding an external 25-27MHz clock in to the Xtal in pin. A small TCXO at this frequency could do wonders for both offset and temperature stability.

    John - if you wave your hot air gun a little longer I believe you will very likely see the frequency drop. The assembly will have a fairly long time constant and you will need to raise the temperature of the copper before the xtal sees much change. The quartz blank is mounted on two tiny conductive silicon glue dots to connect the electrodes but the thermal transfer is minimal. Transfer through the lid of the package to the nitrogen filled cavity (assumed) and then to the blank is also a fairly long time constant but it will certainly track ambient and will be very linear for about +/-20C around room temperature. With a good counter you can certainly watch the aircon switch on and off so keep it covered to integrate the thermal changes even more.

    Cheers,
    David

  26. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  27. #59
    Junior Member stefano's Avatar
    Join Date
    Dec 2005
    Posts
    51
    Thumbs Up
    Received: 1
    Given: 1
    Total Downloaded
    793.31 MB

    0 Not allowed!

    Default Re: Si5351A

    Quote Originally Posted by AlanGC View Post
    Hi Stefano

    Glad its finally working .. How accurate is your frequency output ?

    This is interesting under the calibration section how to modify your 27 MHz clock .. http://www.qrp-labs.com/images/qcu/assembly_qcu.pdf

    Alan
    Hi Alan,
    I'm use 25 Mhz xtal clock on self made circuit & PCB
    I am planning a VFO for RX Hf & Vhf.

    Thanks again for code.

    Stefano

  28. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  29. #60
    AlanGC
    Guest AlanGC's Avatar

    0 Not allowed!

    Default Re: Si5351A

    Hi David

    Thanks for the update , it would be good if you could check through the code if you have time. I need
    a much more accurate output within 10 Hz's across a wide frequency range. I agree its only as good as the clock etc but I'm finding quite big errors 3KC's around 40Mhz seems a little odd compared to a AD DDS chip - maybe there's a mistake in the code.

    Thanks

    Alan

  30. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

+ Reply to Thread
Page 4 of 7 FirstFirst ... 23456 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. [SOLVED !] Si5351A with Proton ?
    By AlanGC in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 26th October 2015, 20:46

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts