CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Firmware Won't Start Up After Power Cycling

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Geps



Joined: 05 Jul 2010
Posts: 129

View user's profile Send private message

Firmware Won't Start Up After Power Cycling
PostPosted: Wed May 16, 2012 3:31 am     Reply with quote

Hi,

I've got a bizarre problem that I'm at a loss to explain.

I have the following program that when programmed to the PIC works as intended. I then turn the unit off and on again and the text doesn't get transmitted. I've cleared out as much of my code as I can and as you can see it doesn't leave many places to go wrong.

Attached is the (#list) .lst file:

Code:

CCS PCH C Compiler, Version 4.125, 54981               16-May-12 10:20

               Filename:

               ROM used: 200 bytes (0%)
                         Largest free fragment is 55934
               RAM used: 9 (0%) at main() level
                         10 (0%) worst case
               Stack:    1 locations

*
00000:  GOTO   0068
.................... 
....................    #include <18F4620.h>
.................... //////// Standard Header file for the PIC18F4620 device ////////////////
.................... #device PIC18F4620
.................... #list
.................... 
....................    #fuses H4, NOWDT, NOBROWNOUT, NOPUT, NOLVP, NOMCLR
....................    #USE delay(crystal=10Mhz, clock=40Mhz)
*
0001A:  CLRF   FEA
0001C:  MOVLW  09
0001E:  MOVWF  FE9
00020:  MOVF   FEF,W
00022:  BZ    0040
00024:  MOVLW  0C
00026:  MOVWF  01
00028:  CLRF   00
0002A:  DECFSZ 00,F
0002C:  BRA    002A
0002E:  DECFSZ 01,F
00030:  BRA    0028
00032:  MOVLW  F7
00034:  MOVWF  00
00036:  DECFSZ 00,F
00038:  BRA    0036
0003A:  BRA    003C
0003C:  DECFSZ FEF,F
0003E:  BRA    0024
00040:  GOTO   00BA (RETURN)
.................... 
....................    #BYTE port_b = 0xF81 
....................    #zero_ram
.................... 
....................    #define BOOTLOADER_END  (150*64)
....................    #build(reset=0x00:0x07)
....................    #org 0xEF, BOOTLOADER_END {}
....................     
....................   
.................... #define MCUADDRESS 0x12
.................... #define BOOTLOADER_NOT_PRESENT
.................... 
.................... #use RS232 (STREAM=DEBUGSERIAL, baud=115200, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

.................... void main() {
*
00068:  CLRF   FEA
0006A:  CLRF   FE9
0006C:  CLRF   04
0006E:  BSF    FB8.3
00070:  MOVLW  56
00072:  MOVWF  FAF
00074:  MOVLW  00
00076:  MOVWF  FB0
00078:  MOVLW  A6
0007A:  MOVWF  FAC
0007C:  MOVLW  90
0007E:  MOVWF  FAB
00080:  MOVF   FC1,W
00082:  ANDLW  C0
00084:  IORLW  0F
00086:  MOVWF  FC1
00088:  MOVLW  07
0008A:  MOVWF  FB4
0008C:  CLRF   FF8
0008E:  BCF    FD0.7
00090:  MOVLW  7E
00092:  MOVWF  00
00094:  MOVLW  10
00096:  MOVWF  01
00098:  MOVLW  02
0009A:  MOVWF  FE9
0009C:  MOVLW  00
0009E:  MOVWF  FEA
000A0:  CLRF   FEE
000A2:  DECFSZ 00,F
000A4:  BRA    00A0
000A6:  DECFSZ 01,F
000A8:  BRA    00A0
000AA:  CLRF   05
000AC:  CLRF   06
000AE:  CLRF   07
....................    int8 ByteCount = 0x00;
....................    int8 TempByte = 0x00;
....................    int8 BitCount = 0x00;
.................... 
....................     
....................    delay_ms(2000);
000B0:  MOVLW  08
000B2:  MOVWF  08
000B4:  MOVLW  FA
000B6:  MOVWF  09
000B8:  BRA    001A
000BA:  DECFSZ 08,F
000BC:  BRA    00B4
....................     
....................       fprintf(DEBUGSERIAL, "Philips Starting\n");   
000BE:  MOVLW  08
000C0:  MOVWF  FF6
000C2:  MOVLW  00
000C4:  MOVWF  FF7
000C6:  BRA    0044
....................     
....................    while(TRUE){}
000C8:  BRA    00C8

.................... 
.................... 
.................... 
.................... 
000CA:  SLEEP

Configuration Fuses:
   Word  1: C600   H4 FCMEN IESO
   Word  2: 1E19   NOPUT NOBROWNOUT BORV20 NOWDT WDT32768
   Word  3: 0700   CCP2C1 PBADEN LPT1OSC NOMCLR
   Word  4: 0081   STVREN NOLVP NOXINST NODEBUG
   Word  5: C00F   NOPROTECT NOCPB NOCPD
   Word  6: E00F   NOWRT NOWRTC NOWRTB NOWRTD
   Word  7: 400F   NOEBTR NOEBTRB
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed May 16, 2012 6:10 am     Reply with quote

I would make sure the clock is running at the speed you expect. Can you put a scope on the serial and see if the baud rate is way off? Output a square wave and verify the speed with either a scope, or make it real slow and use a watch.
_________________
The search for better is endless. Instead simply find very good and get the job done.
drh



Joined: 12 Jul 2004
Posts: 192
Location: Hemet, California USA

View user's profile Send private message

PostPosted: Wed May 16, 2012 8:21 am     Reply with quote

Enable the Power Up Timer?
_________________
David
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Wed May 16, 2012 8:56 am     Reply with quote

Is the programmer still attached when it works?.
Obvious thing would be something like a ground connection not made, but going through the programmer unit when it is present....

Best Wishes
Geps



Joined: 05 Jul 2010
Posts: 129

View user's profile Send private message

PostPosted: Thu May 17, 2012 1:52 am     Reply with quote

Thanks guys,

After a couple more hours investigating it seems it was a faulty board that was drawing power from the USB cable.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group