MCF51QM128 - reset after BDM GO command

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

MCF51QM128 - reset after BDM GO command

1,325 Views
guide19
Contributor II

Hi there,

I am programming the MCF51QM128 device with my programmer, but some of the devices are not programmed corectly.

The problem is that after loading the bootloader to RAM and starting BDM GO command, the MCU is reset. The reset pin is tied low after around 5-6us. The reset stay in low position for about 86us. Can you please advice how to check what is causing this reset?

I have some devices that are working ok with the bootloader and are programmed and thwere are few MCU which does not.

BR,

Jozef

Labels (1)
0 Kudos
7 Replies

914 Views
TomE
Specialist II

> unsigned char cEraseConfigSector;

When the above variable is a Global, since you're not initialising it (in its declaration), the compiler puts it into the "bss" area of the load image. This area is always meant to be zeroed when your program starts. So it always starts as being zero. It is also possible your startup code is failing to initialise the bss - this has to be done explicitly in the loading or the initialisation code.

When the above variable is Local, it is on the stack. It has no defined initial value, so has to be initialised.

You've provided some "sample code", but not enough to see how you're really using it in the code that is giving problems.

If you are initialising this variable properly in both Global and Local cases, then check the Memory Map and see what address the compiler has used for the global. Check that it is within the memory for that CPU. Check that it doesn't overlap some other use of that memory in some other part of your code.

> loading the bootloader to RAM and starting BDM GO command, the MCU is reset

Why not single-step it and see how far it gets before it resets? If there's a reason why you can't do that, add breakpoints to the code and see if it gets to them. If it does, try again moving the breakpoint further "ahead" in the code.

Tom

0 Kudos

914 Views
guide19
Contributor II

I am using my own board and CW 10.7. I have find that one variable is causing this problem.

But it is weird because it is not for all MCU. Just influence couple of them.

When the variable is global then it is not 100% functioning.

When the variable is local then it is working fine.

Here is my part of code which one is sometimes causing the problem:

#include <hidef.h> /* for EnableInterrupts macro */
#include <mcf51qm32.h>

#define true             1
#define false            0

unsigned char cEraseConfigSector;

/***************************************************/

void main(void) {

/***************************************************/
    //unsigned char cEraseConfigSector;

    cEraseConfigSector = true; //this code causes reseting the MCU
    
  for(;;) {
      while(1);
  }  /*endless loop*/
}    /*end of main*/  
/***************************************************/

and here is modified OK code:

#include <hidef.h> /* for EnableInterrupts macro */
#include <mcf51qm32.h>

#define true             1
#define false            0

//unsigned char cEraseConfigSector;

/***************************************************/

void main(void) {

/***************************************************/
    unsigned char cEraseConfigSector;

    cEraseConfigSector = true;//here it is ok because the variable is local
    
  for(;;) {
      while(1);
  }  /*endless loop*/
}    /*end of main*/  
/***************************************************/

Could you please advice what can be wrong that global variable is sometimes causing reset of the MCU?

BR,

Jozef

0 Kudos

914 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Jozef,

According to reference manual. all the reset sources are listed below:

https://www.nxp.com/docs/en/reference-manual/MCF51QM128RM.pdf

pastedImage_4.png

If it's possible, please check SRS register for reset source of your case. and then shoot trouble accordingly.

SW resets are highlight above. If the reset is caused by SW, it may be ILOP or ILAD reset.

when cEraseConfigSector is defined as local variable, it is allocated in stack

when cEraseConfigSector is defined as global variable, it is allocated in RAM.

Thus can you please check the memory address of cEraseConfigSector ? Is it a valid address?

I know some customer had similar problem because of stack over flow, increase stack size in linker config file can fix the problem. You may also have a try.


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

914 Views
guide19
Contributor II

And do you have any idea or opininon, why on one MCU it is a problem and on the other it is not?

Simply speaking it is not "reliable" mistake. Some devices have problem with the same code and some devices don't.

0 Kudos

914 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

If the same code works well on one board but not on the other, the problem could also be HW side.

I suggest check SRS status for the reset source.

It's hard to confirm the problem source without reproduction.please send us the demo project, thus we can check the code directly.

Jennie Zhang

0 Kudos

914 Views
guide19
Contributor II

I am afraid of reproduction of the problem only with demo project, without the MCU which are "not OK".

0 Kudos

914 Views
miduo
NXP Employee
NXP Employee

Hi,

Please let me know what board you used? It is customer board or our evaluation board? And what IDE & debugger used?

0 Kudos