QG8 stand alone problem,please help

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

QG8 stand alone problem,please help

3,845件の閲覧回数
HarrySun
Contributor I
I used QG8 on my own board which works perfectly in debugging mode,but when I trun off the power and disconnected the 6-pin cable, then turn on the power, the stand-alone QG8 board doesn't work at all.
in the code, I tried disabling debugging mode but it doesn't help.
I also tried reprogramming qg8 using expert mode programmer,it doesn't help either.
is there something I need to change when i switch to stand alone mode from debugging mode?
any input is highly appreciated.
 
Harry
 
ラベル(1)
0 件の賞賛
返信
8 返答(返信)

982件の閲覧回数
HarrySun
Contributor I
Hello, All,
 
thanks all for the inputs.
I identified the problem but don't know why and still waiting for an answer from tecnical support,but I can't wait.
thanking you all in advance.

I have commented out all my code in main.c and

put blinking code from technical support,then I found something like this:

as long as I put "STOP" line in the code , the qg8 doesn't work alone.

in debugging mode, the MCU stops there (at "stop line")until an

interrupt signal at PTA5 to wake it up;then I see the flickering at

pin6;

while in stand-alone mode, I can't see the flickering after the

interrupt signal has been generated like what I did in debugging mode.

if I remove the "stop" line(entering stop), everything works,I don't know what I did

wrong in the code or misunderstanding the stop mode??

please see the simplified code below,

 

void init_sysopt (byte COP_Option) {

switch (COP_Option){

case 0: SOPT1 = 0x62;break; //62-debug mode;60 normal /* COP disabled */

case 1: SOPT1 = 0xE2;break; /* COP enabled */

default:break;

}

SOPT2 = 0X01;

SPMSC1 = 0x65;

}

void InitRTI() {

// SRTISC = 0b01110001;

SRTISC = 0b01110000; //disable RTI while debugging

/* ||||||||

|||||+++-- RTIS = RTI delay select: 001=8 msec

||||+----- unimplemented

|||+------ RTIE = RTI int enable: 1=enabled

||+------- RTICLKS = RTI clock select: 1=external src

|+-------- RTIACK = RTI flag acknowledge

+--------- RTIF = RTI flag

*/

}

void init_portpullup (void) {

PTAPE = 0xff;

PTBPE = 0xff-PTBPE_PTBPE6_MASK;

PTASE = 0x00;

PTADS = 0x00;

}

void incs_init (byte c1,byte c2){

byte i;

if (NVICSTRM != 0xff){

ICSTRM = NVICSTRM;

}

ICSC1 =c1;

for (i=0;i<=0x10;i++){

__RESET_WATCHDOG ();

}

ICSC2 = c2;

/*ICSC2_BDIV = 3;*/

while (ICSC1_CLKS != ICSSC_CLKST){

}

}

/* MTIM initialization */

void mtim_init (void) {

MTIMCLK = 0x08;

MTIMMOD = 0xff;

MTIMSC = 0x60;

}

 

/* STOP initialization */

void stop_init (byte mode) { /* to choose which stop mode to enter */

switch (mode) {

case 1: SPMSC2 = 0X02 ; break;

case 2: SPMSC2 = 0X03 ; break;

case 3: IRQSC =0x17; break;

}

}

/* STOP entering */

void stop_enterring (void){

asm ("stop");

}

 

 

/* IRQ initialization */

void init_IRQ (void) {

IRQSC = 0b00010010; /* enable interrupt;*/

}

/* MCU ports initialization */

void mcu_init (void){

GreenLed =0; //PTBD_PTBD7 = 0;

PTBDD_PTBDD7 = 1;

RedLed = 0; //PTBD_PTBD6 = 0;

PTBDD_PTBDD6 = 1;

charger_control = charger_off; //PTBD_PTBD5 = 1;

PTBDD_PTBDD5 = 1;

Xfer =0; // PTBD_PTBD4 = 0;

PTBDD_PTBDD4 = 1;

PTBDD_PTBDD3 = 0;

PTBDD_PTBDD2 = 0;

PTBDD_PTBDD1 = 0;

PTBDD_PTBDD0 = 0;

PTADD_PTADD0 = 0;

PTADD_PTADD2 = 0;

BuzzerControl = 0; //PTAD_PTAD3 = 0;

PTADD_PTADD3 = 1;

/*PTADD_PTADD4 = 1;*/

/* KBIPE_KBIPE2 = 1;

KBISC_KBIE = 1;

KBISC_KBACK = 1; */

/*PTAPE_PTAPE2 = 1;*/ /*if enabling this one,could get rid of extern resitor */

SPMSC1_BGBE = 1; /* bandgap enabling */

}

void AllInOneINI(void){

init_sysopt(COP_Disabled); //start with COP disablbed

/*ICSC2_BDIV = 3;*/

incs_init (0x05,0xc0); /* FLL output as Clock source,divided by 8:1M bus frequency */

mcu_init ();

init_portpullup ();

adc_ini();

init_IRQ ();

stop_init(1);

}

void main(void) {

AllInOneINI(); ///start with COP disabled, shut down output for safety

/// everything else has to start after INI//

stop_enterring(); //need a calendar here and first test be done 12 hours after installation

EnableInterrupts; /* enable interrupts */

PTBDD_PTBDD6 = 1; //set data direction to out

for(;:smileywink: {

PTBD_PTBD6 = 0;

PTBD_PTBD6 = 1;

__RESET_WATCHDOG(); /* feeds the dog */

}

}

 

 

0 件の賞賛
返信

982件の閲覧回数
microjock
Contributor I
That in my opinion is unusual. I have several projects running with the QG8, most battery powered but at least one is powered via a wall transformer. All are working well without any special pullups. I use PC boards with good ground planes. I usually don’t use the two BDM programming pins for anything in my ap. Try using known good software, something like the blinking LED example that comes with Codewarrior. Something where the vectors are not being changed and where the watchdog is being properly reset. If you still have the problem I would begin to suspect a bad IC. You may have had ESD damage. I usually order at least a couple IC’s when I start out working with something new. If you’ve ever worked with the QY series, the QG series is a huge improvement. Now if the rest of the world would get down to the 3 volt level.
0 件の賞賛
返信

982件の閲覧回数
Wings
Contributor I
If you have the COP timer enabled, are you resetting it often enough?
0 件の賞賛
返信

982件の閲覧回数
Wings
Contributor I
Is it possible that you have no pullup on either the reset pin or the BKGD pin?

I can't think of a software issue that would cause this.
0 件の賞賛
返信

982件の閲覧回数
HarrySun
Contributor I
Wings,
thanks for your prompt reply.
on reset pin ,I have a external 5.1k pullup all the time;
for the BKGd pin ,I connected it to VDD in non-debugging mode.
but QG8 refuses working alone,strange enough.
0 件の賞賛
返信

982件の閲覧回数
Alban
Senior Contributor II
Reset Vector initialized ?
Voltage on Reset pin over time ? (pull-up does not mean it's high)
0 件の賞賛
返信

982件の閲覧回数
HarrySun
Contributor I
Alban,
 
thanks for your input.
how to initialize reset vector?I looked up it in the datasheet and didn't find any info.about initializing the vector.
 
thanks
0 件の賞賛
返信

982件の閲覧回数
peg
Senior Contributor IV
Hi Harry,
 
Initialising the reset vector means programming the 16-bit address value of the place in memory that you would like execution to begin. For instance if you labelled that place Init then:
 
ORG    $FFFE
DW      INIT
 
would achieve that.
 
But if you are just hitting run in the simulator and it goes then this is probably already done.
 
Do you have the COP either properly handled or disabled?
 
0 件の賞賛
返信