[9XR-PRO] USB Bootloader fix

This commit is contained in:
Bertrand Songis
2013-12-31 11:05:55 +01:00
parent 57c6738ab7
commit 445899b58b
2 changed files with 31 additions and 21 deletions
+16 -12
View File
@@ -529,6 +529,8 @@ void configure_pins( uint32_t pins, uint16_t config )
}
}
void opentxBootloader();
void boardInit()
{
register Pio *pioptr ;
@@ -539,33 +541,35 @@ void boardInit()
PMC->PMC_PCER0 = (1<<ID_PIOC)|(1<<ID_PIOB)|(1<<ID_PIOA)|(1<<ID_UART0) ; // Enable clocks to PIOB and PIOA and PIOC and UART0
PIOC->PIO_PER = PIO_PC25 ; // Enable bit C25 (USB-detect)
#if defined(REVX)
if (usbPlugged()) {
lcdInit() ;
opentxBootloader();
}
#endif
#if defined(REVA)
// On REVB, PA21 is used as AD8, and measures current consumption.
pioptr = PIOA ;
pioptr->PIO_PER = PIO_PA21 ; // Enable bit A21 (EXT3)
pioptr->PIO_OER = PIO_PA21 ; // Set bit A21 as output
pioptr->PIO_SODR = PIO_PA21 ; // Set bit A21 ON
#else
pwrInit() ;
#endif
// pioptr->PIO_PUER = 0x80000000 ; // Enable pullup on bit A31 (EXIT)
// pioptr->PIO_PER = 0x80000000 ; // Enable bit A31
pioptr = PIOC ;
pioptr->PIO_PER = PIO_PC25 ; // Enable bit C25 (USB-detect)
// pioptr->PIO_OER = 0x80000000L ; // Set bit C31 as output
// pioptr->PIO_SODR = 0x80000000L ; // Set bit C31
#if defined(REVA)
// Configure RF_power (PC17) and PPM-jack-in (PC19), neither need pullups
pioptr->PIO_PER = 0x000A0000L ; // Enable bit C19, C17
pioptr->PIO_ODR = 0x000A0000L ; // Set bits C19 and C17 as input
#endif
#if !defined(REVA)
pwrInit() ;
#endif
config_free_pins() ;
// Next section configures the key inputs on the LCD data
pioptr = PIOC;
#if defined(REVA)
pioptr->PIO_PER = 0x0000003DL ; // Enable bits 2,3,4,5, 0
pioptr->PIO_OER = PIO_PC0 ; // Set bit 0 output