Fixes #2681: the PWR pin was not turned on correctly in _bootStart(). Watchdog reset now works on 9XE, the Bootloader exit also works.

Trim switch pull up not enabled for 9XE in _bootStart().
Added watchdog test option in DEBUG screen (long press MENU key), use WATCHDOG_TEST=YES compile option to enable it.
This commit is contained in:
Damjan Adamic
2015-08-25 20:35:07 +02:00
parent f4e55f9d45
commit e83b7c3a69
7 changed files with 54 additions and 16 deletions
+1 -1
View File
@@ -156,7 +156,7 @@ void boardInit()
#endif
#if defined(REV9E)
if (!(RCC->CSR & (RCC_CSR_SFTRSTF | RCC_CSR_WDGRSTF))) {
if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
lcd_clear();
lcd_bmp(76, 2, bmp_lock, 0, 60);
lcdRefresh();
+3 -2
View File
@@ -236,8 +236,9 @@ void checkRotaryEncoder(void);
void watchdogInit(unsigned int duration);
#define wdt_enable(x) watchdogInit(1500)
#define wdt_reset() IWDG->KR = 0xAAAA
#define WAS_RESET_BY_WATCHDOG() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF))
#define WAS_RESET_BY_SOFTWARE() (RCC->CSR & RCC_CSR_SFTRSTF)
#define WAS_RESET_BY_SOFTWARE() (RCC->CSR & RCC_CSR_SFTRSTF)
#define WAS_RESET_BY_WATCHDOG() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF))
#define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF | RCC_CSR_SFTRSTF))
#endif
// ADC driver
+2 -2
View File
@@ -363,7 +363,7 @@ void lcdInit()
{
LCD_Hardware_Init();
if (WAS_RESET_BY_WATCHDOG()|WAS_RESET_BY_SOFTWARE()) return; //no need to reset LCD module
if (WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) return; //no need to reset LCD module
//reset LCD module
LCD_RST_LOW();
@@ -400,7 +400,7 @@ void lcdInitFinish()
initialization (without reset) is also recommended by the data sheet.
*/
if (!WAS_RESET_BY_WATCHDOG() && !WAS_RESET_BY_SOFTWARE()) {
if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
#if !defined(BOOT)
while(g_tmr10ms < (RESET_WAIT_DELAY_MS/10)) {}; //wait measured from the power-on
#else
+3
View File
@@ -42,6 +42,9 @@ extern volatile uint32_t g_tmr10ms;
void pwrInit()
{
// if any changes are done to the PWR PIN or pwrOn() function
// then the same changes must be done in _bootStart()
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_ON;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;