View previous topic :: View next topic |
Author |
Message |
rigomm
Joined: 17 Mar 2010 Posts: 13
|
How to disable the FWDTEN? |
Posted: Wed Mar 17, 2010 5:22 am |
|
|
Hello to everybody.
I´m trying to implement a simple flashing LED program using the dsPIC30F3012 and the compiler is the PCWHD ver. 4.102.
The LED flashing according to the time I set but the dsPIC is reseted every few seconds.
After a carefully revision I realized that disabling the FWDTEN bit, the problem is fixed.
The problem is that, I have to disable this FWDTEN bit manually in the programmer software (winpic800) every time I want to load the hex file.
Of course I´m using the directive:
#fuses NOWDT since the beginning but it seem not have any effect in the hex file.
Below is the code I'm using.
Code: |
//Program to flashing a LED connected in the PB0.
//Xtal speed 20MHz in pin (6-7).
#include <30F3012.h>
#FUSES HS2_PLL8
#FUSES NOWDT // NO Watch Dog Timer
#FUSES PR_PLL //Primary Oscillator
#FUSES NOCKSFSM
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRT //Program memory not write protected
#use delay(clock=80000000)
#use rs232(baud=115200, UART1)
void main() {
printf("Press any key to begin");
getchar();
printf("1 Hz signal activated");
while (TRUE) {
output_high(PIN_B0);
delay_ms(500);
output_high(PIN_B0);
delay_ms(500);
}
} |
Note that the FWDTEN is never disable.
Please, if anyone have an idea how to fix this, please, help me!
Thanks in advance! |
|
|
LostInSpace
Joined: 09 Mar 2010 Posts: 13
|
|
Posted: Wed Mar 17, 2010 7:53 am |
|
|
The WinPic programmer is probably not programming the fuse bits correctly. You should contact them.
You can also run tests to see if this is true - program the device with the NOWDT. Burn the bits, then read the bits back and check the fuse settings.
Do the same with the WinPic programmer - this should prove who is setting the fuses (or not).
HTH - Steve H. _________________ HTH - Steve H. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19543
|
Ttelmah |
Posted: Wed Mar 17, 2010 8:10 am |
|
|
Have you actually looked at the generated .LST, to see what the compiler is generating?.
If I do, with 'WDT', I see:
Code: |
Configuration Fuses:
Word 1L: C712 NOCKSFSM HS2_PLL8 PR_PLL
H: 0000
Word 2L: 8030 WDT WPSB1 WPSA512
H: 0000
|
While with 'NOWDT', I see:
Code: |
Configuration Fuses:
Word 1L: C712 NOCKSFSM HS2_PLL8 PR_PLL
H: 0000
Word 2L: 0030 NOWDT WPSB1 WPSA512
H: 0000
|
The compiler is correctly setting bit 15 of the second word in the configuration file, to reflect the watchdog being enabled/disabled.
If I load this into MPLAB, the watchdog is correctly disabled.
It would appear the problem is not with the compiler, but with the WinPic programmer....
I see another has posted while I am typing, with the same comment.
Best Wishes |
|
|
rigomm
Joined: 17 Mar 2010 Posts: 13
|
|
Posted: Thu Mar 18, 2010 2:55 am |
|
|
Ttelmah and LostInSpace, thank you so much for your time and help!
You are right, the .LST file and the configuration bits window in MPLAB
both shows the change according to the settings in the compiler.
The WINPIC8000 burn the bits correctly if I configure them manually, then, as you say, the problem should be the WINPIC8000 that can not read correctly the settings from the .hex file.
Now I don't have another programmer to assure if the WINPIC8000 is the problem but this seems to be the most likely.
I'll contact to WINPIC800 programmer.
Thanks a lot for your quick help! |
|
|
|