From 017a1d154a357079b852716d2324481438bd05e7 Mon Sep 17 00:00:00 2001 From: igor-m Date: Fri, 11 Apr 2014 00:55:36 +0200 Subject: [PATCH] Fix for a smooth start of the USB Bootloader @120MHz (it locks otherwise) --- sys/pic32/usb_boot.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/pic32/usb_boot.c b/sys/pic32/usb_boot.c index 645b039..3a1d1a7 100644 --- a/sys/pic32/usb_boot.c +++ b/sys/pic32/usb_boot.c @@ -560,6 +560,12 @@ static int handle_packet() */ int main() { + // IM: Quick fix to enable a smooth start @120MHz + /* Wait until both System and USB PLL are locked */ + // while ( (OSCCON & 0x60) != 0x60 ); // does not work + while(!(OSCCON & 0x60)); + + /* Initialize STATUS register: master interrupt disable. */ mips_write_c0_register (C0_STATUS, 0, ST_CU0 | ST_BEV);