Skip to content

Commit

Permalink
Release 1.032 update
Browse files Browse the repository at this point in the history
  • Loading branch information
robseb committed Jun 22, 2020
1 parent f2dd972 commit d08d9ca
Show file tree
Hide file tree
Showing 68 changed files with 1,155 additions and 119,736 deletions.
37 changes: 27 additions & 10 deletions examples/python/SevenSigCounter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
rstools shell command
@date: 18.09.2019
@device: Intel Cyclone V
@device: Intel Cyclone V & Intel Arria 10 SX
@author: Robin Sebastian
(https://github.com/robseb)
'''
Expand All @@ -15,28 +15,45 @@
import time
import sys

# Selected maximum countable value for the SevenSig Display
SEVENSIG_MAX_VALUE = [2000,0,254]

if __name__ == '__main__':
print('Counting a number on the Seven Segment Display on the DE10-Standard with a shell command!\n')
print('Counting a number on the Seven Segment Display with a Linux shell command!\n')

# Check that the running board is a Terasic DE10-Standard
de10StDetected = False
# Check that the running board is a Terasic DE10-Standard- or Han Pilot Development Board
# Used development board
devboard = 1 # 0: DE10 Standard | 1: DE10 Nano | 2: Han Pilot

# The Board name for the image is located here: "/usr/rsyocto/suppBoard.txt"
if os.path.isfile("/usr/rsyocto/suppBoard.txt"):
supportStr = ""
with open("/usr/rsyocto/suppBoard.txt", "r") as f:
supportStr = f.read()
if not supportStr.find('Terasic DE10 Standard') ==-1 :
de10StDetected = True
devboard = 0
elif not supportStr.find('Terasic HAN Pilot') ==-1 :
devboard = 2

if not de10StDetected :
print("Error: This script only works with a Terasic DE10 Standard Board!")
if devboard==1:
print("Error: This script only works with a Terasic DE10 Standard- or Han Pilot Board!")
sys.exit()

# Count the Seven Segment Display with a rstools shell command
for count in range(120):
os.system('FPGA-writeBridge -lw 38 -h '+ str(count) +' -b')
for count in range(SEVENSIG_MAX_VALUE[devboard]):
print('Sample: '+str(count)+'/'+str(SEVENSIG_MAX_VALUE[devboard]))

if(devboard==2):
os.system('FPGA-writeBridge -lw 8 -h '+ str(count) +' -b')
else: # DE10 Standard Board
os.system('FPGA-writeBridge -lw 38 -h '+ str(count) +' -b')

# Delate last console line
sys.stdout.write("\033[F")
# Reset the Display value
os.system('FPGA-writeBridge -lw 38 0 -b')
if(devboard==2):
os.system('FPGA-writeBridge -lw 8 0 -b')
else:# DE10 Standard Board
os.system('FPGA-writeBridge -lw 38 0 -b')

print('End...')
43 changes: 31 additions & 12 deletions examples/python/adcTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
@disc: ADC readout Sensor Test (Analog Devices LTC2308)
Fast way over the virtual memory
@date: 21.01.2020
@date: 22.06.2020
@device: Intel Cyclone V
@author: Robin Sebastian
(https://github.com/robseb)
(git@robseb.de)
'''
import os
import time
Expand All @@ -21,9 +22,9 @@
import devmem

# Demo duration
TEST_DURATIONS =30
TEST_DURATIONS =100

# the Lightweight HPS-to-FPGA Bus base address offset
# The Lightweight HPS-to-FPGA Bus base address offset
HPS_LW_ADRS_OFFSET = 0xFF200000

# LTC2308 Address offset
Expand All @@ -41,11 +42,20 @@
### FIFO Convention Data Size for average calculation
FIFO_SIZE = 255 # MAX=1024

VALUE_OR_VOLTAGE_OUTPUT = 0 # 1: Raw Value output | 0: Volage

if __name__ == '__main__':
print("ADC readout Demo for LTC2308 ADC with Channel "+str(ADC_CH))

# Read the name of the used development board
#-> Only the Terasic DE10 Standard and Nano Boards are allowed!
# The Board name for the image is located here: "/usr/rsyocto/suppBoard.txt"
if os.path.isfile("/usr/rsyocto/suppBoard.txt"):
supportStr = ""
with open("/usr/rsyocto/suppBoard.txt", "r") as f:
supportStr = f.read()
if not supportStr.find('Terasic HAN Pilot') ==-1 :
print('The Terasic HAN Pilot Board has no LTC2308 and is not supported!')
sys.exit()

# The ADC is only supported with rsYocto Version 1.031 or later
versionNo = 0
# The rsYocto Version Number is located here: "/usr/rsyocto/version.txt"
Expand All @@ -68,9 +78,13 @@
# (Base address, byte length to acceses, interface)
de = devmem.DevMem(HPS_LW_ADRS_OFFSET, ADC_ADDRES_OFFSET+0x8, "/dev/mem")

print('Reading the current ADC value ...')

# Enter test loop
for var in range(TEST_DURATIONS):

print('Sample: '+str(var)+'/'+str(TEST_DURATIONS))

# Set meassure number for ADC convert
de.write(ADC_ADDRES_OFFSET+ADC_DATA_REG_OFFSET,[FIFO_SIZE])
# Enable the convention with CH0
Expand All @@ -95,14 +109,19 @@

value = rawValue / FIFO_SIZE

if VALUE_OR_VOLTAGE_OUTPUT:
value = round(value,2)
print("ADC AVG: "+str(value))
else:
# Convert ADC Value to Volage
volage = round(value/1000,2)
print("U AVG: "+str(volage)+"V")
value = round(value,2)
print("-> ADC AVG: "+str(value))

# Convert ADC Value to Volage
volage = round(value/1000,2)
print("-> U AVG: "+str(volage)+"V")

time.sleep(.2) # 200ms delay

if var != TEST_DURATIONS-1:
# Delate last 3 console line
sys.stdout.write("\033[F")
sys.stdout.write("\033[F")
sys.stdout.write("\033[F")

print('End of demo...')
38 changes: 31 additions & 7 deletions examples/python/blinkLed.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,48 @@
'''
@disc: Toggling the HPS LED Demo
@device: Intel Cyclone V
@date: 23.09.2019
@device: Intel Cyclone V & Intel Arria 10 SX
@date: 22.06.2020
@author: Robin Sebastian
(https://github.com/robseb)
(git@robseb.de)
'''
import os
import time
import sys

# Demo duration
TEST_DURATIONS = 20


PATH_OF_HPS_LED_DRIVER = '/sys/class/leds/hps_led0/brightness'

if __name__ == '__main__':
print('Hello from a Python Application running on a SoC-FPGA !\n')
print('Toggling HPS LED Example')
# Repeat 20 times
for var in range(20):
print("turn: ",var)

# Read the name of the used development board
# The Board name for the image is located here: "/usr/rsyocto/suppBoard.txt"
if os.path.isfile("/usr/rsyocto/suppBoard.txt"):
supportStr = ""
with open("/usr/rsyocto/suppBoard.txt", "r") as f:
supportStr = f.read()
print('Your dev board: '+supportStr)

for var in range(TEST_DURATIONS):
print('Sample: '+str(var)+'/'+str(TEST_DURATIONS))

# Turn the HPS LED 0 ON
os.system("echo 100 > /sys/class/leds/hps_led0/brightness")
os.system("echo 100 > "+PATH_OF_HPS_LED_DRIVER)
time.sleep(.200)

# Turn the HPS LED 0 OFF
os.system("echo 0 > /sys/class/leds/hps_led0/brightness")
os.system("echo 0 > "+PATH_OF_HPS_LED_DRIVER)
time.sleep(.500)

# Delate last console line
sys.stdout.write("\033[F")

# Turn the HPS LED 0 OFF
os.system("echo 0 > /sys/class/leds/hps_led0/brightness")
print('End of demo...')
23 changes: 19 additions & 4 deletions examples/python/blinkingFPGAled.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,40 @@
@disc: Toggling a FPGA LED with a rstools Linux
Shell command
@date: 21.10.2019
@date: 22.06.2020
@device: Intel Cyclone V
@author: Robin Sebastian
(https://github.com/robseb)
(git@robseb.de)
'''
import os
import time
import sys

# Demo duration
TEST_DURATIONS = 20

if __name__ == '__main__':
print('Toggling the FPGA LED[7] with a Shell command\n')
print('Toggling the FPGA LED[7] with a Linux Shell command')
# Turn all FPGA LEDs Off
os.system("FPGA-writeBridge -lw 20 0 -b")
for var in range(20):
print("turn: ",var)
for var in range(TEST_DURATIONS):
print('Sample: '+str(var)+'/'+str(TEST_DURATIONS))

# Turn the FPGA LED 7 ON
os.system("FPGA-writeBridge -lw 20 -b 7 1 -b")
# Wait for 50ms
time.sleep(.50)

# Turn the FPGA LED 7 ON
os.system("FPGA-writeBridge -lw 20 -b 7 0 -b")
# Wait for 50ms
time.sleep(.50)

# Delate last console line
sys.stdout.write("\033[F")

# Turn all FPGA LEDs Off
os.system("FPGA-writeBridge -lw 20 0 -b")

print('End of demo...')
Loading

0 comments on commit d08d9ca

Please sign in to comment.