Skip to content

Commit cd07cc5

Browse files
committed
Initial commit - very WIP
0 parents  commit cd07cc5

File tree

12 files changed

+1249
-0
lines changed

12 files changed

+1249
-0
lines changed

.gitignore

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
#################
2+
## SparkFun Useful stuff
3+
#################
4+
5+
## AVR Development
6+
*.eep
7+
*.elf
8+
*.lst
9+
*.lss
10+
*.sym
11+
*.d
12+
*.o
13+
*.srec
14+
*.map
15+
16+
## Notepad++ backup files
17+
*.bak
18+
19+
## BOM files
20+
*bom*
21+
22+
## VSCode directories
23+
.vscode
24+
25+
#################
26+
## Eclipse
27+
#################
28+
29+
*.pydevproject
30+
.project
31+
.metadata
32+
bin/
33+
tmp/
34+
*.tmp
35+
*.bak
36+
*.swp
37+
*~.nib
38+
local.properties
39+
.classpath
40+
.settings/
41+
.loadpath
42+
43+
# External tool builders
44+
.externalToolBuilders/
45+
46+
# Locally stored "Eclipse launch configurations"
47+
*.launch
48+
49+
# CDT-specific
50+
.cproject
51+
52+
# PDT-specific
53+
.buildpath
54+
55+
56+
#############
57+
## Eagle
58+
#############
59+
60+
# Ignore the board and schematic backup files and lock files
61+
*.b#?
62+
*.s#?
63+
*.l#?
64+
*.lck
65+
66+
67+
#############
68+
## KiCad
69+
#############
70+
71+
*cache.lib
72+
*.kicad_pcb-bak
73+
*.net
74+
*.gbr
75+
*.drl
76+
77+
78+
#################
79+
## Visual Studio
80+
#################
81+
82+
## Ignore Visual Studio temporary files, build results, and
83+
## files generated by popular Visual Studio add-ons.
84+
85+
# User-specific files
86+
*.suo
87+
*.user
88+
*.sln.docstates
89+
90+
# Build results
91+
[Dd]ebug/
92+
[Rr]elease/
93+
*_i.c
94+
*_p.c
95+
*.ilk
96+
*.meta
97+
*.obj
98+
*.pch
99+
*.pdb
100+
*.pgc
101+
*.pgd
102+
*.rsp
103+
*.sbr
104+
*.tlb
105+
*.tli
106+
*.tlh
107+
*.tmp
108+
*.vspscc
109+
.builds
110+
*.dotCover
111+
112+
## TODO: If you have NuGet Package Restore enabled, uncomment this
113+
#packages/
114+
115+
# Visual C++ cache files
116+
ipch/
117+
*.aps
118+
*.ncb
119+
*.opensdf
120+
*.sdf
121+
122+
# Visual Studio profiler
123+
*.psess
124+
*.vsp
125+
126+
# ReSharper is a .NET coding add-in
127+
_ReSharper*
128+
129+
# Installshield output folder
130+
[Ee]xpress
131+
132+
# DocProject is a documentation generator add-in
133+
DocProject/buildhelp/
134+
DocProject/Help/*.HxT
135+
DocProject/Help/*.HxC
136+
DocProject/Help/*.hhc
137+
DocProject/Help/*.hhk
138+
DocProject/Help/*.hhp
139+
DocProject/Help/Html2
140+
DocProject/Help/html
141+
142+
# Click-Once directory
143+
publish
144+
145+
# Others
146+
[Bb]in
147+
[Oo]bj
148+
sql
149+
TestResults
150+
*.Cache
151+
ClientBin
152+
stylecop.*
153+
~$*
154+
*.dbmdl
155+
Generated_Code #added for RIA/Silverlight projects
156+
157+
# Backup & report files from converting an old project file to a newer
158+
# Visual Studio version. Backup files are not needed, because we have git ;-)
159+
_UpgradeReport_Files/
160+
Backup*/
161+
UpgradeLog*.XML
162+
163+
164+
############
165+
## Windows
166+
############
167+
168+
# Windows image file caches
169+
Thumbs.db
170+
171+
# Folder config file
172+
Desktop.ini
173+
174+
175+
#############
176+
## Mac OS
177+
#############
178+
179+
.DS_Store
180+
181+
182+
#############
183+
## Linux
184+
#############
185+
186+
# backup files (*.bak on Win)
187+
*~
188+
189+
190+
#############
191+
## Python
192+
#############
193+
194+
*.py[co]
195+
196+
# Packages
197+
*.egg
198+
*.egg-info
199+
dist
200+
build
201+
eggs
202+
parts
203+
bin
204+
var
205+
sdist
206+
develop-eggs
207+
.installed.cfg
208+
209+
# Installer logs
210+
pip-log.txt
211+
212+
# Unit test / coverage reports
213+
.coverage
214+
.tox
215+
216+
#Translations
217+
*.mo
218+
219+
#Mr Developer
220+
.mr.developer.cfg

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 SparkFun Electronics
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
SparkFun STP3593LF OCXO Arduino Library
2+
========================================
3+
4+
<table class="table table-hover table-striped table-bordered">
5+
<tr align="center">
6+
<td><a href="https://www.sparkfun.com/products/26289"><img src="" alt="Standard"></a></td>
7+
</tr>
8+
<tr align="center">
9+
<td><a href="https://www.sparkfun.com/products/26289">SparkFun GNSSDO</a></td>
10+
</tr>
11+
</table>
12+
13+
This is an Arduino Library for the STP3593LF (ROX5242T1N) Digitally-Controlled Double-Oven Crystal Oscillator from rakon.
14+
It allows you to fully configure the oscillator over I<sup>2</sup>C.
15+
Examples are provided which show how to control the frequency.
16+
17+
Note: this library needs the [SparkFun Toolkit](https://github.com/sparkfun/SparkFun_Toolkit).
18+
19+
Repository Contents
20+
-------------------
21+
22+
* **/.github/workflows** - GitHub workflow actions files
23+
* **/examples** - Arduino examples for the STP3593LF
24+
* **/src** - Library source files (.cpp & .h)
25+
26+
License Information
27+
-------------------
28+
29+
This product is _**open source**_!
30+
31+
Please review the LICENSE.md file for license information.
32+
33+
If you have any questions or concerns on licensing, please contact technical support on our [SparkFun forums](https://community.sparkfun.com/).
34+
35+
Distributed as-is; no warranty is given.
36+
37+
- Your friends at SparkFun.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
Using alternate I2C addresses for the STP3593LF OCXO.
3+
4+
This example shows how to use an alternate address and TwoWire port for the OCXO.
5+
6+
By: Paul Clark
7+
SparkFun Electronics
8+
Date: 2024/11/21
9+
SparkFun code, firmware, and software is released under the MIT License.
10+
Please see LICENSE.md for further details.
11+
12+
*/
13+
14+
// You will need the SparkFun Toolkit. Click here to get it: http://librarymanager/All#SparkFun_Toolkit
15+
16+
#include <SparkFun_STP3593LF.h> // Click here to get the library: http://librarymanager/All#SparkFun_STP3593LF
17+
18+
SfeSTP3593LFArdI2C myOCXO;
19+
20+
void setup()
21+
{
22+
delay(1000); // Allow time for the microcontroller to start up
23+
24+
Serial.begin(115200); // Begin the Serial console
25+
while (!Serial)
26+
{
27+
delay(100); // Wait for the user to open the Serial Monitor
28+
}
29+
Serial.println("SparkFun STP3593LF Example");
30+
31+
Wire.begin(); // Begin the I2C bus
32+
33+
bool begun;
34+
begun = myOCXO.begin(Wire, 0x50); // Initialize the STP3593LF - using a custom bus and address
35+
begun = myOCXO.begin(0x50); // This is also possible. It defaults to Wire
36+
begun = myOCXO.begin(); // This is also possible. It defaults to Wire and address 0x50
37+
38+
if (!begun)
39+
{
40+
Serial.println("STP3593LF not detected! Please check the address and try again...");
41+
while (1); // Do nothing more
42+
}
43+
44+
// Read the frequency control word - should be zero initially
45+
int64_t fcw = myOCXO.getFrequencyControlWord();
46+
Serial.print("The frequency control word is: ");
47+
Serial.println(fcw);
48+
49+
// Read the available (clipped) pull range
50+
double pullAvailable = myOCXO.getMaxPullAvailable();
51+
Serial.printf("Maximum frequency pull is: %e\r\n", pullAvailable);
52+
}
53+
54+
void loop()
55+
{
56+
// Nothing to do here
57+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
Set the frequency of the STP3593LF OCXO.
3+
4+
By: Paul Clark
5+
SparkFun Electronics
6+
Date: 2024/11/21
7+
SparkFun code, firmware, and software is released under the MIT License.
8+
Please see LICENSE.md for further details.
9+
10+
*/
11+
12+
// You will need the SparkFun Toolkit. Click here to get it: http://librarymanager/All#SparkFun_Toolkit
13+
14+
#include <SparkFun_STP3593LF.h> // Click here to get the library: http://librarymanager/All#SparkFun_STP3593LF
15+
16+
SfeSTP3593LFArdI2C myOCXO;
17+
18+
void setup()
19+
{
20+
delay(1000); // Allow time for the microcontroller to start up
21+
22+
Serial.begin(115200); // Begin the Serial console
23+
while (!Serial)
24+
{
25+
delay(100); // Wait for the user to open the Serial Monitor
26+
}
27+
Serial.println("SparkFun STP3593LF Example");
28+
29+
Wire.begin(); // Begin the I2C bus
30+
31+
if (!myOCXO.begin())
32+
{
33+
Serial.println("STP3593LF not detected! Please check the address and try again...");
34+
while (1); // Do nothing more
35+
}
36+
37+
myOCXO.setBaseFrequencyHz(10000000.0); // Pass the oscillator base frequency into the driver
38+
39+
Serial.print("Base frequency set to ");
40+
Serial.print(myOCXO.getBaseFrequencyHz());
41+
Serial.println(" Hz");
42+
43+
myOCXO.setFrequencyHz(10000010.0); // Set the frequency to 10.000010MHz (+1ppm)
44+
45+
Serial.print("Frequency set to ");
46+
Serial.print(myOCXO.getFrequencyHz());
47+
Serial.println(" Hz");
48+
49+
// Frequency control word should be 1ppm / 800ppm * (2^38 - 1) , rounded down
50+
Serial.print("Frequency control word should be 343597383. It is ");
51+
Serial.println(myOCXO.getFrequencyControlWord());
52+
}
53+
54+
void loop()
55+
{
56+
// Nothing to do here
57+
}

0 commit comments

Comments
 (0)