Si5351/Prop/BITX40 ham radio project
in Propeller 1
Hi All,
I'm working on a ham radio project that uses the Si5351 clock chip. The target is the VFO of a BITX40, SSB 5 watt HF transceiver. A quick shout out, any hams who want a ton of fun for $60 go check out the BITX40. Very fun and hackable rig. The radio currently use an Arduino that comes with it, so of course we need to ditch that and get a Prop in charge! So, I got a Si5351 board from QRP labs to play with. I got it up and running with the Si5351 object in the OBEX. But it is way off frequency. I did some fooling around with the Arduino/Si5351 and while it is a little off and needs some correction, once corrected it is spot on. Meaning that the offset is consistent over a wide range of frequencies. Whereas the one I have hooked up to the Prop is WAY off and the offset is NOT consistent over a range of frequencies. For example:
MHz
2 = 2.16
4 = 4.32
8 = 8.64
Or rather, seems consistent as a percentage. Any ideas what could be causing it? Is it possible that it is a coding issue? Or is the Si5351 having issues?
I'm working on a ham radio project that uses the Si5351 clock chip. The target is the VFO of a BITX40, SSB 5 watt HF transceiver. A quick shout out, any hams who want a ton of fun for $60 go check out the BITX40. Very fun and hackable rig. The radio currently use an Arduino that comes with it, so of course we need to ditch that and get a Prop in charge! So, I got a Si5351 board from QRP labs to play with. I got it up and running with the Si5351 object in the OBEX. But it is way off frequency. I did some fooling around with the Arduino/Si5351 and while it is a little off and needs some correction, once corrected it is spot on. Meaning that the offset is consistent over a wide range of frequencies. Whereas the one I have hooked up to the Prop is WAY off and the offset is NOT consistent over a range of frequencies. For example:
MHz
2 = 2.16
4 = 4.32
8 = 8.64
Or rather, seems consistent as a percentage. Any ideas what could be causing it? Is it possible that it is a coding issue? Or is the Si5351 having issues?
Comments
2.16*25/27 = 2
That suggests your maths based on 25MHz, but the board instead uses a 27MHz Xtal ?
Thanks brother! Now I have to go and try to add the needed commands to the driver as I need access to functions not in the OBEX driver. So I'm sure I'll be back with more questions! But at least I can start fooling with it and look forward to have a Prop controlled BITX40.
https://github.com/NT7S/Si5351
could be useful reference ?
Thanks. I have been looking at the library used by the Arduino and the Si data sheet and yikes! Pretty tough for a bottom feeder coder like myself. I'll confess that I am feeling a little daunted after getting off to a good start. I'll see if I can unravel enough of the C to figure out what I need. Which luckily isn't anything fancy, just control over two fo the outputs and setting the output drive level and a couple other things. I'm surprised that there isn't a more complete library for this chip.
Thanks for the help and wish me luck! If I can't get it to run on the Prop alone I can maybe use the Arduino to run the clocks and the prop for everything else. A clumsy two layered solution to be sure.
Jim
Let's start getting the VFO/BFO working. Grab a Si5351 board from QRP labs, or there are others out there. Once we get that working with the BITX, we are off to the races. Sadly I know with my limited programming the Si5351 is going to be a heavy lift for me. Once I get that working, the rest of the menu code etc will be easy.
So yeah, anyone wanting to jump in on a Prop/BITX40 collaboration chime in!
Taking a quick look at the Ardunio code, it does not use floating point, but it does use 32*32->64 and 64/32 -> 32 math operations.
It sparingly uses uint64_t, and calls do_div(uint64_t,uint32_t)
The PropC docs do show uint64_t, uint_least64_t, uint_fast64_t , so a PropC expert may know how to port the 64:32 mixed code.
True, but you can prove the code works on AVR, then port to Prop, and confirm it still works
And while code is code, not all of us are created equal in our ability to create it! I'm more of a hardware guy.
And as to QRO, there are plenty of ways to do that. I get over 50 watts out of a SB-200 driving it with the BITX. You can get more drive than claimed with a higher PA voltage and a good heat sink.
The Si5351 uses fractions in two places, one in the VCO feedback, which will be somewhat averaged, but they can also use fractions in the VCO output divider.
I'm not quite sure how SiLabs get their claimed jitter, give the VCO MHz and output divider fractions, but I have seen mention of locking the post VCO divider to integer only, to improve Jitter.
That does give compromises on Synth Steps, because you now have only one fractional choice, not two.
This is the Data sheet:
3. Jitter is highly dependent on device frequency configuration. Specifications represent a “worst case, real world” frequency plan; actual performance may be substantially better. Three-output 10 MSOP package measured with clock outputs of 74.25, 24.576, and 48 MHz. Period Jitter2,3 JPER 20-QFN, 4 outputs running, 1 per VDDO — 40 95 ps, pkpk 10-MSOP or 20-QFN, all outputs running — 70 155 ps, pkpk Cycle-to-Cycle Jitter2,3 JCC 20-QFN, 4 outputs running, 1 per VDDO — 50 90 ps, pk 10-MSOP or 20-QFN, all outputs running — 70 150 ps, pk Period Jitter VCXO2,3 JPER_VCXO 20-QFN, 4 outputs running, 1 per VDDO — 50 95 ps, pkpk 10-MSOP or 20-QFN, all outputs running — 70 155 ps, pkpk Cycle-to-Cycle Jitter VCXO2,3 JCC_VCXO 20-QFN, 4 outputs running, 1 per VDDO — 50 90 ps, pk 10-MSOP or 20-QFN, all outputs running — 70 150 ps, pk
and this is how ClockBuilder creates 74.25, 24.576, and 48 MHz.PLL_A: Enabled Features = None Fvco = 768 MHz M = 30.72 [ 30 + 18/25 ] Output0: R = 1 (2^0) Fout = 74.25 MHz [ 74 + 1/4 MHz ] N = 10.3434343434343434... [ 10 + 34/99 ] Output1: R = 1 (2^0) Fout = 24.576 MHz [ 24 + 72/125 MHz ] N = 31.25 [ 31 + 1/4 ] Output2: R = 1 (2^0) Fout = 48 MHz N = 16
In two cases, N is fractional.The current BITX VFO tunes in 100Hz increments. This is fine but I wouldn't mind 10Hz increments. The low end would be 3.5MHz, so we don't run into the issues of the lower end of the Si5351 where some tricks need to be pulled. The high end would be 14.35MHz.
The BFO is less particular, for LSB it is set to ~ 12MHz and USB I think it is ~ 19MHz.
Yes, but there is some 64/32 code, that I think Spin has no native support for, so that would need some PASM support in a 'maths cog'.
Then, there is a question of how slow Spin will be, as some of the code scans, looking for a 'best result' fit.
Yes, but there is some 64/32 code, that I think Spin has no native support for, so that would need some PASM support in a 'maths cog'.
Then, there is a question of how slow Spin will be, as some of the code scans, looking for a 'best result' fit.
{ ┌──────────────────────────────────────────────────────────┐ │ 32- and 64-bit unsigned math routines in Spin. │ │(c) Copyright 2008 Philip C. Pilgrim (propeller@phipi.com)│ │ See end of file for terms of use. │ └──────────────────────────────────────────────────────────┘ This Propeller object provides the following unsigned integer math functions: div: Divides a 64-bit integer by a 32-bit integer to yield a 32-bit quotient. multdiv: Multiplies a 32-bit integer by the rational fraction formed by the ratio of two 32-bit numbers. unsigned comparisons: <, =<, =>, and > } CON UGT = %100 EQ = %010 ULT = %001 VAR long producth, productl PUB multdiv(x, num, denom) '' Multiply x by num, forming a 64-bit unsigned product. '' Divide this by denom, returning the result. '' x ** num must be less than (unsigned) denom. mult(x, num) return div(producth, productl, denom) PUB div(dvndh, dvndl, dvsr) | carry, quotient '' Divide the 64-bit dividend, dvdnh:dvndl by the 32-bit divisor, dvsr, '' returning a 32-bit quotient. Returns 0 on overflow. quotient~ if (ge(dvndh, dvsr)) return 0 repeat 32 carry := dvndh < 0 dvndh := (dvndh << 1) + (dvndl >> 31) dvndl <<= 1 quotient <<= 1 if (ge(dvndh, dvsr) or carry) quotient++ dvndh -= dvsr return quotient PUB gt(x,y) '' Return true if x > y unsigned. return cpr(x,y) & UGT <> 0 PUB ge(x,y) '' Return true if x => y unsigned. return cpr(x,y) & constant(UGT | EQ) <> 0 PUB le(x,y) '' Return true if x =< y unsigned. return cpr(x,y) & constant(ULT | EQ) <> 0 PUB lt(x,y) '' Return true if x < y unsigned. return cpr(x,y) & ULT <> 0 PRI mult(mplr, mpld) | umplr, umpld producth := (mplr & $7fff_ffff) ** (mpld & $7fff_ffff) productl := (mplr & $7fff_ffff) * (mpld & $7fff_ffff) if (mplr < 0) dadd(producth, productl, mpld >> 1, mpld << 31) if (mpld < 0) dadd(producth, productl, mplr << 1 >> 2, mplr << 31) PRI dadd(addh, addl, augh, augl) producth := addh + augh productl := addl + augl if (lt(productl, addl)) producth++ PRI cpr(x, y) if (x == y) return EQ elseif (x ^ $8000_0000 > y ^ $8000_0000) return UGT else return ULT {{ ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TERMS OF USE: MIT License │ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation │ │files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, │ │modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software│ │is furnished to do so, subject to the following conditions: │ │ │ │The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.│ │ │ │THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE │ │WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR │ │COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, │ │ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ }
-Phil
http://forums.parallax.com/discussion/163409/silabs-si5351-clock-generator-spin-driver
seeing what can be done on the 2m band (although I'm a long lapsed amateur (G1XMO), I recently
bought a spectrum analyser, which has rekindled an RF interest.
I might start playing with the dirt cheap AD9833 modules (10 bit DDS upto about 10MHz) and direct quadrature
SSB with a pair of them.
[ No problem with frequency resolution with DDS
Mark, if you do play with the AD9833 keep me informed! Sounds like a fun project! Renew yer ticket too!