MCF52258 ezport programming problem with watchdog enabled?

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

MCF52258 ezport programming problem with watchdog enabled?

Jump to solution
1,738 Views
leocheng
Contributor II

When I program the unit using SF100 through ezport, there is a issue that programming is failed(checksum error, only part is programmed), as long as the unit has been programmed successfully before.

 

The watchdog is enabled, WCR = 0x1D . When I disable the watchdog, there is no programming problem.

 

When using SF100 to program the unit through ezport, it should assert the external reset pin to reset the unit.

In the datasheet, I saw a description, WCR is a read-always/write-once register; after the register is written, the contents cannot be changed until the next Power-On Reset event occurs.


So my question is,

1. MCF52258 watchdog can't be disabled by external pin reset? Only can be disabled by power-on reset?

2. When ezport is enabled, the MCF52258 is not in any mode(Wait Mode, Doze Mode, Stop Mode)?

Labels (1)
Tags (3)
0 Kudos
1 Solution
1,128 Views
TomE
Specialist II

> 1. MCF52258 watchdog can't be disabled by external pin reset? Only can be disabled by power-on reset?


That's what you've said the manual says and it is exactly what the manual says. So "Yes".


But your problem is really with programming it.

I read "only part is programmed" as saying "the part is programmed", but then re-read it as "it is only partially programmed". So I'm guessing the Watchdog is resetting the chip part way through the programming phase.


When you say "the watchdog is enabled", where is it enabled? In the setup of the programmer or in the PREVIOUSLY LOADED code? If the problem is that your previously-loaded code runs on power-up, enables the watchdog, and then you try to program it without first power-cycling, then the watchdog will bite partway through programming. If that is the case, how do you ever get "watchdog disabled" code in there to then let you program it properly?


> When ezport is enabled, the MCF52258 is not in any mode()?


What is your question? Is in a mode, isn't in a mode or is in what mode? From the manual:

23.2 Modes of Operation

The EzPort can operate in one of two different modes:

• Enabled—When enabled, the EzPort steals access to the flash memory, preventing access from

other cores or peripherals. The rest of the micro-controller is disabled when the EzPort is enabled

to avoid conflicts.

23.3.2.2 EZPCS — EzPort Chip Select

EzPort chip select (EZPCS) is the chip select for signalling the start and end of serial transfers. If EZPCS

is asserted during and when the micro-controller’s reset out signal is negated, then EzPort is enabled out

of reset; otherwise it is disabled.

When EzPort is enabled the CPU is disabled. It is possible the Watchdog is still active.

I would say you need to connect EzPort, have it drive EZPCS low and then power the MCF52258 on (and not just reset it). That way the Micro won't have run any code and won't have enabled the watchdog. Then you should be able to program it properly.

Here's a previous post I found that looks to say that this is the proper way to do it:

https://community.freescale.com/message/457418#457418

    My program does the following:

    do the power on and enable procedure: power off. set cs low. power on

Here's another one saying "Assert EZPCS and then POWER ON":

https://community.freescale.com/docs/DOC-102282

It is possible that when the EzPort disables the CPU it may put it in STOP, DOZE or WAIT mode, and the mode might be visible to the Watchdog. So maybe programming the watchdog with one of STOP/WAIT/DOZE will stop it from interrupting EzPort programming. That may be another solution.

There's nothing I can find in the manual to say if that is the case. The only way to find out would be for you to TEST this yourself. I'd suggest writing code to enable the Watchdog, but with STOP/WAIT/DOZE bit all set. Program that. Then see if you can program it again with that code having run. If you can, try again to find out which single bit allowed you to do this and then POST that back here.

But from all my reading of previous posts you're meant to POWER CYCLE the board into EzPort mode, and that simply resetting it doesn't work and can't be expected to work.

Here are some more previous posts on EzPort you should read (just type "EzPort" into the Search Field like I did):

https://community.freescale.com/message/331401#331401

https://community.freescale.com/message/27887#27887

The last one above details lots of other things that go wrong. You have to erase THEN PROGRAM without Resetting between.

Tom

View solution in original post

0 Kudos
6 Replies
1,129 Views
TomE
Specialist II

> 1. MCF52258 watchdog can't be disabled by external pin reset? Only can be disabled by power-on reset?


That's what you've said the manual says and it is exactly what the manual says. So "Yes".


But your problem is really with programming it.

I read "only part is programmed" as saying "the part is programmed", but then re-read it as "it is only partially programmed". So I'm guessing the Watchdog is resetting the chip part way through the programming phase.


When you say "the watchdog is enabled", where is it enabled? In the setup of the programmer or in the PREVIOUSLY LOADED code? If the problem is that your previously-loaded code runs on power-up, enables the watchdog, and then you try to program it without first power-cycling, then the watchdog will bite partway through programming. If that is the case, how do you ever get "watchdog disabled" code in there to then let you program it properly?


> When ezport is enabled, the MCF52258 is not in any mode()?


What is your question? Is in a mode, isn't in a mode or is in what mode? From the manual:

23.2 Modes of Operation

The EzPort can operate in one of two different modes:

• Enabled—When enabled, the EzPort steals access to the flash memory, preventing access from

other cores or peripherals. The rest of the micro-controller is disabled when the EzPort is enabled

to avoid conflicts.

23.3.2.2 EZPCS — EzPort Chip Select

EzPort chip select (EZPCS) is the chip select for signalling the start and end of serial transfers. If EZPCS

is asserted during and when the micro-controller’s reset out signal is negated, then EzPort is enabled out

of reset; otherwise it is disabled.

When EzPort is enabled the CPU is disabled. It is possible the Watchdog is still active.

I would say you need to connect EzPort, have it drive EZPCS low and then power the MCF52258 on (and not just reset it). That way the Micro won't have run any code and won't have enabled the watchdog. Then you should be able to program it properly.

Here's a previous post I found that looks to say that this is the proper way to do it:

https://community.freescale.com/message/457418#457418

    My program does the following:

    do the power on and enable procedure: power off. set cs low. power on

Here's another one saying "Assert EZPCS and then POWER ON":

https://community.freescale.com/docs/DOC-102282

It is possible that when the EzPort disables the CPU it may put it in STOP, DOZE or WAIT mode, and the mode might be visible to the Watchdog. So maybe programming the watchdog with one of STOP/WAIT/DOZE will stop it from interrupting EzPort programming. That may be another solution.

There's nothing I can find in the manual to say if that is the case. The only way to find out would be for you to TEST this yourself. I'd suggest writing code to enable the Watchdog, but with STOP/WAIT/DOZE bit all set. Program that. Then see if you can program it again with that code having run. If you can, try again to find out which single bit allowed you to do this and then POST that back here.

But from all my reading of previous posts you're meant to POWER CYCLE the board into EzPort mode, and that simply resetting it doesn't work and can't be expected to work.

Here are some more previous posts on EzPort you should read (just type "EzPort" into the Search Field like I did):

https://community.freescale.com/message/331401#331401

https://community.freescale.com/message/27887#27887

The last one above details lots of other things that go wrong. You have to erase THEN PROGRAM without Resetting between.

Tom

0 Kudos
1,128 Views
leocheng
Contributor II

1. If that is the case, how do you ever get "watchdog disabled" code in there to then let you program it properly?


Yes, that is exactly the case. The S19 file is a integrated file, including bootloader and application two parts. In the application, the watchdog is enabled. A virgin unit is powered on firstly,  and program unit with programmer(SF100), everything is OK.

But after second power-cycling with that code having run, programming unit is failed, and power it on thirdly, then the unit stays in bootloader (bootloader will check the integrity of application, if it's not integrated, unit will stay in bootloader, the led quickly blinking denotes this), not enter into application, so the watchdog is not enabled, and now programming unit is OK.

I did the test that, disable the watchdog in application code, and doing the above procedure, everything is OK.

2. I have done the TEST, writing code to enable the Watchdog, but with STOP/WAIT/DOZE bit all set. There is also a problem when programming.

So from the above, we can draw a conclusion that the watchdog is resetting the chip part way through the programming phase, and this causes that the unit is only partially programmed. At least, the bootloader is programmed.

1,128 Views
TomE
Specialist II

So you know what's going wrong. That was pretty obvious.


The base problem is that you're trying to program it without power cycling it.


Can you change your programming to always power-cycle with EZPCS low? That looks to be the only supported programming method.

Tom

0 Kudos
1,128 Views
leocheng
Contributor II

It's too bad. The programmer(SF 100) we use belongs to a third-party vendor. It does not support this function. In the short time, changing the programmer tool is not possible. So we will seek other ways.

0 Kudos
1,128 Views
TomE
Specialist II

Reading the Eltan Documentation, all you may need to do to obey the CF specifications and program this properly is to add a pull-down resistor on the EZPCS signal on the programming cable. So that means you plug the programmer cable on with the board turned off (as you must do) and then power the board on. The pull-down means the CPU has now powered on with EZPCS pulled low and it will be properly reset with the watchdog disabled. Then you run the programmer software which actively drives its I/O output pins (two high, two low) and then drives the chip-select pin high. That should then work properly all the time.

Tom

1,128 Views
leocheng
Contributor II

Sorry for a mistake, the programmer(SF100) probably has a 10k pull-down resistor on the EZPCS signal as I measure the resistance with a multimeter. As you say, I follow these steps:  I plug the programmer cable on with the board turned off, and then power the board on. Then I connect the programmer with a PC, and run programmer software to program. It works well. The order can't be changed, otherwise, it doesn't work.

0 Kudos