asm(stop #2000); problem ColdFire V1

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

asm(stop #2000); problem ColdFire V1

932 Views
zrodik
Contributor I


MFC51JM128 application linked to place the code above 0x3200. When this is programmed by CWarrior (no bootloader) after asm(stop #2000); it stops.

When the same application is loadded by my bootloader (the same s19 file) everything works no problem but after stop #2000 the processor firstly DOES NOT STOP. It does not wakeup immediatelly, IT RESETS.

What can be the cause for RESET after the execution of the instruction stop #2000. Intterupts can only wake up the processor not reset.

In both cases all interrupts are initialized, enabled or disabled the same way.

Labels (1)
Tags (2)
0 Kudos
Reply
3 Replies

719 Views
TomE
Specialist II

So the Bootstrap is programming the CPU differently to the way that CW sets it up to run your program.

You should read the '3.8 Stop Modes" section in the manual as it describes what happens when the STOP instruction executes, and what will happen if you haven't set the CPU up properly before executing "STOP". Specifically the SOPT1 register. So then read the Bootstrap Source code and see if it is writing to SOPT1 at all.

But the most likely (and common by searching this forum) problem is that the Watchdog is running.

Read section "5.3.1 Computer Operating Properly (COP) Watchdog". Try clearing SOPT1[COPT] before your "STOP" instruction and see if the problem goes away.

.

Tom

0 Kudos
Reply

719 Views
zrodik
Contributor I

Thank you Tom for help. It alowed me to look "outside of the box". All settings mentioned here were done correctly but it sliped my attention that the bootloader "touched" the SOPT1 and then when the main application tried to set everything properly it did not take effect because it is one time write register. The case solved. Thank you again.

0 Kudos
Reply

719 Views
TomE
Specialist II

Disabling the watchdog is necessary during development and debugging, but you probably don't want to ship a product like that.

I'd suggest that you program a timer to periodically interrupt the code out of the STOP instruction so it can pat the watchdog in its main loop, or in the interrupt routine, whatever suits your design.

If you're trying to use some of the low power stop modes, then you have to work out how that to program the CPU (bus clock stops in STOP mode) and the Watchdog (using the Bus clock) so they get on together.

Tom

0 Kudos
Reply