Debugger Lost Communication with MCU

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

Debugger Lost Communication with MCU

Jump to solution
1,085 Views
yicui
Contributor I

Hi Everyone:

I am a starter with Freescale products. I am working on a LED blinking program.

I found  two lines of port control code would lead to debugger complaining bad communication with MCU.

14114_14114.pngSS.png

With the two port control lines, the code actually is correct because I saw the led blinking after downloading.

However, the break points or stop are not available due to the communication issue.

Without the two port control lines of code, communication problem doesn't occur.  LED will then not blinking because ports not configured correctly

I am using Tower system TWR-K60100M with a MK60DN512VMD10 MCU.

Following is the code.

 

#include "derivative.h" /* include peripheral declarations */

int  main(void)

{

 

  int  counter=0;

  SIM_SCGC5 |= (SIM_SCGC5_PORTA_MASK );   /*clock gating*/

  PORTA_GPCLR=0xFFFF0000|PORT_PCR_DSE_MASK|PORT_PCR_MUX(1) ; /*Port Control*/

  PORTA_GPCHR=0xFFFF0000|PORT_PCR_DSE_MASK|PORT_PCR_MUX(1) ; /*Port Control*/

 

  GPIOA_PDDR=0xFFFFFFFF;

  for(;counter<210000;counter++)

  {

  if(counter<100000){

  GPIOA_PDOR=0xFFFFFFFF;

  }

  else{

  GPIOA_PDOR=0;

  }

  if(counter>200000)

  counter=0;

  }

  while(1);

  return 0;

}

Labels (1)
Tags (2)
0 Kudos
1 Solution
811 Views
ndavies
Contributor V

The debugger talks to the CPU through the JTAG lines on Port A 0-3. When the MCU powers up these lines default to that purpose. Your are reprogramming too many pins on PortA to be GPIO. You need to be more selective in the number of PortA Pins you reconfigure to be GPIO.

Norm Davies.

View solution in original post

0 Kudos
1 Reply
812 Views
ndavies
Contributor V

The debugger talks to the CPU through the JTAG lines on Port A 0-3. When the MCU powers up these lines default to that purpose. Your are reprogramming too many pins on PortA to be GPIO. You need to be more selective in the number of PortA Pins you reconfigure to be GPIO.

Norm Davies.

0 Kudos