Debugger Lost Communication with MCU

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Debugger Lost Communication with MCU

跳至解决方案
1,798 次查看
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;

}

标签 (1)
标记 (2)
0 项奖励
回复
1 解答
1,524 次查看
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 项奖励
回复
1 回复
1,525 次查看
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 项奖励
回复