@@ -77,7 +77,7 @@ def get_file_extensions(self):
7777 def program (self , filename , progress ):
7878 global max_progress
7979
80- with serial .Serial (self .port [0 ], 10000000 , timeout = 0.1 , writeTimeout = 0.1 ) as ser :
80+ with serial .Serial (self .port [0 ], 115200 , timeout = 2 , writeTimeout = 2 ) as ser :
8181 fpga = TinyFPGAB (ser , progress )
8282
8383 (addr , bitstream ) = fpga .slurp (filename )
@@ -94,19 +94,13 @@ def program(self, filename, progress):
9494
9595 def checkPortStatus (self , update_button_state ):
9696 try :
97- with serial .Serial (self .port [0 ], 10000000 , timeout = 0.1 , writeTimeout = 0.1 ) as ser :
97+ with serial .Serial (self .port [0 ], 115200 , timeout = 0.2 , writeTimeout = 0.2 ) as ser :
9898 fpga = TinyFPGAB (ser )
99-
100- fpga .wake ()
101- fpga .read (0 , 16 )
102- fpga .wake ()
103- devid = fpga .read_id ()
104-
105- expected_devid = [0x1F , 0x84 , 0x01 ]
106- if devid == expected_devid :
99+
100+ if fpga .is_bootloader_active ():
107101 com_port_status_sv .set ("Connected to TinyFPGA B2. Ready to program." )
108102 return True
109- else :
103+ else :
110104 com_port_status_sv .set ("Unable to communicate with TinyFPGA. Reconnect and reset TinyFPGA before programming." )
111105 return False
112106
@@ -119,7 +113,7 @@ def checkPortStatus(self, update_button_state):
119113 return False
120114
121115 def exitBootloader (self ):
122- with serial .Serial (self .port [0 ], 10000000 , timeout = 0.1 , writeTimeout = 0.1 ) as ser :
116+ with serial .Serial (self .port [0 ], 10000000 , timeout = 0.2 , writeTimeout = 0.2 ) as ser :
123117 try :
124118 TinyFPGAB (ser ).boot ()
125119
@@ -300,7 +294,7 @@ def update_serial_port_list_task():
300294 tinyfpga_ports = new_tinyfpga_ports
301295 tinyfpga_adapters = new_tinyfpga_adapters
302296
303- r .after (500 , update_serial_port_list_task )
297+ r .after (100 , update_serial_port_list_task )
304298
305299update_serial_port_list_task ()
306300
0 commit comments