Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Watchdog not stopping

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
altron

Bascom Member



Joined: 10 Mar 2008
Posts: 10

australia.gif
PostPosted: Thu Nov 19, 2020 1:26 am    Post subject: Watchdog not stopping Reply with quote

Hi

I had a problem with the Watchdog not stopping with the STOP WATCHDOG command with a XM128a1.

Example of not working.

Code:
Disable Jtag

$prog &HFF , &HFF , &H00 , &HFE , &H00 , &HFF , &HFB        ' generated. Take care that the chip supports all fuse bytes.

$regfile = "xm128a1def.dat"
$crystal = 32000000                                         '32MHz
$hwstack = 128
$swstack = 128
$framesize = 128

Config Osc = Enabled , Pllosc = Disabled , Extosc = Disabled , 32khzosc = Disabled , 32mhzosc = Enabled , 32khzpowermode = Low_power       '32MHz

Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1  '32MHz

Config Priority = Static , Vector = Application , Lo = Enabled , Med = Enabled , Hi = Enabled

Config Eeprom = Mapped

Active_led Alias Portf.5
Config Active_led = Output


Waitms 500


Active_led = 1                                                   'led

Waitms 2000                                                

Config Watchdog = 4000                                      'reconfig to 4 sec
Start Watchdog
Active_led = 0
Stop Watchdog   '<<<<<<This dosent stop the watchdog
Active_led = 1



Do
   Toggle Active_led
   Waitms 100
Loop



The watchdog takes sometime to sync with the system clock after being enabled. You need to wait till the SYNC bit is reset before stopping.

Example of working:

Code:
Disable Jtag

$prog &HFF , &HFF , &H00 , &HFE , &H00 , &HFF , &HFB        ' generated. Take care that the chip supports all fuse bytes.

$regfile = "xm128a1def.dat"
$crystal = 32000000                                         '32MHz
$hwstack = 128
$swstack = 128
$framesize = 128

Config Osc = Enabled , Pllosc = Disabled , Extosc = Disabled , 32khzosc = Disabled , 32mhzosc = Enabled , 32khzpowermode = Low_power       '32MHz

Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1  '32MHz

Config Priority = Static , Vector = Application , Lo = Enabled , Med = Enabled , Hi = Enabled

Config Eeprom = Mapped

Active_led Alias Portf.5
Config Active_led = Output


Waitms 500


Active_led = 1

Waitms 2000                                                 'led

Config Watchdog = 4000                                      'reconfig to 2 sec
Start Watchdog
Active_led = 0
Gosub Stop_watchdog
Active_led = 1



Do
   Toggle Active_led
   Waitms 100
Loop



Stop_watchdog:
   Do
      If Wdt_status.0 = 0 Then
         Exit Do
      End If
      Waitms 1
   Loop                                                     'Until Wdt_status.0 = 0
   Stop Watchdog
Return


(BASCOM-AVR version : 2.0.8.2 , Latest : 2.0.8.3 )
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5093
Location: Holland

blank.gif
PostPosted: Thu Nov 19, 2020 11:25 am    Post subject: Reply with quote

thanks, i will check it and change it when required.
_________________
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
Page 1 of 1

 
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