AnsweredAssumed Answered

Debugger Lost Communication with MCU

Question asked by Yi Cui on Aug 14, 2014
Latest reply on Aug 14, 2014 by Norm Davies

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.

SS.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;

}

Outcomes