Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Production Test Suite
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Production Test Suite
Commits
ef162322
Commit
ef162322
authored
Jun 22, 2011
by
Samuel Iglesias Gonsalvez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tps/test/spec: added setup of the oscillator si570
parent
fcb0d321
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
test06.py
test/spec/python/test06.py
+38
-0
No files found.
test/spec/python/test06.py
View file @
ef162322
...
...
@@ -136,6 +136,10 @@ class CSI570 :
return
self
.
i2c
.
read
(
True
);
def
setup_oscillator
(
self
,
hs_div
,
n1_div
,
rfreq
)
:
# Freeze the oscillator to setup it
self
.
wr_reg8
(
self
.
FREEZE_DCO
,
(
1
<<
4
));
val
=
((
hs_div
&
0x7
)
<<
5
)
|
(
n1_div
>>
2
)
self
.
wr_reg8
(
self
.
HS_N1_DIV
,
val
);
...
...
@@ -154,6 +158,40 @@ class CSI570 :
val
=
rfreq
&
0xFF
;
self
.
wr_reg8
(
self
.
REF_FREQ_7_0
,
val
);
# Unfreeze it
self
.
wr_reg8
(
self
.
FREEZE_DCO
,
0
);
self
.
wr_reg8
(
self
.
RST_MEM_CTRL
,
(
1
<<
6
));
time
.
sleep
(
0.010
)
self
.
wr_reg8
(
self
.
RST_MEM_CTRL
,
0
);
def
setup_frequency
(
self
,
freq
)
:
finish
=
0
;
for
N1
in
range
(
0
,
65
)
:
if
N1
==
0
:
n1
=
1
;
else
:
n1
=
N1
*
2
;
for
HSDIV
in
[
4
,
5
,
6
,
7
,
9
,
11
]
:
x
=
HSDIV
*
n1
;
if
(
x
<
5670
)
and
(
x
>
4850
)
:
finish
=
1
;
freq_dco
=
x
;
break
;
if
finish
:
break
;
if
(
not
finish
):
raise
TpsError
(
'SI570: Not found a proper setup'
)
tmp
=
freq_dco
/
114.285
;
rfreq
=
int
((
tmp
*
2
**
28
));
rfreq
=
hex
(
rfreq
);
self
.
setup_oscillator
(
HSDIV
,
n1
,
rfreq
);
def
reset
(
self
)
:
val
=
(
1
<<
7
);
self
.
wr_reg8
(
self
.
RST_MEM_CTRL
,
val
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment