Embedded RTOS class project. This project allows a Python/Tk program running on a PC host to monitor/control a test-CPU programmed into an altera development board.

Dependencies:   C12832_lcd USBDevice mbed-rtos mbed mmSPI-2 watchdog

Fork of USB_device_project by Mike Moore

Revision:
13:7e1688393abc
Parent:
8:db29cce17a33
--- a/mmPython/mmUSBserial.txt	Sun Sep 01 20:36:16 2013 +0000
+++ b/mmPython/mmUSBserial.txt	Tue Sep 17 19:07:00 2013 +0000
@@ -17,7 +17,8 @@
 
             openSuccess = 1
             self.__serialPort = serial.Serial()
-            self.__serialPort.baudrate = 9600
+            self.__serialPort.baudrate = 115200 # was 9600
+            self.__serialPort.timeout  =    1   # one-second timeout.
 
             for portIndex in range(7, -1, -1):
               portString = "/dev/ttyACM" + "{}".format(portIndex)
@@ -33,19 +34,29 @@
 
             if (openSuccess): print("successfully opened port {}.").format(portString)
             else:             print("could not open any port.")
+
+            self.__SER_BYTES = 18               # same as mbed program's SER_BYTES.
 #-----------------------------------------------#-------------------------------  
           def __del__(self):                    # destructor.
             self.__serialPort.close()
             print "object destroyed."
 #-----------------------------------------------#-------------------------------
+#         the number of bytes written and read must both be SER_BYTES.
+#         the '$' must be in bit<7> of what's written.
+
           def write(self,toWrite):              # write a string.
             nowWrite = toWrite[:7]
-            nowWrite = nowWrite + "$"
+            nowWrite = nowWrite + "$"           # in <7>.
+            if (self.__SER_BYTES > 8):          # flush out with 0's.
+              for loopIndex in range (0, self.__SER_BYTES - 8):
+                nowWrite = nowWrite + "0"
+#           print("nowWrite {}").format(nowWrite)
             self.__serialPort.write(nowWrite)
             return(nowWrite)
 #-----------------------------------------------#-------------------------------
           def read(self):                       # read a string.
-            gotRead = self.__serialPort.read(8)
+            gotRead = self.__serialPort.read(self.__SER_BYTES)
+#           print("gotRead {}").format(gotRead)
             return(gotRead)
 #-----------------------------------------------#-------------------------------
 #===============================================#===============================
@@ -70,3 +81,14 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+