OpenCores
URL https://opencores.org/ocsvn/uart_fpga_slow_control_migrated/uart_fpga_slow_control_migrated/trunk

Subversion Repositories uart_fpga_slow_control_migrated

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /uart_fpga_slow_control
    from Rev 27 to Rev 28
    Reverse comparison

Rev 27 → Rev 28

/trunk/software/rtd_uart_test.bat
0,0 → 1,17
rem Batch file for Windows XP. Windows XP has to use START to launch programs, waits for programs to quit, unlike earlier
echo on
set rt=..\RealTerm\realterm.exe
 
rem send the following bin file
set bf=e:\Nikhef\MyOpenCores\uart_fpga_slow_control\trunk\documents\Hex_commands.bin
rem NOTE: works only with absolute paths...
 
start %rt% caption=UART_fpga half=1 rows=27 display=2 baud=921600 port=10
 
rem pause Press any key to load PRBS config file
 
rem start %rt% sendfile=%bf%
 
pause Press any key to close Realterm
 
start %rt% first display=5
/trunk/software/py_serial_control.py
0,0 → 1,82
#! /usr/bin/python
 
######################################################
#-- author: Andrea Borga (andrea.borga@nikhef.nl)
#-- date: $22/11/2011 $: created
#--
#-- version: $Rev 0 $:
#--
#-- description:
#-- basic python script to read and write
#-- UART registers
#--
#-- NOTE: look through the code for this
#--
#-- -- ----------------------
#-- -- ----------------------
#--
#-- to spot where the code needs customization
#
#-- Tested with Python 2.6 on Ubunru 10.04 LTS
#
#
######################################################
 
 
import serial
#ser = serial.Serial('/dev/ttyUSB0',115200,timeout=1)
ser = serial.Serial()
ser.port = "/dev/ttyUSB0" # set your port check in /dev folder
#ser.baudrate = 115200 # set your baud rate
ser.baudrate = 921600
ser.timeout = 1
ser.open()
print "Connected to: \t", ser.portstr
print "FPGA is ready to accept a command"
print "^] to quit"
print "help for command menu"
while 1:
if ser.isOpen():
in_var_add = raw_input("Type a command >> ")
if in_var_add != '\x1d' : # send a command
if in_var_add == 'help' : # help menu
print "\n", "here is a list implemented commands"
print " release on : enables GXBs, PRBS tx, and PRBS rx"
print " release off : disables whole logic"
#-----------------------
# add commands description here
#-----------------------
print " update : sends an update command"
print " help : prints this menu", "\n"
elif in_var_add == 'release on' :
ser.write('\x00\x30\x00\x00\x01\x11')
#elif in_var_add == 'release off' :
# ser.write('\x00\x30\x00\x00\x00\x00')
#-----------------------
# add more commands here
#-----------------------
elif in_var_add == 'update' :
ser.write('\x80\x00\x00\x00\x00\x00')
out_resp = ser.read(72) # read 72 bytes
#-----------------------
# specify the number of bytes to be readout
# nbytes = nregisters * 6
#-----------------------
out_split_resp = list(out_resp)
print "Received: "
ch_arr_resp = range(72)
hex_arr_resp = range(72)
for i in range (0,72):
ch_arr_resp[i] = ord(out_split_resp[i])
hex_arr_resp[i] = hex(ch_arr_resp[i])
for x in range (0, 67, 6):
print repr(hex_arr_resp[x]).rjust(2), repr(hex_arr_resp[x+1]).rjust(3), repr(hex_arr_resp[x+2]).rjust(4), repr(hex_arr_resp[x+3]).rjust(5), repr(hex_arr_resp[x+4]).rjust(6),
print repr(hex_arr_resp[x+5]).rjust(7)
else :
print "unkown command, try again"
elif in_var_add == '\x1d' : #ctrl+]
print "...connetion closed..."
ser.close()
break # exit app
 
trunk/software Property changes : Added: bugtraq:number ## -0,0 +1 ## +true \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.