Skip to content

Commit

Permalink
adding some control flow for programming to enable a pause and standa…
Browse files Browse the repository at this point in the history
…rdize pre/post-amble. Enabling all pages to be dumped to rogue application
  • Loading branch information
awhitbeck committed Nov 22, 2024
1 parent 45f0350 commit 409677c
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 20 deletions.
48 changes: 31 additions & 17 deletions python/surf/devices/silabs/_Si5345Lite.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import csv
import click
import fnmatch
import time

class Si5345Lite(pr.Device):
def __init__(self,
Expand Down Expand Up @@ -50,8 +51,15 @@ def LoadCsvFile(arg):
return

# Power down during the configuration load
self.Page0.PDN.set(0x1)

#self.Page0.PDN.set(0x1)

#preamble
self._setValue(0x0B24<<2,0xC0)
self._setValue(0x0B25<<2,0x0)
self._setValue(0x0540<<2,0x1)
time.sleep(0.3)
self._setValue(0x001C<<2,0x1)

# Open the .CSV file
with open(path) as csvfile:
reader = csv.reader(csvfile, delimiter=',', quoting=csv.QUOTE_NONE)
Expand All @@ -62,18 +70,24 @@ def LoadCsvFile(arg):
offset = (int(row[0],16)<<2),
data = int(row[1],16),
)

# Update local RemoteVariables and verify conflagration
self.readBlocks(recurse=True)
self.checkBlocks(recurse=True)

# Execute the Page5.BW_UPDATE_PLL command
self.Page5.BW_UPDATE_PLL.set(0x1)
self.Page5.BW_UPDATE_PLL.set(0x0)
#self.Page5.BW_UPDATE_PLL.set(0x1)
#self.Page5.BW_UPDATE_PLL.set(0x0)


# Power Up after the configuration load
self.Page0.PDN.set(0x0)

#self.Page0.PDN.set(0x0)

self._setValue(0x0514<<2,0x1)
self._setValue(0x001C<<2,0x1)
self._setValue(0x0540<<2,0x0)
self._setValue(0x0B24<<2,0xC3)
self._setValue(0x0B25<<2,0x2)

# Clear the internal error flags
self.Page0.ClearIntErrFlag.set(0x1)
self.Page0.ClearIntErrFlag.set(0x0)
Expand All @@ -83,17 +97,17 @@ def LoadCsvFile(arg):
##############################
self._pages = {
0: silabs.Si5345Page0(offset=(0x000<<2),simpleDisplay=simpleDisplay,expand=False), # 0x0000 - 0x03FF
1: silabs.Si5345PageBase(name='Page1',offset=(0x100<<2),expand=False,hidden=not (advanceUser)), # 0x0400 - 0x07FF
2: silabs.Si5345PageBase(name='Page2',offset=(0x200<<2),expand=False,hidden=not (advanceUser)), # 0x0800 - 0x0BFF
3: silabs.Si5345PageBase(name='Page3',offset=(0x300<<2),expand=False,hidden=not (advanceUser)), # 0x0C00 - 0x0FFF
4: silabs.Si5345PageBase(name='Page4',offset=(0x400<<2),expand=False,hidden=not (advanceUser)), # 0x1000 - 0x13FF
1: silabs.Si5345PageBase(name='Page1',offset=(0x100<<2),expand=False,hidden=False), # 0x0400 - 0x07FF
2: silabs.Si5345Page2(offset=(0x200<<2),simpleDisplay=simpleDisplay,expand=False), # 0x0800 - 0x0BFF
3: silabs.Si5345PageBase(name='Page3',offset=(0x300<<2),expand=False,hidden=False), # 0x0C00 - 0x0FFF
4: silabs.Si5345PageBase(name='Page4',offset=(0x400<<2),expand=False,hidden=False), # 0x1000 - 0x13FF
5: silabs.Si5345Page5(offset=(0x500<<2),simpleDisplay=simpleDisplay,expand=False), # 0x1400 - 0x17FF
6: silabs.Si5345PageBase(name='Page6',offset=(0x600<<2),expand=False,hidden=not (advanceUser)), # 0x1800 - 0x1BFF
7: silabs.Si5345PageBase(name='Page7',offset=(0x700<<2),expand=False,hidden=not (advanceUser)), # 0x1C00 - 0x1FFF
8: silabs.Si5345PageBase(name='Page8',offset=(0x800<<2),expand=False,hidden=not (advanceUser)), # 0x2000 - 0x23FF
9: silabs.Si5345PageBase(name='Page9',offset=(0x900<<2),expand=False,hidden=not (advanceUser)), # 0x2400 - 0x27FF
10: silabs.Si5345PageBase(name='PageA',offset=(0xA00<<2),expand=False,hidden=not (advanceUser)), # 0x2800 - 0x2BFF
11: silabs.Si5345PageBase(name='PageB',offset=(0xB00<<2),expand=False,hidden=not (advanceUser)), # 0x2C00 - 0x2FFF
6: silabs.Si5345PageBase(name='Page6',offset=(0x600<<2),expand=False,hidden=False), # 0x1800 - 0x1BFF
7: silabs.Si5345PageBase(name='Page7',offset=(0x700<<2),expand=False,hidden=False), # 0x1C00 - 0x1FFF
8: silabs.Si5345PageBase(name='Page8',offset=(0x800<<2),expand=False,hidden=False), # 0x2000 - 0x23FF
9: silabs.Si5345PageBase(name='Page9',offset=(0x900<<2),expand=False,hidden=False), # 0x2400 - 0x27FF
10: silabs.Si5345PageBase(name='PageA',offset=(0xA00<<2),expand=False,hidden=False), # 0x2800 - 0x2BFF
11: silabs.Si5345PageBase(name='PageB',offset=(0xB00<<2),expand=False,hidden=False), # 0x2C00 - 0x2FFF
}

# Add Pages
Expand Down
95 changes: 92 additions & 3 deletions python/surf/devices/silabs/_Si5345Pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self,
bulkOpEn = False, # FALSE for large variables
overlapEn = False,
verify = False, # FALSE due to a mix of RO/WO/RW variables
hidden = True,
hidden = False,
base = pr.UInt,
mode = "RW",
groups = ['NoStream','NoState','NoConfig'], # Not saving config/state to YAML
Expand Down Expand Up @@ -432,7 +432,7 @@ def __init__(self,
bitSize = 1,
bitOffset = 0,
mode = 'WO',
hidden = simpleDisplay,
#hidden = simpleDisplay,
)

self.MyLinkVariable(
Expand All @@ -442,7 +442,7 @@ def __init__(self,
bitSize = 1,
bitOffset = 2,
mode = 'WO',
hidden = simpleDisplay,
#hidden = simpleDisplay,
)

self.MyLinkVariable(
Expand Down Expand Up @@ -1063,6 +1063,95 @@ def __init__(self,
)


class Si5345Page2(Si5345PageBase):
def __init__(self,
name = "Page2",
description = "",
simpleDisplay = True,
liteVersion = True,
**kwargs):
super().__init__(name=name, description=description, **kwargs)

self.MyLinkVariable(
name = "DESIGN_ID[0]",
description = "",
offset = (0x6B << 2),
bitSize = 64,
bitOffset = 0,
mode = 'RW',
hidden = False,
)

self.MyLinkVariable(
name = "DESIGN_ID[1]",
description = "",
offset = (0x6C << 2),
bitSize = 8,
bitOffset = 0,
mode = 'RW',
hidden = False,
)

self.MyLinkVariable(
name = "DESIGN_ID[2]",
description = "",
offset = (0x6D << 2),
bitSize = 8,
bitOffset = 0,
mode = 'RW',
hidden = False,
)

self.MyLinkVariable(
name = "DESIGN_ID[3]",
description = "",
offset = (0x6E << 2),
bitSize = 64,
bitOffset = 0,
mode = 'RW',
hidden = False,
)

self.MyLinkVariable(
name = "DESIGN_ID[4]",
description = "",
offset = (0x6F << 2),
bitSize = 8,
bitOffset = 0,
mode = 'RW',
hidden = False,
)

self.MyLinkVariable(
name = "DESIGN_ID[5]",
description = "",
offset = (0x70 << 2),
bitSize = 8,
bitOffset = 0,
mode = 'RW',
hidden = False,
)
self.MyLinkVariable(
name = "DESIGN_ID[6]",
description = "",
offset = (0x71 << 2),
bitSize = 8,
bitOffset = 0,
mode = 'RW',
hidden = False,
)

self.MyLinkVariable(
name = "DESIGN_ID[7]",
description = "",
offset = (0x72 << 2),
bitSize = 8,
bitOffset = 0,
mode = 'RW',
hidden = False,
)


class Si5345Page5(Si5345PageBase):
def __init__(self,
name = "Page5",
Expand Down

0 comments on commit 409677c

Please sign in to comment.