Quote
Firstly, say your 'boss' wanted list of your solutions, BEFORE deciding to hire you. Here would be my responses:
I am working long time here. Boss does not know what he wants to do. I believe he wants to just see the WD is working or not just downloading .out/.bin/.hex files!
Quote
First thing: Does engineering office want 'formal' spec, or just casual list of software goals?
What I saw there is a third party who updated firmware time to time, watch dog is just an example.
This project is not only bound to a limited software facility, its a versatile application and having a customized board and code representation.
It has node point with PC software, may be register values can display there graphically, can be set them with offset or default value. Mostly written in C#.
With basic c all driver .c and .h are written. ADSs are set to be ePWM, communication protocol send them to useful place. System recall them, W/R them store them.
A bunch of case1...caseN executed well. Softstarts( sleep time/ active time) begins, ends, interrupts are generating. Dahasheet and manual says all.
Quote
What I would do first, is write some private code (meaning not for putting in final product).
This 'private developer tool' will NOT contain much active CODE, rather just only for testing your WatchDog hardware, to make sure doing that function as desired. Please read post by Lary, on some hardware correction might be needed (pull ups).
They have not told me to work on code. HW testing is done as I said, boss wanted to toggle the crystal oscillator output ( not a good idea at all) and thus he assume if main clack is disable then it affects WD i/o. After downloading program system takes time to run a cycle, instantly the MCU wont RESET quickly. You it has "time out" period. It also has internal clock. I wanted to see one of your example code.
If you cant hare it, may be ST cloud would have it.
Quote
So, my code would, upon power-up do any normal start-up, of WD timer. Plus your processor probably needs to enable interrupts. Some CPU like Z-80 even has an unconditional interrupt, NMI pin.
Your goal is to get that WD running, then FORCE your error.
May be WD is not enabled, but the pcb has WD ic. This the reason boss wont care about, signals WADCH_DOG_EVENT and WADCH_DOG_EV_CLEAR.
Quote
Suggest your code do that start-up, then create a looping routine, it will delay, following each delay it will 'strobe' the WD with intention of keeping it happy.
Have a 'test panel' ? You can compile this short test, but have a way to go in and change that delay loop value, for quick trials, on the bench, avoiding a bunch of repeated compiles.
Idea is to deliberately make the error-timeout plus able to make it NOT time-out, so you can judge.
A ST staff said" Not sure if I got everything right from your problem description, but: The STM32 has an on-chip clock-security-system (CSS) which, when active, will detect failure of your external clock (HSE), switch to internal oscillator (HSI) and generate an interrupt for further software treatment. Moreover, the on-chip independent watchdog (IWDG) is clocked by an independent internal oscillator and can safely reset the MCU. So there is IMHO no need for such a complex external circuitry. Even if you use STWD100 you may connect /WDO to /NRST via a simple 4k7 resistor (as shown in the data sheet)."
Yes. It will be more accusable with real code. Take a look, what do you understand ?
#include "watchdog.h"
IWDG_HandleTypeDef hiwdg;
uint32_t WatchdogReloadCount;
void InitWatchdog(int ReloadCount)
{
WatchdogReloadCount = ReloadCount;
hiwdg.Instance = IWDG;
hiwdg.Init.Prescaler = IWDG_PRESCALER_256;
hiwdg.Init.Reload = ReloadCount;
hiwdg.Init.Window = IWDG_WINDOW_DISABLE;
HAL_IWDG_Init(&hiwdg);
}
void HoldWatchdog(void)
{
hiwdg.Init.Reload = 0xFFF;
HAL_IWDG_Init(&hiwdg);
}
void EnableWatchdog(void)
{
hiwdg.Init.Reload = WatchdogReloadCount;
HAL_IWDG_Init(&hiwdg);
}
void Reload_Watchdog(void)
{
HAL_IWDG_Refresh(&hiwdg);
}