some computers are slow to enumerate

This commit is contained in:
Firmware Batman 2017-08-21 13:32:28 -07:00
parent 37b3327c28
commit 71d81ed916
4 changed files with 17 additions and 6 deletions

View File

@ -27,7 +27,7 @@ bin: obj/$(PROJ_NAME).bin
# this flashes everything # this flashes everything
recover: obj/bootstub.$(PROJ_NAME).bin obj/$(PROJ_NAME).bin recover: obj/bootstub.$(PROJ_NAME).bin obj/$(PROJ_NAME).bin
-python -c "from panda import Panda; Panda().reset(enter_bootloader=True)" -python -c "from panda import Panda; Panda().reset(enter_bootloader=True)"
sleep 0.5 sleep 1.0
$(DFU_UTIL) -a 0 -s 0x08004000 -D obj/$(PROJ_NAME).bin $(DFU_UTIL) -a 0 -s 0x08004000 -D obj/$(PROJ_NAME).bin
$(DFU_UTIL) -a 0 -s 0x08000000:leave -D obj/bootstub.$(PROJ_NAME).bin $(DFU_UTIL) -a 0 -s 0x08000000:leave -D obj/bootstub.$(PROJ_NAME).bin

View File

@ -61,9 +61,19 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, int hardwired) {
case 0xd1: case 0xd1:
// this allows reflashing of the bootstub // this allows reflashing of the bootstub
// so it's blocked over wifi // so it's blocked over wifi
if (hardwired) { switch (setup->b.wValue.w) {
enter_bootloader_mode = ENTER_BOOTLOADER_MAGIC; case 0:
NVIC_SystemReset(); if (hardwired) {
puts("-> entering bootloader\n");
enter_bootloader_mode = ENTER_BOOTLOADER_MAGIC;
NVIC_SystemReset();
}
break;
case 1:
puts("-> entering softloader\n");
enter_bootloader_mode = ENTER_SOFTLOADER_MAGIC;
NVIC_SystemReset();
break;
} }
break; break;
// **** 0xd6: get version // **** 0xd6: get version

View File

@ -136,6 +136,7 @@ class Panda(object):
break break
except Exception as e: except Exception as e:
print("exception", e) print("exception", e)
traceback.print_exc()
if wait == False or self._handle != None: if wait == False or self._handle != None:
break break
assert(self._handle != None) assert(self._handle != None)
@ -154,7 +155,7 @@ class Panda(object):
except Exception: except Exception:
pass pass
if not enter_bootloader: if not enter_bootloader:
time.sleep(0.5) time.sleep(1.0)
self.connect() self.connect()
def flash(self, fn=None): def flash(self, fn=None):

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
nosetests -x -s tests/automated/$1*.py PYTHONPATH="." nosetests -x -s tests/automated/$1*.py