Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Watchdog fuse bit
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
laborratte

Bascom Expert



Joined: 27 Jul 2005
Posts: 305
Location: Berlin

germany.gif
PostPosted: Sat Sep 10, 2016 1:33 pm    Post subject: Reply with quote

Hi Mark,

a $NOWD option would also change the timing, as you than have to move the _initmicro call after save & change of MCUSR (which is mandatory for watchdog changes as I understand the datasheets).

If you want to keep the timing for most users maybe a $YOU_CAN_CONFIG_WATCHDOG_IN_INITMICRO_BUT_WITH_CHANGED_TIMING option, which toggels the _initmicro call from actual position to the position O-Familiy suggest. Then the users with "huge memory, slow clock and always watchdog on" can config the watchdog at a early stage. All other get the fastest _initmicro as possible.

Maybe you find a better name for the option....
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 6197
Location: Holland

blank.gif
PostPosted: Fri Sep 30, 2016 9:50 am    Post subject: Reply with quote

Hello O-Family

ok, i get the problem. when the fuse is set, the wd is always on. even while the compiler turns it off, it will not respond to that.
i moved the disabling of the WD before the init_micro call. please test it, it is in the SLA area.
the few extra cycles (depending on the chip) are nothing compared to the startup time of the oscillator so i that will not be a real problem.

_________________
Mark
Back to top
View user's profile Visit poster's website
O-Family

Bascom Expert



Joined: 23 May 2010
Posts: 338
Location: Japan

japan.gif
PostPosted: Sun Oct 02, 2016 12:35 am    Post subject: Reply with quote

Hi Mark

Reports.
This problem was resolved in 2.0.8.0 of the SLA.
Modifications will be helpful.

Best regards
O-Family

Code:

$prog &HFF , &HF7 , &HC9 , &HFD                             'Fuse bytes. (WDTON = 0)

$regfile = "m2560def.dat"
$crystal = 16000000
$hwstack = 128
$swstack = 128
$framesize = 128

'$initmicro                                                  'It is solved by $initmicro.

   Waitms 20                                                'Unexpected latency. (If you exceed 16ms)

   Config Watchdog = 1024
   Reset Watchdog

   Config Portb.7 = Output                                  'Arduino Mega 2560 LED.

   Do
      Reset Watchdog
      Toggle Portb.7                                        'LED blink at 1-second intervals.
      Wait 1
   Loop


_init_micro:                                                'Solutions $initmicro.
   Config Watchdog = 1024
   Return

   End
 
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 6197
Location: Holland

blank.gif
PostPosted: Thu Oct 06, 2016 10:05 am    Post subject: Reply with quote

thanks for testing and letting me know.
_________________
Mark
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum