Kazuhiro Hirasawa
/
STM32_180SENSOR_ADC4_RS_Ver2_CommCLD
WathchDog
Diff: main.cpp
- Revision:
- 7:f201e2d0ed4f
- Parent:
- 6:1948d19f854f
- Child:
- 8:0c5a091410cf
diff -r 1948d19f854f -r f201e2d0ed4f main.cpp --- a/main.cpp Thu Aug 15 14:16:46 2019 +0000 +++ b/main.cpp Fri Aug 16 08:43:23 2019 +0000 @@ -5,7 +5,7 @@ private: IWDG_HandleTypeDef hiwdg; public: - WatchDog(uint32_t prescaler = IWDG_PRESCALER_256, uint32_t reload = 0xFF) { + WatchDog(uint32_t prescaler = IWDG_PRESCALER_256, uint32_t reload = 0x0FFF) { hiwdg.Instance = (IWDG_TypeDef*)0x40003000; hiwdg.Init.Prescaler = prescaler; hiwdg.Init.Reload = reload; @@ -46,7 +46,7 @@ Timer pulse_watcher; -#define bufsize 1024 +#define bufsize 2048 char RxBuff[bufsize+1]; int RxPtr; int RdPtr; @@ -82,7 +82,8 @@ } } -unsigned char buf485[512]; +//unsigned char buf485[512]; +unsigned char buf485[2048]; int cnt485; int main() @@ -93,7 +94,7 @@ int i,cnt; int pulse; - WatchDog wdg(IWDG_PRESCALER_8, 0x0FFF); +// WatchDog wdg(IWDG_PRESCALER_16, 0x0FFF); modem.baud(38400); modem.format(8,Serial::None,1); @@ -104,6 +105,9 @@ buf485[0] = '\0'; pc.printf("\nSTM32 ADC internal channels reading example\r\n"); + +// wdg.kick(); // IWDGをリセット + pos1 = 1; pos2 = 1; @@ -114,8 +118,10 @@ pulse_watcher.start(); pulse = pulse1 || pulse2; - for (i = 0;i<40;i++) data[i] = 0; - + for (i = 0;i<40;i++) { + data[i] = 0; +// wdg.kick(); // IWDGをリセット + } while(1) { if (pulse_watcher.read() > 100) pulse_watcher.reset(); @@ -163,6 +169,8 @@ pos2 = 1; } +// wdg.kick(); // IWDGをリセット + // pulsewatch } if(cnt != 0) { @@ -190,7 +198,10 @@ data[10] = ad3 * 0xffff; data[12] = ad4 * 0xffff; - wdg.kick(); // IWDGをリセット + //WDT test +// if (jmp == 0) while(1) ; + +// wdg.kick(); // IWDGをリセット } }