def setUp(self):
        # reset and zero efuses
        serialport.dtr = False
        serialport.rts = True
        time.sleep(0.05)
        serialport.rts = False
        time.sleep(0.05)
        serialport.dtr = True

        # connect & verify efuses are really zero
        self.esp = esptool.ESP32ROM(serialport)
        self.esp.connect('no_reset')  # takes ~7 seconds
        self.efuses = espefuse.EspEfuses(self.esp)

        # Check every efuse is zero (~1 second)
        for efuse in self.efuses:
            val = efuse.get_raw()
            BAD_EFUSE_MSG = "Efuse %s not all zeroes - either this is a real ESP32 chip (VERY BAD, read top of file), or the reset is not erasing all efuses correctly." % efuse.register_name
            try:
                self.assertEqual(b'\x00' * len(val), val, BAD_EFUSE_MSG)
            except TypeError:
                self.assertEqual(0, val, BAD_EFUSE_MSG)
Ejemplo n.º 2
0
 def valid_key_present(self):
     esp = esptool.ESP32ROM(serialport)
     esp.connect()
     efuses = espefuse.EspEfuses(esp)
     blk1_rd_en = efuses["BLK1"].is_readable()
     return not blk1_rd_en
 def _set_34_coding_scheme(self):
     self.efuses["CODING_SCHEME"].burn(1)
     # EspEfuses constructor needs to re-load CODING_SCHEME
     self.efuses = espefuse.EspEfuses(self.esp)