View previous topic :: View next topic |
Author |
Message |
MCUprogrammer
Joined: 08 Sep 2020 Posts: 221
|
WDT |
Posted: Thu Jan 26, 2023 5:22 am |
|
|
How WDT works.
How can I tell if WDT is engaged?
Does the MCLR or Supply voltage reset momentarily when the WDT is activated? What does reset PIC mean? _________________ Best Regards...
MCUprogrammer
_______________________________
Work Hard |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Thu Jan 26, 2023 7:06 am |
|
|
You'll need to read the datasheet section that contain the WDT information for whatever PIC you're using.
How they work depends on which PIC. Early ones only had a 'fuse',a small chain divider and a huge range in 'timing'. New ones can be programmed 'on the fly' and have more features and 'tighter' timing (though NOT to be used as accurate ! ).
All WDT operate is a similar mode. You program the WDT to 'trigger' after the program fails to complete it's normal program within a certain time period.
Say it takes a PIC 2.5 seconds to read sensors,do some math, display the data,control a few LEDs and then loop to start again. You might configure the WDT to 'trigger' after 3.5 seconds.
You ONLY need to use/configure the WDT AFTER 100% of the code is working ,when the product is ready to be shipped out to clients. |
|
|
MCUprogrammer
Joined: 08 Sep 2020 Posts: 221
|
|
Posted: Thu Jan 26, 2023 7:31 am |
|
|
CCS C 5.114
The processor I am using is dsPIC33EV256GM104.
The only code I wrote;
setup_wdt(WDT_1MS);
While(TRUE) loop time: 45us
Timer2 ISR : 1us;
ADCReading Function: 1.8us
I didn't write any other code. I wrote this code in main() function. I don't think any fuse setting is required. The compiler adjusts when it sees this code.
I'm having a cpu crashing problem. But what I'm trying to figure out is exactly what wdt does. In other words, when I press the button connected to the MCLR and reset the processor, the processor recovers. I want wdt() to solve this instead of pressing the button when it is locked. Is this possible?
Also, when I use VSS_VDD on DSPIC30F3014 and dsPIC33EV256GM104 processor, it reads 0.78 or 0.88 while it should read "1Bar". I measured it with an avometer. Correct voltage information is coming to the analog input. When I measure the VDD voltage, I see 5.05V. But the reading error rate is very high. Does using internal feeding affect the situation that much? And anywhere in the Datasheet does the sensitivity of using Internal VSS_VDD in the ADC be written? And where is it written? I looked but couldn't find it. Or how do I access information about the accuracy rate it reads when I use VSS_VREF. _________________ Best Regards...
MCUprogrammer
_______________________________
Work Hard |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Thu Jan 26, 2023 9:27 am |
|
|
1st, I don't use any dsPICs but...
'crashes'... if you disable the WDT does it still crash ? If so NOT a WDT cause.
dsPICs ( all high speed PICs really ) NEED all the caps that the datasheet says. EVERY pair of VDD-VSS pins need caps AT the pins.
ADC . using VDD-VSS as the ADC reference is really bad, especially if the ADC is more than 8 bits ! Also you NEED whatever bypass caps the datasheet says as well.
WDT just because you 'setup' the WDT doesn't mean it is 'enabled'. Newer PICs allow you to control (enable/disable ) the WDT. Again, read the datasheet to see what options are allowed.
I suspect you have a 'noise' problem. Not enough bypass caps, PSU design error, PCB layout, or ????
Does it perform an '1Hz LED' program flawlessly for 10 minutes ? |
|
|
MCUprogrammer
Joined: 08 Sep 2020 Posts: 221
|
|
Posted: Sat Jan 28, 2023 1:48 am |
|
|
thank you[/code] _________________ Best Regards...
MCUprogrammer
_______________________________
Work Hard |
|
|
|