How to control the Si5351 pls ?
+ Reply to Thread
Results 1 to 24 of 24
  1. #1
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    303

    Default How to control the Si5351 pls ?

    Good day to all in this forum.
    I will like to know if there is an algorithm capable of controlling the Si5351 frequency generator.
    I really do need just a simple frequency to data_out to set up the correct frequency on the generator...
    Thanks in advance for any assistance.
    Regards,
    Ambro

  2. #2

    Default Re: How to control the Si5351 pls ?

    Did you ever get this working?

  3. #3

    Default Re: How to control the Si5351 pls ?

    Maybe I'll ask a broader question. The SI5351 device can generate a number of independent clocks, from a few Hz to over 100 MHz. Sounds pretty useful as a replacement for a VFO in radio projects. I'm pretty sure I can get it going, but the command structure is quite complicated, and I was wondering if anybody had implemented it in PBP yet? I have no problem with I2C or actually talking to the device, I was just hoping to save time on implementing the commands. There is an Arduino sketch for it, but reverse engineering that is probably more work than just starting from scratch. Has anybody taken a poke at this one?

  4. #4
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    303

    Default Re: How to control the Si5351 pls ?

    good day to all in this forum,

    is there some implementation of PICBASIC code for controlling such a devices up to now ?

    Thanks
    Regards,

  5. #5

    Default Re: How to control the Si5351 pls ?

    The silence remains deafening :-)

  6. #6
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    303

    Default Re: How to control the Si5351 pls ?

    I think nobody has implemented it...

    In the ham radio club everybody is very interested on this item.
    Still hoping.
    iw2fvo,

  7. #7
    Join Date
    Jan 2005
    Location
    France
    Posts
    86

    Default Re: How to control the Si5351 pls ?

    hello here is F1CHF
    did you try a Google search with SI5351
    I see some example
    try
    https://www.google.fr/search?q=SI535...w=1024&bih=679

    Francois

  8. #8

    Default Re: How to control the Si5351 pls ?

    Francois - I did, and have a really good idea how to control it. I can't actually imaging doing anything anymore without online research.
    However, the calculations require floating point math, which PBP does not support. If I want to go Arduino, I can be done this afternoon. There are lots of examples. In fact, I have an Arduino version running.
    If I want to use PBP, it will be many weeks of coding. So I was hoping somebody had an elegant solution for the calculation already worked out that I could use as an example.

  9. #9
    Join Date
    May 2013
    Location
    australia
    Posts
    1,661

    Default Re: How to control the Si5351 pls ?

    This is more entertaining than Free to Air TV

  10. #10
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    303

    Default Re: How to control the Si5351 pls ?

    I see a lot of Arduino / C code on the web ...
    nothing in PBP ! up to now .
    Still hoping.
    regards

  11. #11
    Join Date
    May 2013
    Location
    australia
    Posts
    1,661

    Default Re: How to control the Si5351 pls ?

    Quote Originally Posted by Charlie View Post
    If I want to use PBP, it will be many weeks of coding. So I was hoping somebody had an elegant solution for the calculation already worked out that I could use as an example.
    if you show us the calculations you are trying to achieve and where the results fall short . along with the code/methods you have tried then perhaps more eyes can offer some suggestions . its not absolutely necessary to be interested in or have any use for the chip to enjoy the coding challenges , this seems to be your best shot here imho.
    I assume some sort of effort has been made by those seeking a handout
    This is more entertaining than Free to Air TV

  12. #12

    Default Re: How to control the Si5351 pls ?

    Quote Originally Posted by richard View Post
    i
    I assume some sort of effort has been made by those seeking a handout
    Nice - I love how we are all polite to each other in the forum.

  13. #13
    Join Date
    May 2013
    Location
    australia
    Posts
    1,661

    Default Re: How to control the Si5351 pls ?

    the fp library can be easily incorported into pbp and did the job admirably for this complex calculation
    overheads were minimised by identifing and precalculating as many constants as possible
    i have not provided the pbp code since the op of linked thread is still working on his own solution
    http://support.melabs.com/forum/picb...erature-sensor
    C representation for clarity of calculation strategy

    Code:
    'const float k[]={-611.715,0.032791,-7.2032e-7,9.9704e-12,-5.6892e-17};//k0 to k4 as constants
    'float adc16=36636.0,tres;                 int res    run tot
    'tres  = k[4]*adc16*adc16*adc16*adc16;//  -102.49    -102.49
    'tres += k[3]*adc16*adc16*adc16;//         490.27     387.78
    'tres += k[2]*adc16*adc16;//              -966.81    -579.03
    'tres += k[1]*adc16;//                    1201.33     622.3
    'tres += k[0];//                          -611.715     10.585
    'result             //                      10.59
    despite the sarcasm if someone provides a formula/method and some figures, who knows i might play along.
    i really can't be bothered reading the data sheet and coming up to speed for a device i won't use ever.
    its your call.

    pic of usual crappy ds version of formula attached
    Attached Images Attached Images   
    Last edited by richard; - 12th December 2018 at 11:52.
    This is more entertaining than Free to Air TV

  14. #14
    Join Date
    May 2013
    Location
    australia
    Posts
    1,661

    Default Re: How to control the Si5351 pls ?

    a module was donated for the cause
    here is a demo for pb3
    pic18 only , you need to get the melabs fp files http://melabs.com/resources/fp.htm
    sda ,sck are set in the include , expects module has 25000000 xtal with 6bit address of 0x60 arla adafruit module
    Attached Files Attached Files
    This is more entertaining than Free to Air TV

  15. #15
    Join Date
    Jan 2008
    Posts
    9

    Default Re: How to control the Si5351 pls ?

    Thank you Richard.
    I have been trying to figure out how to make a 700 kHz transmitter. The goal is to build a micro power AM transmitter that I can plug into an MP3 player and transmit recordings of early radio transmissions.... back in the 1930s... Morse code and old time saxophone big bands and radio mystery and detective shows. The stuff of early radio. And then when we do a group crystal radio build with the scouts we can have them hear something on their crystal radios that we have better control over. Our local radio station reception is garbage. Truly garbage. There are political rants and preachers screaming and sports talk radio with idiots arguing about sports crap nobody needs to hear. I could NOT figure out how to do this project with PicBasic so I resorted to ARDUINO and AD9850 .

    http://www.learnmorsecode.com/AM/AM/index.html

    The bare minimum SKETCH C code here is well documented and only requires changing
    the frequency in the sendFrequency function.

    http://www.learnmorsecode.com/AM/AM/700hz.ino

    Just for giggles... trying to figure out this AD9850 module... I was advised that I could
    call the sendFrequency function in a loop with delays and would create an AM tone without
    adding any more signal RF amplification:

    http://www.learnmorsecode.com/AD9850/Anote.jpg

    Is there any detail DIY-newbie-maker documentation that shows how to use PicBasic PB3 to
    build your pic18 SI5351DEMO.pbp example?
    I am not an electrical engineer. I am only a hobby electronics tinkerer so I'm not real good without a schematic and I would much rather use SI5351 than AD9850 because if we try to make any toys for the scouts then the SI5351 and PIC18xx costs much less than AVR and AD9850.
    Last edited by KB3BYT; - 20th January 2019 at 05:30.

  16. #16
    Join Date
    May 2013
    Location
    australia
    Posts
    1,661

    Default Re: How to control the Si5351 pls ?

    Is there any detail DIY-newbie-maker documentation that shows how to use PicBasic PB3 to
    not really , just create a directory for the project dump both the si5351 files into it with all the fp stuff from melabs
    set chip to pic18f25k22 which should work in any version of pbp3 , press compile

    the resultant hex file will be in the same directory , program it into your chip with a programmer
    i used a pickit2
    crude schematic (hand drawn with mouse ) but its pretty basic
    Name:  si5351sch.jpg
Views: 164
Size:  100.6 KB
    This is more entertaining than Free to Air TV

  17. #17
    Join Date
    Jan 2008
    Posts
    9

    Default Re: How to control the Si5351 pls ?

    Thank you !!!!!!!!!

  18. #18

    Default Re: How to control the Si5351 pls ?

    Hi Richard,
    Thanks for digging into this. In the end, I decided to go a different direction and purchased a Raspberry Pi zero. It's about the same price as a high end PIC, but far more powerful. I wrote the code in a few hours in Python (had to learn Python first, but it's similar to Basic). I simply pass up to 3 target frequencies to the device, and get 3 independent clock sources. Having to set 6 20 bit values wasn't too bad on any platform, but calculating those values from the target frequency was what killed it for me in PBP.
    The cool outcome is that I now have a whole new device to explore - I would never have gone the PI route if I hadn't hit this roadblock. But once I was faced with needing to go to C to stay on PIC for this project, I cast my eyes even further.

  19. #19
    Join Date
    Jan 2008
    Posts
    9

    Default Re: How to control the Si5351 pls ?

    PIC18F25K22 arrived.... hmmmm where were we....


    What do I do to set it for 800kHz output?


    SI5351DEMO.pbp
    '************************************************* ***************
    '* Name : SI5351 DEMO .PBP *
    '* Author : RICHARD *
    '* Notice : Copyright (c) 2019 *
    '* : All Rights Reserved *
    '* Date : 1/17/2019 *
    '* Version : 1.0 *
    '* Notes : PIC18 ONLY, USES FP ROUTINES SDA,SCK SET IN INCLUDE *
    '* : SEE http://melabs.com/resources/fp.htm *
    '************************************************* ***************
    #CONFIG
    CONFIG FOSC = INTIO67
    CONFIG PLLCFG = ON
    CONFIG PRICLKEN = OFF
    CONFIG FCMEN = OFF
    CONFIG IESO = OFF
    CONFIG PWRTEN = OFF
    CONFIG BOREN = SBORDIS
    CONFIG BORV = 190
    CONFIG WDTEN = ON
    CONFIG WDTPS = 32768
    CONFIG CCP2MX = PORTC1
    CONFIG PBADEN = OFF
    CONFIG CCP3MX = PORTB5
    CONFIG HFOFST = ON
    CONFIG T3CMX = PORTC0
    CONFIG P2BMX = PORTB5
    CONFIG MCLRE = EXTMCLR
    CONFIG STVREN = ON
    CONFIG LVP = OFF
    CONFIG XINST = OFF
    CONFIG DEBUG = OFF
    CONFIG CP0 = OFF
    CONFIG CP1 = OFF
    CONFIG CP2 = OFF
    CONFIG CP3 = OFF
    CONFIG CPB = OFF
    CONFIG CPD = OFF
    CONFIG WRT0 = OFF
    CONFIG WRT1 = OFF
    CONFIG WRT2 = OFF
    CONFIG WRT3 = OFF
    CONFIG WRTC = OFF
    CONFIG WRTB = OFF
    CONFIG WRTD = OFF
    CONFIG EBTR0 = OFF
    CONFIG EBTR1 = OFF
    CONFIG EBTR2 = OFF
    CONFIG EBTR3 = OFF
    CONFIG EBTRB = OFF
    #ENDCONFIG



    define OSC 64
    include "fp1832l.bas" ;SEE http://melabs.com/resources/fp.htm
    include "SI5351.bas"

    OSCCON=$70
    OSCTUNE.6=1

    ANSELb = 0
    ANSELA = 0
    ANSELC = 0


    led var LATA.7
    trisa=$0111111
    trisb=$0111111





    DEFINE DEBUG_REG PORTB
    DEFINE DEBUG_BIT 7
    DEFINE DEBUG_BAUD 9600
    DEFINE DEBUG_MODE 0
    latb.7=1 ;DEBUG
    pause 2000
    debug "ready",13,10

    gosub open_SI5351
    SET_PLL 0,18,864,2000 ;set plla to 460800000hz
    SETFREQ 0,4000 ;set clk0 to 4000
    SET_SYNTH 1,0,900,0,1 ;set clk1 to 512000 (460800000/900)
    SET_SYNTH 2,0,900,0,1 ;set clk2 to 512000 (460800000/900)
    oput=2
    DIV=5
    gosub setupRdiv ;NOW set clk2 to 16000HZ (512000/32)
    gosub enableOutputs



    while 1
    led=!led
    pause 1000
    wend

  20. #20
    Join Date
    May 2013
    Location
    australia
    Posts
    1,661

    Default Re: How to control the Si5351 pls ?

    it can be as simple as , if you don't setup plla it will set plla to 900000000hz





    Code:
    gosub open_SI5351
    
    
    SETFREQ 0,800000 ;set clk0 to 800000hz
    
    
    gosub enableOutputs


    if you read through the include file there are plenty of comments to explain the processes

    USERCOMMAND "SET_PLL" ;pll,mult,num,denom // The PLL integer multiplier (must be between 15 and 90) 400 TO 900 MHZ
    USERCOMMAND "SET_SYNTH" ;output,pll,div,num,denom div 8<div>900
    USERCOMMAND "SETFREQ" ;output,freq //USEs ONLY PLLA FOR NOW 2500 < FREQ > 160,000,000 ,FOR LOW FREQ SET PLLA TO 400,000,000
    This is more entertaining than Free to Air TV

  21. #21
    Join Date
    Jan 2008
    Posts
    9

    Default Re: How to control the Si5351 pls ?

    Thank you.
    I will chase that path.

  22. #22
    Join Date
    Jan 2008
    Posts
    9

    Default Re: How to control the Si5351 pls ?

    I do not see a clock crystal with caps or resonator... I'm used to PIC16 stuff..... is the clock internal? what code defines the clock speed?

  23. #23
    Join Date
    May 2013
    Location
    australia
    Posts
    1,661

    Default Re: How to control the Si5351 pls ?

    I'm used to PIC16 stuff.
    advanced core pic16 chips are similarly configured


    the config sets it up for intosc, osscon sets 16mhz clk , osctune.6 sets x4 pll on clk now 16*4=64

    CONFIG PLLCFG = ON also sets pll on but for some chips this has proved troublesome i generally now leave it off and software select pll with osctune.6
    in this instance the config setting will override any software selection, it matters little
    read the datasheet for more info
    This is more entertaining than Free to Air TV

  24. #24
    Join Date
    Jan 2008
    Posts
    9

    Default Re: How to control the Si5351 pls ?

    Thank you for the details.
    I played with 4, 8, and 16 mhz resonators and did not get desired results unless I stuck to 4 mHz resonators
    and was happy at 4mHz for my hobby endeavors.
    and then
    when I wanted to "go small" I learned how to use the internal oscillator in the PIC12F629
    http://www.learnmorsecode.com/mousewheel/index.html
    but I have not pursued any of the advanced features of PIC18 chips even though I've
    had melabs PicBasic since the DOS days and parrallel port EPIC programmer.

Similar Threads

  1. sms to control pic..pls help...
    By Ziki in forum mel PIC BASIC Pro
    Replies: 53
    Last Post: - 12th April 2010, 21:19
  2. Help me pls
    By darylbrown2005 in forum mel PIC BASIC
    Replies: 3
    Last Post: - 7th March 2009, 18:40
  3. Help Me Pls,sampling!!!!!!!
    By hazda in forum mel PIC BASIC
    Replies: 1
    Last Post: - 24th August 2008, 14:11
  4. pls help me
    By london in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th November 2007, 07:02
  5. VERY Urgent. Pls Help ME...
    By weberclas in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 21st December 2004, 23:18

Members who have read this thread : 33

You do not have permission to view the list of names.

Posting Permissions

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