Problem with reprogramming the QT4A

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

Problem with reprogramming the QT4A

7,343 次查看
WimmerChris
Contributor I
Hello everybody,
 
i'm a neeby in programming freescale MCUs. At work we have the  MC68DEMOQTY and it was easy to program the MCU. At home i've tried to build a simple circuit. For this i used the AN2305. To programm the MCU i'm using the CW 5.7.
 
With the first program i want to switch the LED on and off by pressing the switch.
 
Code:
#include <hidef.h> /* for EnableInterrupts macro */#include "derivative.h" /* include peripheral declarations */void MCU_init(void){  /*** ### MC68HC908QT4 "Cpu" init code ... ***/  /*** PE initialization code after reset ***/  /* System clock initialization */  /* Common initialization of the write once registers */  /* CONFIG1: COPRS=0,LVISTOP=0,LVIRSTD=0,LVIPWRD=0,LVI5OR3=0,SSREC=0,STOP=0,COPD=1 */  CONFIG1 = 0x01;                                        /* CONFIG2: IRQPUD=0,IRQEN=0,OSCOPT1=0,OSCOPT0=0,RSTEN=0 */  CONFIG2 = 0x00;                                        /* Common initialization of the write once registers */  OSCTRIM = *(unsigned char*far)0xFFC0; /* Initialize OSCTRIM register from a non volatile memory */  /* Common initialization of the CPU registers */  /* PTAPUE: OSC2EN=0 */  PTAPUE &= (unsigned char)~0x80;                                /* ### Init_GPIO init code */  /* PTA: PTA1=1 */  PTA |= (unsigned char)0x02;                                 /* PTAPUE: PTAPUE2=1,PTAPUE1=0 */  PTAPUE = (PTAPUE & (unsigned char)~0x02) | (unsigned char)0x04;   /* DDRA: DDRA1=1 */  DDRA |= (unsigned char)0x02;                                 /* ### */ /* Common peripheral initialization - ENABLE */  /* KBSCR: ACKK=1,IMASKK=0 */  KBSCR = (KBSCR & (unsigned char)~0x02) | (unsigned char)0x04;   asm CLI;                             /* Enable interrupts */} /*MCU_init*/void main(void) {  /* Uncomment this function call after using Device Initialization     to use the generated code */  MCU_init();  EnableInterrupts; /* enable interrupts */  /* include your code here */  for(;;) {    if(PTA_PTA2 == 0) PTA_PTA1 = 1;    __RESET_WATCHDOG(); /* feeds the dog */  } /* loop forever */  /* please make sure that you never leave this function */}

 
After compiling the file i've started the debuger and transfered the program with the Mon08 serial Cable into the MCU. The Configuration was Class 3 calble, Baud Rate: 9600, No Rest button.
During the programming process i've pressed the Button at /IRQ and switched the supply power on and off.
 
When i want to reprogramm the MCU i could not conect to the MCU any longer. The Connection Summary was YNNNN
 
Thank you for your help
 
With best regards
 
Christian Wimmer
 
 
标签 (1)
0 项奖励
回复
9 回复数

1,158 次查看
peg
Senior Contributor IV

Hi Chris,

If you programmed it once and now can't get in this probably is something to do with the fact that
with the QT/Y you can programme a blank part with internal oscillator and no high voltage on
IRQ. But with a non-blank part you need a 9.8MHz crystal and 9 volts on IRQ.

Hope this helps

Regards David

 

0 项奖励
回复

1,158 次查看
WimmerChris
Contributor I

Hi David,

 

this may solve the Problem i will try it, but i don't understand why i could reprogramm the MC68DEMOQTY there was no crystal on the board and there was no problem reprogramming the Board.

thank you

best regards

Chrisitan Wimmer

0 项奖励
回复

1,157 次查看
bigmac
Specialist III

Hello,

Doesn't the MC68DEMOQTY board have boot loader code installed so the user code can be re-programmed without the need for the programming voltage and the crystal?  Of course I could be wrong!  However, if this is so the boot loader code would first need to be programmed to a virgin device (in forced monitor mode), in order to emulate the demo board.

Regards,
Mac

 

Message Edited by bigmac on 2006-08-15 03:12 PM

0 项奖励
回复

1,158 次查看
Lundin
Senior Contributor IV
Yes, the demo board comes with a bootloader program. No new MCUs come with this bootloader. Why someone would want to use a program that emulates using the chip, rather than using the chip as it is ment to be used, is beyond me. Just flash the chip and either build your own MON08 programmer as mentioned in TFM, or buy one from Freescale or P&E.
0 项奖励
回复

1,157 次查看
peg
Senior Contributor IV

Hi all,

Just as a summary for the OP who may be getting a little lost here...

AFAIK everyone is correct here.

There are two main ways to programme these chips (and other similar ones - HC08):

1. Use (or make) a MON08 programmer as I was suggesting.

2. Use a serial bootloader programme. This is some software that you programme into the device (probably with the MON08 programmer in 1.) Then this resident programme accepts the code being downloaded from a serial port and programmes the flash.

It is my opinion that serial bootloaders are not worth bothering with as you are going to need the MON08 type to put the bootloader in in the first place. The only use I see for them is if you want people in the future to update the flash using just a serial cable

Also using a 9.8MHz clock with the MON08 overcomes problems of untrimmed internal oscillators etc

Regards David

 

0 项奖励
回复

1,157 次查看
eckhard
Contributor V
Hello,
 
Bigmac you are right, The MC68DEMOQTY comes with the user Monitor. The Software is described in AN2305 and can be downloaded too. If The device is really Blank, the Oscillator has to be trimmed first. AN2312 shows how to do that or you can read here http://www.eckhard-gosch.de/eng/controller/osctrim.htm
 
The user Monitor is very useful for reprogramming the device in Your application.
Tak care that you shoul use the MC68DEMOQTY stationary in codewarrior to use the user monitor with the alternative interrupt vectors.
 
 
Eckhard
0 项奖励
回复

1,158 次查看
peg
Senior Contributor IV
Hi Chris,
 
Sorry I may have misled you somewhat.
Normally if you are using the internal oscillator in your application you provide a means to inject a 9.8MHz clock (from a canned oscillator?) into PTA5 and to place the high voltage onto PTA2 not neccesarily a crystal on board just for this. This can all be arranged on a full MON08 header as shown in your circuit. If you already have a MAX232 etc on board you can steal the high voltage from there.
 
Regards David
 
0 项奖励
回复

1,157 次查看
WimmerChris
Contributor I

Hi David
thanks for your effords! If i understand you right i could enter the forced monitor mode when the MCU is empty (new)?

Somewhere if've found a Aplication Note created by an engineer form Hongkong in which he descirbes who to build an programmer with an cristal-oscillator. Did you know the Note?

Could you send me an schematic of such an programmer?

 

Thank You
With Best Regards

Christian Wimmer

0 项奖励
回复

1,157 次查看
peg
Senior Contributor IV

Hi Chris,

The schematic is in the datasheet.

In the MON section virtually everything except the MCU you can make off-board then connect to the board to programme. You can add some switches to turn off the high voltage for when the part is blank etc.

Regards David

 

0 项奖励
回复