global: pep8 (E261, E271)
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 13 Apr 2015 15:16:12 +0000 (17:16 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 13 Apr 2015 15:16:12 +0000 (17:16 +0200)
22 files changed:
misoc_import.py
misoclib/com/uart/phy/serial.py
misoclib/com/uart/phy/sim.py
misoclib/mem/sdram/core/lasmicon/__init__.py
misoclib/mem/sdram/core/lasmicon/multiplexer.py
misoclib/mem/sdram/core/lasmicon/refresher.py
misoclib/mem/sdram/core/minicon/__init__.py
misoclib/mem/sdram/phy/dfii.py
misoclib/mem/sdram/phy/initsequence.py
misoclib/mem/sdram/test/lasmicon_df_tb.py
misoclib/mem/sdram/test/lasmicon_wb.py
misoclib/soc/__init__.py
misoclib/video/dvisampler/analysis.py
misoclib/video/dvisampler/clocking.py
misoclib/video/framebuffer/phy.py
targets/kc705.py
targets/minispartan6.py
targets/mlabs_video.py
targets/pipistrello.py
targets/ppro.py
targets/simple.py
tools/flterm.py

index b1723b8be2bb663e02da3455e4407e9ea12c6264..6bbf263a97ca52a822ae3a14e8b09773e64a49de 100644 (file)
@@ -5,7 +5,7 @@ import importlib
 def misoc_import(default, external, name):
     if external:
         try:
-            del sys.modules[name] # force external path search
+            del sys.modules[name]  # force external path search
         except KeyError:
             pass
         loader = importlib.find_loader(name, [external])
index d22c1931273c5bcce873c8ff5fd5cbfceae5bc87..747dbd21749968cbaca54c361f3cfc2f18372f9a 100644 (file)
@@ -23,7 +23,7 @@ class UARTPHYSerialRX(Module):
             rx_done.eq(0),
             rx_r.eq(rx),
             If(~rx_busy,
-                If(~rx & rx_r, # look for start bit
+                If(~rx & rx_r,  # look for start bit
                     rx_busy.eq(1),
                     rx_bitcount.eq(0),
                 )
@@ -31,12 +31,12 @@ class UARTPHYSerialRX(Module):
                 If(uart_clk_rxen,
                     rx_bitcount.eq(rx_bitcount + 1),
                     If(rx_bitcount == 0,
-                        If(rx, # verify start bit
+                        If(rx,  # verify start bit
                             rx_busy.eq(0)
                         )
                     ).Elif(rx_bitcount == 9,
                         rx_busy.eq(0),
-                        If(rx, # verify stop bit
+                        If(rx,  # verify stop bit
                             rx_data.eq(rx_reg),
                             rx_done.eq(1)
                         )
index 0c8637342f23584bfc243dc770574edf41130da0..a7348e0bf441ac263ed2b9c0cf59d83b37e7625e 100644 (file)
@@ -24,7 +24,7 @@ class UARTPHYSim(Module):
         m, s = pty.openpty()
         name = os.ttyname(s)
         print("UART tty: "+name)
-        time.sleep(0.5) # pause for user
+        time.sleep(0.5)  # pause for user
         f = open("/tmp/simserial", "w")
         f.write(os.ttyname(s))
         f.close()
index aeda333f1271e31776e7ecf7580f9af3b1aef55e..5614cece701253643d7a180b6efbd734594acdaa 100644 (file)
@@ -29,9 +29,9 @@ class LASMIconSettings:
 class LASMIcon(Module):
     def __init__(self, phy_settings, geom_settings, timing_settings, controller_settings, **kwargs):
         if phy_settings.memtype in ["SDR"]:
-            burst_length = phy_settings.nphases*1 # command multiplication*SDR
+            burst_length = phy_settings.nphases*1  # command multiplication*SDR
         elif phy_settings.memtype in ["DDR", "LPDDR", "DDR2", "DDR3"]:
-            burst_length = phy_settings.nphases*2 # command multiplication*DDR
+            burst_length = phy_settings.nphases*2  # command multiplication*DDR
         address_align = log2_int(burst_length)
 
         self.dfi = dfi.Interface(geom_settings.addressbits,
index 50fd11d26ba28a7322e9805fd64789bd2f5ac5fc..ca9b96235aa554702170fff7bd009172ea2db099 100644 (file)
@@ -115,7 +115,7 @@ class Multiplexer(Module, AutoCSR):
 
         # Command steering
         nop = CommandRequest(geom_settings.addressbits, geom_settings.bankbits)
-        commands = [nop, choose_cmd.cmd, choose_req.cmd, refresher.cmd] # nop must be 1st
+        commands = [nop, choose_cmd.cmd, choose_req.cmd, refresher.cmd]  # nop must be 1st
         (STEER_NOP, STEER_CMD, STEER_REQ, STEER_REFRESH) = range(4)
         steerer = _Steerer(commands, dfi)
         self.submodules += steerer
@@ -211,7 +211,7 @@ class Multiplexer(Module, AutoCSR):
             steerer.sel[0].eq(STEER_REFRESH),
             If(~refresher.req, NextState("READ"))
         )
-        fsm.delayed_enter("RTW", "WRITE", phy_settings.read_latency-1) # FIXME: reduce this, actual limit is around (cl+1)/nphases
+        fsm.delayed_enter("RTW", "WRITE", phy_settings.read_latency-1)  # FIXME: reduce this, actual limit is around (cl+1)/nphases
         fsm.delayed_enter("WTR", "READ", timing_settings.tWTR-1)
         # FIXME: workaround for zero-delay loop simulation problem with Icarus Verilog
         fsm.finalize()
index 60f30479704218522080a97ef0cbb96a6f34ceb4..007309a9b365ada252eaeb82973d80e674c01076 100644 (file)
@@ -8,7 +8,7 @@ from misoclib.mem.sdram.core.lasmicon.multiplexer import *
 class Refresher(Module):
     def __init__(self, a, ba, tRP, tREFI, tRFC, enabled=True):
         self.req = Signal()
-        self.ack = Signal() # 1st command 1 cycle after assertion of ack
+        self.ack = Signal()  # 1st command 1 cycle after assertion of ack
         self.cmd = CommandRequest(a, ba)
 
         ###
index b7fb21486cf49328616d5ebf265ef210ca902db8..c3078cd2b2e9d61981a2437d2f31fddd81d167c7 100644 (file)
@@ -44,9 +44,9 @@ class MiniconSettings:
 class Minicon(Module):
     def __init__(self, phy_settings, geom_settings, timing_settings):
         if phy_settings.memtype in ["SDR"]:
-            burst_length = phy_settings.nphases*1 # command multiplication*SDR
+            burst_length = phy_settings.nphases*1  # command multiplication*SDR
         elif phy_settings.memtype in ["DDR", "LPDDR", "DDR2", "DDR3"]:
-            burst_length = phy_settings.nphases*2 # command multiplication*DDR
+            burst_length = phy_settings.nphases*2  # command multiplication*DDR
         address_align = log2_int(burst_length)
 
         nbanks = range(2**geom_settings.bankbits)
index 8495addc4faf510fec660c7a733a46febfb1c0ef..09ac053b101f451c788a561caf25dcd45c9a2935 100644 (file)
@@ -6,7 +6,7 @@ from misoclib.mem.sdram.phy import dfi
 
 class PhaseInjector(Module, AutoCSR):
     def __init__(self, phase):
-        self._command = CSRStorage(6) # cs, we, cas, ras, wren, rden
+        self._command = CSRStorage(6)  # cs, we, cas, ras, wren, rden
         self._command_issue = CSR()
         self._address = CSRStorage(flen(phase.address))
         self._baddress = CSRStorage(flen(phase.bank))
@@ -43,7 +43,7 @@ class DFIInjector(Module, AutoCSR):
         self.slave = dfi.Interface(addressbits, bankbits, databits, nphases)
         self.master = dfi.Interface(addressbits, bankbits, databits, nphases)
 
-        self._control = CSRStorage(4) # sel, cke, odt, reset_n
+        self._control = CSRStorage(4)  # sel, cke, odt, reset_n
 
         for n, phase in enumerate(inti.phases):
             setattr(self.submodules, "pi" + str(n), PhaseInjector(phase))
index 1a4ffea03f1dc8d5e8d67bdacfd3ace45f546cfc..76c25b9c67adfbbc971370d85c1ce9887e25b66f 100644 (file)
@@ -187,9 +187,9 @@ const unsigned int sdram_dfii_pix_rddata_addr[{n}] = {{
             mr2 |= rtt_wr << 9
             return mr2
 
-        mr0 = format_mr0(cl, 8, 1) # wr=8 FIXME: this should be ceiling(tWR/tCK)
-        mr1 = format_mr1(1, 1) # Output Drive Strength RZQ/7 (34 ohm) / Rtt RZQ/4 (60 ohm)
-        mr2 = format_mr2(sdram_phy_settings.cwl, 2) # Rtt(WR) RZQ/4
+        mr0 = format_mr0(cl, 8, 1)  # wr=8 FIXME: this should be ceiling(tWR/tCK)
+        mr1 = format_mr1(1, 1)  # Output Drive Strength RZQ/7 (34 ohm) / Rtt RZQ/4 (60 ohm)
+        mr2 = format_mr2(sdram_phy_settings.cwl, 2)  # Rtt(WR) RZQ/4
         mr3 = 0
 
         init_sequence = [
index 6f1a30cfd656c749882fd68832a09197116b8d30..89b0d25219390f0a0ba32777ebbb6b8d12e29e4b 100644 (file)
@@ -28,12 +28,12 @@ class TB(Module):
     def do_simulation(self, selfp):
         dfip = selfp.ctler.dfi
         for p in dfip.phases:
-            if p.ras_n and not p.cas_n and not p.we_n: # write
+            if p.ras_n and not p.cas_n and not p.we_n:  # write
                 d = dfip.phases[0].wrdata | (dfip.phases[1].wrdata << 64)
                 print(d)
                 if d != p.address//2 + p.bank*512 + self.open_row*2048:
                     print("**** ERROR ****")
-            elif not p.ras_n and p.cas_n and p.we_n: # activate
+            elif not p.ras_n and p.cas_n and p.we_n:  # activate
                 self.open_row = p.address
 
 if __name__ == "__main__":
index 0f5998f93163fc057f04cab5e615162fa01ec2e7..e6d967b55e748ca6d4b03fb53f2adc817511078c 100644 (file)
@@ -9,7 +9,7 @@ from misoclib.mem.sdram.frontend import wishbone2lasmi
 
 from common import sdram_phy, sdram_geom, sdram_timing, DFILogger
 
-l2_size = 8192 # in bytes
+l2_size = 8192  # in bytes
 
 
 def my_generator():
index c982339ac728d3f0d1f82b246d35229ad1cbe5e7..4ea520dd7307efcce6a92ef0670eaef7a38853fd 100644 (file)
@@ -16,23 +16,23 @@ def mem_decoder(address, start=26, end=29):
 
 class SoC(Module):
     csr_map = {
-        "crg":                    0, # user
-        "uart_phy":                1, # provided by default (optional)
-        "uart":                    2, # provided by default (optional)
-        "identifier":            3, # provided by default (optional)
-        "timer0":                4, # provided by default (optional)
-        "buttons":                5, # user
-        "leds":                    6, # user
+        "crg":        0,  # user
+        "uart_phy":   1,  # provided by default (optional)
+        "uart":       2,  # provided by default (optional)
+        "identifier": 3,  # provided by default (optional)
+        "timer0":     4,  # provided by default (optional)
+        "buttons":    5,  # user
+        "leds":       6,  # user
     }
     interrupt_map = {
-        "uart":            0,
-        "timer0":        1,
+        "uart":   0,
+        "timer0": 1,
     }
     mem_map = {
-        "rom":        0x00000000, # (shadow @0x80000000)
-        "sram":        0x10000000, # (shadow @0x90000000)
-        "main_ram":    0x40000000, # (shadow @0xc0000000)
-        "csr":        0x60000000, # (shadow @0xe0000000)
+        "rom":      0x00000000,  # (shadow @0x80000000)
+        "sram":     0x10000000,  # (shadow @0x90000000)
+        "main_ram": 0x40000000,  # (shadow @0xc0000000)
+        "csr":      0x60000000,  # (shadow @0xe0000000)
     }
     def __init__(self, platform, clk_freq,
                 cpu_type="lm32", cpu_reset_address=0x00000000,
@@ -64,9 +64,9 @@ class SoC(Module):
         self.csr_data_width = csr_data_width
         self.csr_address_width = csr_address_width
 
-        self._memory_regions = [] # list of (name, origin, length)
-        self._csr_regions = [] # list of (name, origin, busword, csr_list/Memory)
-        self._constants = [] # list of (name, value)
+        self._memory_regions = []  # list of (name, origin, length)
+        self._csr_regions = []  # list of (name, origin, busword, csr_list/Memory)
+        self._constants = []  # list of (name, value)
 
         self._wb_masters = []
         self._wb_slaves = []
index 6c945cea4bc446abfed231b4105a00ff787f57c3..e3bfc39df9039253bc67bb93e93f19b2d0699bbc 100644 (file)
@@ -139,7 +139,7 @@ class FrameExtraction(Module, AutoCSR):
         encoded_pixel = Signal(24)
         self.comb += encoded_pixel.eq(Cat(self.b, self.g, self.r))
         pack_factor = word_width//24
-        assert(pack_factor & (pack_factor - 1) == 0) # only support powers of 2
+        assert(pack_factor & (pack_factor - 1) == 0)  # only support powers of 2
         pack_counter = Signal(max=pack_factor)
         self.sync.pix += [
             cur_word_valid.eq(0),
index 3c8bc7c9757a3d6672b00ca323b5be2510366f7d..274d3053342ce8efaaffcf3e705af195f725a266 100644 (file)
@@ -40,9 +40,9 @@ class Clocking(Module, AutoCSR):
         )
         self.specials += Instance("PLL_ADV",
             p_CLKFBOUT_MULT=10,
-            p_CLKOUT0_DIVIDE=1,  # pix10x
-            p_CLKOUT1_DIVIDE=5,  # pix2x
-            p_CLKOUT2_DIVIDE=10, # pix
+            p_CLKOUT0_DIVIDE=1,   # pix10x
+            p_CLKOUT1_DIVIDE=5,   # pix2x
+            p_CLKOUT2_DIVIDE=10,  # pix
             p_COMPENSATION="INTERNAL",
 
             i_CLKINSEL=1,
index c55efde348992307a6ada59c77a58f86d5d7a1b2..7103b631ed37259d4a0e6f4e03cc20074b081d6d 100644 (file)
@@ -33,7 +33,7 @@ class _FIFO(Module):
         ]
 
         unpack_counter = Signal(max=pack_factor)
-        assert(pack_factor & (pack_factor - 1) == 0) # only support powers of 2
+        assert(pack_factor & (pack_factor - 1) == 0)  # only support powers of 2
         self.sync.pix += [
             unpack_counter.eq(unpack_counter + 1),
             self.pix_hsync.eq(fifo.dout.hsync),
@@ -143,9 +143,9 @@ class _Clocking(Module, AutoCSR):
             self.specials += [
                 Instance("PLL_ADV",
                     p_CLKFBOUT_MULT=10,
-                    p_CLKOUT0_DIVIDE=1,  # pix10x
-                    p_CLKOUT1_DIVIDE=5,  # pix2x
-                    p_CLKOUT2_DIVIDE=10, # pix
+                    p_CLKOUT0_DIVIDE=1,   # pix10x
+                    p_CLKOUT1_DIVIDE=5,   # pix2x
+                    p_CLKOUT2_DIVIDE=10,  # pix
                     p_COMPENSATION="INTERNAL",
 
                     i_CLKINSEL=1,
index fd4f461c56ff1c0580acd7aa359dbdb6f132c969..2f0e328fa2d3b23bad79b075548dfa6a780fb925 100644 (file)
@@ -73,8 +73,8 @@ class BaseSoC(SDRAMSoC):
     default_platform = "kc705"
 
     csr_map = {
-        "spiflash":    16,
-        "ddrphy":    17,
+        "spiflash": 16,
+        "ddrphy":   17,
     }
     csr_map.update(SDRAMSoC.csr_map)
 
@@ -103,18 +103,18 @@ class BaseSoC(SDRAMSoC):
 
 class MiniSoC(BaseSoC):
     csr_map = {
-        "ethphy":        18,
-        "ethmac":        19,
+        "ethphy": 18,
+        "ethmac": 19,
     }
     csr_map.update(BaseSoC.csr_map)
 
     interrupt_map = {
-        "ethmac":        2,
+        "ethmac": 2,
     }
     interrupt_map.update(BaseSoC.interrupt_map)
 
     mem_map = {
-        "ethmac":    0x30000000, # (shadow @0xb0000000)
+        "ethmac": 0x30000000,  # (shadow @0xb0000000)
     }
     mem_map.update(BaseSoC.mem_map)
 
index 42d49184f28d382611a80fdea41e8b8faf3ead23..c667543b6ed12949e2a87e93aad65e3e54d36192 100644 (file)
@@ -46,8 +46,8 @@ class _CRG(Module):
             p_CLKOUT1_PHASE=0., p_CLKOUT1_DIVIDE=p//1,
             p_CLKOUT2_PHASE=0., p_CLKOUT2_DIVIDE=p//1,
             p_CLKOUT3_PHASE=0., p_CLKOUT3_DIVIDE=p//1,
-            p_CLKOUT4_PHASE=0., p_CLKOUT4_DIVIDE=p//1, # sys
-            p_CLKOUT5_PHASE=270., p_CLKOUT5_DIVIDE=p//1, # sys_ps
+            p_CLKOUT4_PHASE=0., p_CLKOUT4_DIVIDE=p//1,  # sys
+            p_CLKOUT5_PHASE=270., p_CLKOUT5_DIVIDE=p//1,  # sys_ps
         )
         self.specials += Instance("BUFG", i_I=pll[4], o_O=self.cd_sys.clk)
         self.specials += Instance("BUFG", i_I=pll[5], o_O=self.cd_sys_ps.clk)
index a9aa1c4cab6ad4e5a82e3b115bca21b6555b7892..1973be3a8761107f8cc817e35f6ae13b13bdb193 100644 (file)
@@ -33,7 +33,7 @@ class _MXClockPads:
 
 
 class BaseSoC(SDRAMSoC):
-    default_platform = "mixxeo" # also supports m1
+    default_platform = "mixxeo"  # also supports m1
 
     def __init__(self, platform, sdram_controller_settings=LASMIconSettings(), **kwargs):
         SDRAMSoC.__init__(self, platform,
@@ -69,18 +69,18 @@ INST "mxcrg/rd_bufpll" LOC = "BUFPLL_X0Y3";
 
 class MiniSoC(BaseSoC):
     csr_map = {
-        "ethphy":        16,
-        "ethmac":        17,
+        "ethphy": 16,
+        "ethmac": 17,
     }
     csr_map.update(BaseSoC.csr_map)
 
     interrupt_map = {
-        "ethmac":        2,
+        "ethmac": 2,
     }
     interrupt_map.update(BaseSoC.interrupt_map)
 
     mem_map = {
-        "ethmac":    0x30000000, # (shadow @0xb0000000)
+        "ethmac": 0x30000000,  # (shadow @0xb0000000)
     }
     mem_map.update(BaseSoC.mem_map)
 
@@ -126,7 +126,7 @@ TIMESPEC "TSise_sucks2" = FROM "GRPsys_clk" TO "GRPvga_clk" TIG;
 
 class FramebufferSoC(MiniSoC):
     csr_map = {
-        "fb":                    18,
+        "fb": 18,
     }
     csr_map.update(MiniSoC.csr_map)
 
index 43aea7d931c190f2a2298017d48827743801f14f..ef9454728f87f2c059a3558ee836c00b601b671f 100644 (file)
@@ -49,12 +49,12 @@ class _CRG(Module):
             o_CLKOUT3=pll[3], p_CLKOUT3_DUTY_CYCLE=.5,
             o_CLKOUT4=pll[4], p_CLKOUT4_DUTY_CYCLE=.5,
             o_CLKOUT5=pll[5], p_CLKOUT5_DUTY_CYCLE=.5,
-            p_CLKOUT0_PHASE=0., p_CLKOUT0_DIVIDE=p//4, # sdram wr rd
+            p_CLKOUT0_PHASE=0., p_CLKOUT0_DIVIDE=p//4,  # sdram wr rd
             p_CLKOUT1_PHASE=0., p_CLKOUT1_DIVIDE=p//8,
-            p_CLKOUT2_PHASE=270., p_CLKOUT2_DIVIDE=p//2, # sdram dqs adr ctrl
-            p_CLKOUT3_PHASE=250., p_CLKOUT3_DIVIDE=p//2, # off-chip ddr
+            p_CLKOUT2_PHASE=270., p_CLKOUT2_DIVIDE=p//2,  # sdram dqs adr ctrl
+            p_CLKOUT3_PHASE=250., p_CLKOUT3_DIVIDE=p//2,  # off-chip ddr
             p_CLKOUT4_PHASE=0., p_CLKOUT4_DIVIDE=p//1,
-            p_CLKOUT5_PHASE=0., p_CLKOUT5_DIVIDE=p//1, # sys
+            p_CLKOUT5_PHASE=0., p_CLKOUT5_DIVIDE=p//1,  # sys
         )
         self.specials += Instance("BUFG", i_I=pll[5], o_O=self.cd_sys.clk)
         reset = platform.request("user_btn")
@@ -92,14 +92,14 @@ class BaseSoC(SDRAMSoC):
     default_platform = "pipistrello"
 
     csr_map = {
-        "spiflash":    16,
+        "spiflash": 16,
     }
     csr_map.update(SDRAMSoC.csr_map)
 
     def __init__(self, platform, sdram_controller_settings=LASMIconSettings(), **kwargs):
         clk_freq = 75*1000000
         SDRAMSoC.__init__(self, platform, clk_freq,
-                    cpu_reset_address=0x170000, # 1.5 MB
+                    cpu_reset_address=0x170000,  # 1.5 MB
                     sdram_controller_settings=sdram_controller_settings,
                     **kwargs)
 
index 6918302caf6353302a2edc1029e1066a5734ff43..f0b98d9135c722b675d598d95744269056e488a7 100644 (file)
@@ -47,8 +47,8 @@ class _CRG(Module):
             p_CLKOUT1_PHASE=0., p_CLKOUT1_DIVIDE=p//1,
             p_CLKOUT2_PHASE=0., p_CLKOUT2_DIVIDE=p//1,
             p_CLKOUT3_PHASE=0., p_CLKOUT3_DIVIDE=p//1,
-            p_CLKOUT4_PHASE=0., p_CLKOUT4_DIVIDE=p//1, # sys
-            p_CLKOUT5_PHASE=270., p_CLKOUT5_DIVIDE=p//1, # sys_ps
+            p_CLKOUT4_PHASE=0., p_CLKOUT4_DIVIDE=p//1,  # sys
+            p_CLKOUT5_PHASE=270., p_CLKOUT5_DIVIDE=p//1,  # sys_ps
         )
         self.specials += Instance("BUFG", i_I=pll[4], o_O=self.cd_sys.clk)
         self.specials += Instance("BUFG", i_I=pll[5], o_O=self.cd_sys_ps.clk)
@@ -65,7 +65,7 @@ class BaseSoC(SDRAMSoC):
     default_platform = "papilio_pro"
 
     csr_map = {
-        "spiflash":    16,
+        "spiflash": 16,
     }
     csr_map.update(SDRAMSoC.csr_map)
 
index e89fd5ec9742f3dcbd7bdfa87523104a17a21023..24d0d406bee3bf37a7521ba03dfaac3e7c8ed2e4 100644 (file)
@@ -19,18 +19,18 @@ class BaseSoC(SoC):
 
 class MiniSoC(BaseSoC):
     csr_map = {
-        "ethphy":        20,
-        "ethmac":        21
+        "ethphy": 20,
+        "ethmac": 21
     }
     csr_map.update(BaseSoC.csr_map)
 
     interrupt_map = {
-        "ethmac":        2,
+        "ethmac": 2,
     }
     interrupt_map.update(BaseSoC.interrupt_map)
 
     mem_map = {
-        "ethmac":    0x30000000, # (shadow @0xb0000000)
+        "ethmac": 0x30000000,  # (shadow @0xb0000000)
     }
     mem_map.update(BaseSoC.mem_map)
 
index 7522ab61cfd97fed9ef4463413a9d777ec9bbcac..84b385ed8db46ac3706d469ec195f3c1055b7758 100644 (file)
@@ -120,7 +120,7 @@ class Flterm:
         self.serial = serial.Serial(port, speed, timeout=0.25)
         self.serial.flushOutput()
         self.serial.flushInput()
-        self.serial.close() # in case port was not correctly closed
+        self.serial.close()  # in case port was not correctly closed
         self.serial.open()
 
     def close(self):