1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

In the revo bootloader check that the BOR bits are set to 2.7 volt threshold.

This addresses an issue where a slow power ramp (e.g. some BEC) will stop it
booting.
This commit is contained in:
James Cotton 2012-05-30 08:07:01 -05:00
parent a89b880609
commit 7c8cc94f5e

View File

@ -37,6 +37,7 @@
/* Prototype of PIOS_Board_Init() function */
extern void PIOS_Board_Init(void);
extern void FLASH_Download();
void check_bor();
#define BSL_HOLD_STATE ((PIOS_USB_DETECT_GPIO_PORT->IDR & PIOS_USB_DETECT_GPIO_PIN) ? 0 : 1)
/* Private typedef -----------------------------------------------------------*/
@ -75,6 +76,10 @@ int main() {
PIOS_Board_Init();
PIOS_IAP_Init();
// Make sure the brown out reset value for this chip
// is 2.7 volts
check_bor();
USB_connected = PIOS_USB_CheckAvailable(0);
if (PIOS_IAP_CheckRequest() == true) {
@ -206,3 +211,19 @@ uint8_t processRX() {
return true;
}
/**
* Check the brown out reset threshold is 2.7 volts and if not
* resets it. This solves an issue that can prevent boards
* powering up with some BEC
*/
void check_bor()
{
uint8_t bor = FLASH_OB_GetBOR();
if(bor != OB_BOR_LEVEL3) {
FLASH_OB_Unlock();
FLASH_OB_BORConfig(OB_BOR_LEVEL3);
FLASH_OB_Lock();
while(FLASH_WaitForLastOperation() == FLASH_BUSY);
}
}