pic reset during program run


+ Reply to Thread
Results 1 to 6 of 6

Thread: pic reset during program run2000 days old

  1. #1
    Member Jezsmith's Avatar
    Join Date
    Sep 2004
    Posts
    211
    Thumbs Up
    Received: 7
    Given: 2
    Total Downloaded
    930.95 MB

    0 Not allowed!

    Default pic reset during program run

    hi,

    I am moving a current project over to p24 which runs GPS parsing code saves gps tracks onto an sd card. If I run the code for the sd cardand comment out the extract gps bit, it works continuous without issue and similarly, if i run the gps code on its own and coment out the sd card save code, it runs without issue. However when I put the sd code in to save a track it runs for 19 saves and then the pic resets and it all starts again, after a further 19 saves it locks and a hard reset is required.could the rsin be interfering with sd code? The track log file is 80bytes long.

    Code:
    Device = 24FJ64GA002
     Declare Xtal = 16
     
     Config Config1 = JTAGEN_OFF, GCP_OFF, GWRP_OFF, BKBUG_OFF, COE_OFF, ICS_PGx1, FWDTEN_OFF, WINDIS_OFF, FWPSA_PR128, WDTPOST_PS256
     Config Config2 = IOL1WAY_OFF, COE_OFF, IESO_OFF, FNOSC_FRCPLL, FCKSM_CSDCMD, OSCIOFNC_ON, POSCMOD_NONE 
        
        Declare Serial_Baud = 9600                  ' USART1 baud rate
        Declare Rsin_Mode =0
        Declare Rsin_Pin = PORTA.1 
        Declare Rsout_Pin = PORTA.0
        Declare Rsin_Timeout = 2000                 ' Timeout after 2 seconds
        
            
      ' SD Card SPI pin definitions
        $define SD_CLK PORTB.2                  ' SPI CLK to SD card pin5 CLK pin
        $define SD_SDO PORTB.1                  ' SPI DO to SD card pin2 DI pin
        $define SD_SDI PORTB.3                  ' SPI DI to SD card pin7 DO pin
        $define SD_CS  PORTB.0                  ' SPI CS to SD card pin1 CS pin (active low)
        
        
        Include "SPI_24.inc"                        ' Load the PIC24 SPI procedures into the program
        Include "convert24.inc"                     ' Load numbers to string conversion
        Include "SPI_DOG.inc."                      ' Load Dog SPI routines
        Include "parse_gps.inc"                     ' Load GPS routines
        Include "FileSys24.inc"                     ' Load the FAT file system procedures into the program
        Include "arial8.inc"
        Include "arial16.inc"
        Include "arial24.inc" 
        Include "font.inc"
        
        Dim gpsrx As String *10
        Dim MyFileName As String * 11              ' sd file name string
        Dim track As Word                          ' track number counter
        Input PORTA.1                              ' rsin 
        Output PORTA.0                             ' rsout
    
    init:
    SPI_Init()
    DOG_Init()
    LCD_CLS()
    
     MyFileName = "FILE.CSV"
        
        If FAT_Init() = cErrOK Then                             ' Can we initialise the FAT? 
        track =0    
           Print_At(Font_Table,1,0, "SD Init",0)                    ' yes so print this
              If File_Exists(MyFileName) = False Then             ' Does the file already exist?
                If File_Create(MyFileName) = cErrOK Then        ' No. So could we create it?
                    Print_At (Font_Table,2,0, MyFileName,0)               ' Yes. So print message
                    File_Close()                                ' Close the file
                 Else                                            ' Otherwise...
                    Print_At(Font_Table,1,0, "Not Created",0)             ' Transmit an error response
                EndIf
            Else                                                ' Otherwise...
                Print_At(Font_Table,0,30,"File exists",0)                  ' Transmit an error response
            EndIf
         Else                                                    ' Otherwise...
            Print_At(Font_Table,1,0, "Cannot initialise",0)               ' Transmit an error response
        EndIf
    
                                      
    
    main:
       
          
    While 1=1
        GoSub GPGGA_EXTRACT
        GoSub GPRMC_EXTRACT
        
        If FIX = "A" Then                                     'only create a track if we have a fix
            Print_At(Font_Table,3,40,"Have Fix",0)
            GoSub Create_Track                 'create a track
        EndIf
          
        Print_At(Font_Table,5,40,GPS_TIME,0)
        Print_At(Font_Table,7,2,LAT_sign,0):Print_At(Font_Table,7,10,Lat_degrees,0)
        Print_At(Font_Table,7,58,LON_sign,0):Print_At(Font_Table,7,66,Lon_degrees,0)
        Print_At(Font_Table,0,2,"S:",0):Print_At(Font_Table,0,12,SAT,0)
        Print_At(Font_Table,0,106,"F:",0):Print_At(Font_Table,0,118,FIX,0)
    
           If File_Append(MyFileName) = cErrOK Then            ' Can we append to an existing file?
                File_Write Str tracklog                        ' Write ASCII data to the file 
                File_Write 13                                  ' Write carrage return
                File_Close()                                   ' Close the file
                DelayMS 10
           EndIf   
     Wend
    Stop
    any ideas

    regards
    Jez
    Last edited by Jezsmith; 13th December 2014 at 21:11.

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Senior Member SimonJA's Avatar
    Join Date
    Mar 2006
    Posts
    842
    Thumbs Up
    Received: 14
    Given: 16
    Total Downloaded
    1.03 GB

    0 Not allowed!

    Default Re: pic reset during program run

    You could try looking in the RCON register to see what has caused the reset.

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Member Alan R.'s Avatar
    Join Date
    Jan 2005
    Posts
    376
    Thumbs Up
    Received: 4
    Given: 5
    Total Downloaded
    330.57 MB

    0 Not allowed!

    Default Re: pic reset during program run

    Make sure you adequate voltage and power. Perhaps a bigger or better decoupling cap.

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,354
    Thumbs Up
    Received: 83
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: pic reset during program run

    Hi Jezsmith

    did you try SimonJA's suggestion, knowing whats causing the reset is 90% of the problem.

    Given that the fault is so consistent (stack overflow maybe) it's more likely programming than noise.

    George

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Member Jezsmith's Avatar
    Join Date
    Sep 2004
    Posts
    211
    Thumbs Up
    Received: 7
    Given: 2
    Total Downloaded
    930.95 MB

    0 Not allowed!

    Default Re: pic reset during program run

    thanks,
    No not yet as back to work this week I will try the sugestion on my day off
    cheers

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Member Jezsmith's Avatar
    Join Date
    Sep 2004
    Posts
    211
    Thumbs Up
    Received: 7
    Given: 2
    Total Downloaded
    930.95 MB

    0 Not allowed!

    Default Re: pic reset during program run

    resolved
    The RCON register bit 15 was set "Trap conflict" error, I do not profess to understand in the slightest what that meant, but it did seem to rule out all the other possibilities. Software was the culprit. Printing a string to card I used the str modifier which did not result in a compiler error and did work for a few write loops until it conflicted somehow and reset the PIC.

    File_Write Str tracklog ' Write ASCII data to the file

    modified to File_Write tracklog ' Write ASCII data to the file

    works as designed now, for refrence

    regards
    Jez

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Chip Inp/out status change when program run
    By Willem in forum Proton Plus Compiler v3
    Replies: 12
    Last Post: 2nd July 2009, 12:07
  2. Galva-Wisp PIC programmer can program more PIC devices now
    By Frizie in forum Proton Plus Compiler v3
    Replies: 0
    Last Post: 24th November 2006, 23:13
  3. [SOLVED !] Program reset problem
    By Roshan in forum Proton Plus Compiler v3
    Replies: 0
    Last Post: 11th May 2006, 17:17
  4. PIC software reset
    By nullsoft in forum Proton Plus Compiler v3
    Replies: 6
    Last Post: 19th July 2005, 20:42
  5. Hserin/Serin force PIC to reset???
    By mister_e in forum Pre-Sales and Upgrade Questions
    Replies: 4
    Last Post: 8th May 2005, 18:29

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts