Hello, My program for the 912DG128 chip (using P&E's Dev-Dg128 development board) runs fine if I am running P&E's ICD12Z debugger, but locks up after 1 second every time if I run the chip by itself. I've stripped a lot of code out, and have rearranged things, and find that the chip locks up independent of program location; rather, it's consistently after 1 second. I don't think I have any interrupts enabled that aren't serviced. This is my program. I am using IAR C for 68HC12. Under ICD12Z, I get a continuous stream of A's and B's alternating 1 second apart. When I reset on poweron with no debugger, The chip sends a string of A's, then locks up after about 10 B's. I'm losing my mind! Can anyone suggest what might be going wrong here? Should I explicitly turn off interrupts instead of allowing them to default out of reset? Thanks! Justin Dobbs #include <i912d128.h> #include <intr6812.h> #include <r912d128.h> #include <stdio.h> void setup (void) { MCCTL = 0xc4; (*(uint *)(&MCCNTH))00; /* Downcounter period for 1mS */ DDRS=0xCA; /* 9600 baud serial transmit */ SC0BDH=0; SC0BDLR; SC0CR1=0x00; SC0CR2=0x08; /* no interrupts, transmit, no receive */ } uint mstime=0x0000; /* Redeclare this at the top to use */ uint sectime=0x0000; uchar txbuf[0x80]; uchar txi=0, txo=0; int putchar (int c) { c&=0x00ff; txbuf[txi]=c; txi=(txi+1)&0x7f; return c; } void interrupt MC_interrupt (void) { ++mstime; if (!(mstime&0x3ff)) ++sectime; /* 1024 milliseconds, so slightly longer than actual seconds */ /* Ser tx */ if (SC0SR1&0x80 && (txi!=txo)) { SC0DRL=txbuf[txo]; txo=(txo+1)&0x7f; } MCFLG |= 0x80; /* Clr flg */ } void main (void) { /* Set up initial hardware */ setup(); enable_interrupt(); printf("Hello...\r\n"); for (;;) { if (!(sectime&0x01)) { printf("A"); } else { printf("B"); } } } |
|
DG128 locks up after 1 second
Started by ●July 25, 2003
Reply by ●July 25, 20032003-07-25
Hi Justin -- I suspect that you are seeing a different due to running in BDM mode vs single chip mode. There are a few registers that behave differently. I know that this is not a lot of help, but perhaps it will give you a direction. 607-656-2597 -----Original Message----- From: mstrbelvedere [mailto:] Sent: Friday, July 25, 2003 3:23 PM To: Subject: [68HC12] DG128 locks up after 1 second Hello, My program for the 912DG128 chip (using P&E's Dev-Dg128 development board) runs fine if I am running P&E's ICD12Z debugger, but locks up after 1 second every time if I run the chip by itself. I've stripped a lot of code out, and have rearranged things, and find that the chip locks up independent of program location; rather, it's consistently after 1 second. I don't think I have any interrupts enabled that aren't serviced. This is my program. I am using IAR C for 68HC12. Under ICD12Z, I get a continuous stream of A's and B's alternating 1 second apart. When I reset on poweron with no debugger, The chip sends a string of A's, then locks up after about 10 B's. I'm losing my mind! Can anyone suggest what might be going wrong here? Should I explicitly turn off interrupts instead of allowing them to default out of reset? Thanks! Justin Dobbs #include <i912d128.h> #include <intr6812.h> #include <r912d128.h> #include <stdio.h> void setup (void) { MCCTL = 0xc4; (*(uint *)(&MCCNTH))00; /* Downcounter period for 1mS */ DDRS=0xCA; /* 9600 baud serial transmit */ SC0BDH=0; SC0BDLR; SC0CR1=0x00; SC0CR2=0x08; /* no interrupts, transmit, no receive */ } uint mstime=0x0000; /* Redeclare this at the top to use */ uint sectime=0x0000; uchar txbuf[0x80]; uchar txi=0, txo=0; int putchar (int c) { c&=0x00ff; txbuf[txi]=c; txi=(txi+1)&0x7f; return c; } void interrupt MC_interrupt (void) { ++mstime; if (!(mstime&0x3ff)) ++sectime; /* 1024 milliseconds, so slightly longer than actual seconds */ /* Ser tx */ if (SC0SR1&0x80 && (txi!=txo)) { SC0DRL=txbuf[txo]; txo=(txo+1)&0x7f; } MCFLG |= 0x80; /* Clr flg */ } void main (void) { /* Set up initial hardware */ setup(); enable_interrupt(); printf("Hello...\r\n"); for (;;) { if (!(sectime&0x01)) { printf("A"); } else { printf("B"); } } } -------------------- ">http://docs.yahoo.com/info/terms/ |
Reply by ●July 25, 20032003-07-25
locks up after 1 second? it sends string of A's then 10 B's t = (string + 10) seconds Nick > -----Original Message----- > From: mstrbelvedere [mailto:] > Sent: Friday, July 25, 2003 3:23 PM > To: > Subject: [68HC12] DG128 locks up after 1 second > Hello, > > My program for the 912DG128 chip (using P&E's Dev-Dg128 development > board) runs fine if I am running P&E's ICD12Z debugger, but locks up > after 1 second every time if I run the chip by itself. I've stripped > a lot of code out, and have rearranged things, and find that the chip > locks up independent of program location; rather, it's consistently > after 1 second. > > I don't think I have any interrupts enabled that aren't serviced. > This is my program. I am using IAR C for 68HC12. Under ICD12Z, I get > a continuous stream of A's and B's alternating 1 second apart. When I > reset on poweron with no debugger, The chip sends a string of A's, > then locks up after about 10 B's. > > I'm losing my mind! Can anyone suggest what might be going wrong > here? Should I explicitly turn off interrupts instead of allowing > them to default out of reset? > > Thanks! > > Justin Dobbs > > #include <i912d128.h> > #include <intr6812.h> > #include <r912d128.h> > #include <stdio.h> > > void setup (void) > { > MCCTL = 0xc4; > (*(uint *)(&MCCNTH))00; /* Downcounter period for 1mS */ > DDRS=0xCA; > > /* 9600 baud serial transmit */ > SC0BDH=0; > SC0BDLR; > SC0CR1=0x00; > SC0CR2=0x08; /* no interrupts, transmit, no receive */ > } > > uint mstime=0x0000; /* Redeclare this at the top to use */ > uint sectime=0x0000; > uchar txbuf[0x80]; > uchar txi=0, txo=0; > > int putchar (int c) > { > c&=0x00ff; > txbuf[txi]=c; > txi=(txi+1)&0x7f; > return c; > } > > void interrupt MC_interrupt (void) > { > ++mstime; > if (!(mstime&0x3ff)) > ++sectime; /* 1024 milliseconds, so slightly longer than actual > seconds */ > > /* Ser tx */ > if (SC0SR1&0x80 && (txi!=txo)) { > SC0DRL=txbuf[txo]; > txo=(txo+1)&0x7f; > } > > MCFLG |= 0x80; /* Clr flg */ > } > void main (void) > { > /* Set up initial hardware */ > setup(); > > enable_interrupt(); > > printf("Hello...\r\n"); > > for (;;) { > > if (!(sectime&0x01)) { > printf("A"); > } else { > printf("B"); > } > } > } > > ------------------------ Yahoo! Groups Sponsor > ---------------------~--> > Buy Ink Cartridges & Refill Kits for Your Epson at Myinks.com > Free shipping on orders $50 or more to the US and Canada. > http://www.c1tracking.com/l.asp?cidW05&lp=home/epson.asp > http://us.click.yahoo.com/brYXfA/_xWGAA/ySSFAA/dN_tlB/TM > -------------------------- > -------~-> > > -------------------- > > ">http://docs.yahoo.com/info/terms/ |
Reply by ●July 25, 20032003-07-25
Do you have the watchdog disabled? Is there an interrupt handler routine assigned for ALL vectors, used and unused? Stephen Killingsworth President, Embedded XLence, Inc. Embedded Systems Engineering -----Original Message----- From: mstrbelvedere [mailto:] Sent: Friday, July 25, 2003 3:23 PM To: Subject: [68HC12] DG128 locks up after 1 second Hello, My program for the 912DG128 chip (using P&E's Dev-Dg128 development board) runs fine if I am running P&E's ICD12Z debugger, but locks up after 1 second every time if I run the chip by itself. I've stripped a lot of code out, and have rearranged things, and find that the chip locks up independent of program location; rather, it's consistently after 1 second. I don't think I have any interrupts enabled that aren't serviced. This is my program. I am using IAR C for 68HC12. Under ICD12Z, I get a continuous stream of A's and B's alternating 1 second apart. When I reset on poweron with no debugger, The chip sends a string of A's, then locks up after about 10 B's. I'm losing my mind! Can anyone suggest what might be going wrong here? Should I explicitly turn off interrupts instead of allowing them to default out of reset? Thanks! Justin Dobbs #include <i912d128.h> #include <intr6812.h> #include <r912d128.h> #include <stdio.h> void setup (void) { MCCTL = 0xc4; (*(uint *)(&MCCNTH))00; /* Downcounter period for 1mS */ DDRS=0xCA; /* 9600 baud serial transmit */ SC0BDH=0; SC0BDLR; SC0CR1=0x00; SC0CR2=0x08; /* no interrupts, transmit, no receive */ } uint mstime=0x0000; /* Redeclare this at the top to use */ uint sectime=0x0000; uchar txbuf[0x80]; uchar txi=0, txo=0; int putchar (int c) { c&=0x00ff; txbuf[txi]=c; txi=(txi+1)&0x7f; return c; } void interrupt MC_interrupt (void) { ++mstime; if (!(mstime&0x3ff)) ++sectime; /* 1024 milliseconds, so slightly longer than actual seconds */ /* Ser tx */ if (SC0SR1&0x80 && (txi!=txo)) { SC0DRL=txbuf[txo]; txo=(txo+1)&0x7f; } MCFLG |= 0x80; /* Clr flg */ } void main (void) { /* Set up initial hardware */ setup(); enable_interrupt(); printf("Hello...\r\n"); for (;;) { if (!(sectime&0x01)) { printf("A"); } else { printf("B"); } } } -------------------- ">http://docs.yahoo.com/info/terms/ This e-mail and any files transmitted with it ( Message ) are confidential and may contain privileged information. This Message is intended solely for the addressee(s). If you have received this Message in error, please inform us promptly by reply e-mail then delete the Message and destroy any printed copy of it. Any unauthorized use, review, retransmission, dissemination, distribution, printing or copying of this Message or any part thereof is strictly prohibited. E-mails are susceptible to alteration. Neither Technip nor any of its subsidiaries and affiliates shall be liable for the Message if altered, changed or falsified |
Reply by ●July 25, 20032003-07-25
You forgot to turn off the watchdog timer in your software. When running with the debugger, you are in special mode and the watchdog is off after reset. In normal mode with no bdm, the watchdog is enabled after reset unless your software disables it. Regards Dave Perreault mstrbelvedere wrote: >Hello, > >My program for the 912DG128 chip (using P&E's Dev-Dg128 development >board) runs fine if I am running P&E's ICD12Z debugger, but locks up >after 1 second every time if I run the chip by itself. I've stripped >a lot of code out, and have rearranged things, and find that the chip >locks up independent of program location; rather, it's consistently >after 1 second. > >I don't think I have any interrupts enabled that aren't serviced. >This is my program. I am using IAR C for 68HC12. Under ICD12Z, I get >a continuous stream of A's and B's alternating 1 second apart. When I >reset on poweron with no debugger, The chip sends a string of A's, >then locks up after about 10 B's. > >I'm losing my mind! Can anyone suggest what might be going wrong >here? Should I explicitly turn off interrupts instead of allowing >them to default out of reset? > >Thanks! > >Justin Dobbs > >#include <i912d128.h> >#include <intr6812.h> >#include <r912d128.h> >#include <stdio.h> > >void setup (void) >{ > MCCTL = 0xc4; > (*(uint *)(&MCCNTH))00; /* Downcounter period for 1mS */ > DDRS=0xCA; > > /* 9600 baud serial transmit */ > SC0BDH=0; > SC0BDLR; > SC0CR1=0x00; > SC0CR2=0x08; /* no interrupts, transmit, no receive */ >} > >uint mstime=0x0000; /* Redeclare this at the top to use */ >uint sectime=0x0000; >uchar txbuf[0x80]; >uchar txi=0, txo=0; > >int putchar (int c) >{ > c&=0x00ff; > txbuf[txi]=c; > txi=(txi+1)&0x7f; > return c; >} > >void interrupt MC_interrupt (void) >{ > ++mstime; > if (!(mstime&0x3ff)) > ++sectime; /* 1024 milliseconds, so slightly longer than actual >seconds */ > > /* Ser tx */ > if (SC0SR1&0x80 && (txi!=txo)) { > SC0DRL=txbuf[txo]; > txo=(txo+1)&0x7f; > } > > MCFLG |= 0x80; /* Clr flg */ >} >void main (void) >{ > /* Set up initial hardware */ > setup(); > > enable_interrupt(); > > printf("Hello...\r\n"); > > for (;;) { > > if (!(sectime&0x01)) { > printf("A"); > } else { > printf("B"); > } > } >} > > >-------------------- > >">http://docs.yahoo.com/info/terms/ |
|
Reply by ●July 25, 20032003-07-25
Justin, Do you enable the COP Watchdog and then not service it appropriately? Try to initialize the COP Watchog Reset Vector at FFFAH. It might be a good idea to initialize all the un-used Interrupt and Reset vectors to a default stub function, so if you get an non-expected interrupt it doesn't go to nowheres-land Hope this helps, Doron Nohau Corporation HC12 In-Circuit Emulators www.nohau.com/emul12pc.html At 07:22 PM 7/25/2003 +0000, you wrote: >Hello, > >My program for the 912DG128 chip (using P&E's Dev-Dg128 development >board) runs fine if I am running P&E's ICD12Z debugger, but locks up >after 1 second every time if I run the chip by itself. I've stripped >a lot of code out, and have rearranged things, and find that the chip >locks up independent of program location; rather, it's consistently >after 1 second. > >I don't think I have any interrupts enabled that aren't serviced. >This is my program. I am using IAR C for 68HC12. Under ICD12Z, I get >a continuous stream of A's and B's alternating 1 second apart. When I >reset on poweron with no debugger, The chip sends a string of A's, >then locks up after about 10 B's. > >I'm losing my mind! Can anyone suggest what might be going wrong >here? Should I explicitly turn off interrupts instead of allowing >them to default out of reset? > >Thanks! > >Justin Dobbs > >#include <i912d128.h> >#include <intr6812.h> >#include <r912d128.h> >#include <stdio.h> > >void setup (void) >{ > MCCTL = 0xc4; > (*(uint *)(&MCCNTH))00; /* Downcounter period for 1mS */ > DDRS=0xCA; > > /* 9600 baud serial transmit */ > SC0BDH=0; > SC0BDLR; > SC0CR1=0x00; > SC0CR2=0x08; /* no interrupts, transmit, no receive */ >} > >uint mstime=0x0000; /* Redeclare this at the top to use */ >uint sectime=0x0000; >uchar txbuf[0x80]; >uchar txi=0, txo=0; > >int putchar (int c) >{ > c&=0x00ff; > txbuf[txi]=c; > txi=(txi+1)&0x7f; > return c; >} > >void interrupt MC_interrupt (void) >{ > ++mstime; > if (!(mstime&0x3ff)) > ++sectime; /* 1024 milliseconds, so slightly longer than actual >seconds */ > > /* Ser tx */ > if (SC0SR1&0x80 && (txi!=txo)) { > SC0DRL=txbuf[txo]; > txo=(txo+1)&0x7f; > } > > MCFLG |= 0x80; /* Clr flg */ >} >void main (void) >{ > /* Set up initial hardware */ > setup(); > > enable_interrupt(); > > printf("Hello...\r\n"); > > for (;;) { > > if (!(sectime&0x01)) { > printf("A"); > } else { > printf("B"); > } > } >} |
Reply by ●August 2, 20032003-08-02
Thanks guys for responding! I hadn't turned off the watchdog. No wonder it showed up as disabled in the debugger. I wonder if this differs from the B32 since I do not remember having trouble with it. Anyway, I appreciated your assistance. Debugging in circuit is so much easier than with a PIC! Justin --- In , Dave Perreault <briggsroad@c...> wrote: > You forgot to turn off the watchdog timer in your software. When running > with the debugger, you > are in special mode and the watchdog is off after reset. In normal mode > with no bdm, the watchdog is > enabled after reset unless your software disables it. > > Regards > Dave Perreault |