mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-03 11:24:10 +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:
parent
a89b880609
commit
7c8cc94f5e
@ -37,6 +37,7 @@
|
|||||||
/* Prototype of PIOS_Board_Init() function */
|
/* Prototype of PIOS_Board_Init() function */
|
||||||
extern void PIOS_Board_Init(void);
|
extern void PIOS_Board_Init(void);
|
||||||
extern void FLASH_Download();
|
extern void FLASH_Download();
|
||||||
|
void check_bor();
|
||||||
#define BSL_HOLD_STATE ((PIOS_USB_DETECT_GPIO_PORT->IDR & PIOS_USB_DETECT_GPIO_PIN) ? 0 : 1)
|
#define BSL_HOLD_STATE ((PIOS_USB_DETECT_GPIO_PORT->IDR & PIOS_USB_DETECT_GPIO_PIN) ? 0 : 1)
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
@ -75,6 +76,10 @@ int main() {
|
|||||||
PIOS_Board_Init();
|
PIOS_Board_Init();
|
||||||
PIOS_IAP_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);
|
USB_connected = PIOS_USB_CheckAvailable(0);
|
||||||
|
|
||||||
if (PIOS_IAP_CheckRequest() == true) {
|
if (PIOS_IAP_CheckRequest() == true) {
|
||||||
@ -206,3 +211,19 @@ uint8_t processRX() {
|
|||||||
return true;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user