Software reset - What am I doing wrong?


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425

    Default Software reset - What am I doing wrong?

    For some reason, I need to reset the 18F4550 every single time whenever it's powered up. I don't understand why, perhaps it's because the 18F is on a demo board, but I've never had to do it before. Anyhow, accessing the reset button is a PITA so I want to use a software reset but nothing works like I want it to. I've tried using the power up timer but it doesn't seem to do anything.

    I've also tried:

    @ RESET
    @ clrf PCLATH
    @ goto 0
    STKPTR=$FF

    Some don't work and some keep the 18F in a continual reset loop. What am I doing wrong?
    Last edited by Christopher4187; - 18th August 2012 at 15:30.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Software reset - What am I doing wrong?

    Can you post your code and configs along with what demo board you are using?
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default Re: Software reset - What am I doing wrong?

    I'm using the MCP2515 Demo boards from Microchip. I thought about that being an issue but it can't be because their code doesn't require a reset. If I was able to understand C I'd be able to solve this problem as they provide the source code to you. I'm pretty sure I copied the configs line-for-line from the source code. Anyhow, here it is:

    Code:
    DEFINE OSC 20
    ' ==============================================================================
    '                        CONFIGS
    '===============================================================================
    
    
    @ __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    @ __CONFIG _CONFIG1H, _FOSC_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
    @ __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L & _BORV_3_2L & _VREGEN_ON_2L
    @ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_32768_2H 
    @ __CONFIG _CONFIG3H, _CCP2MX_ON_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _MCLRE_ON_3H
    @ __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_ON_4L & _XINST_OFF_4L
    
    '==============================================================================
    '                 SETTINGS
    ' ==============================================================================
            
     TRISA   = %00010110: PORTA = %00000000 
     TRISB   = %00010001: PORTB = %00010000   
     TRISC   = %00000000: PORTC = %00000001
     TRISD   = %00011100: PORTD = %00000000
     TRISE   = %00010000: PORTE = %00010111
     ADCON0  = %00111100
     ADCON1  = 15
     ADRESH  = %00000000 
     ADRESL  = %00000000
     CMCON   = 7
     SSPSTAT = %01100100      
     SSPCON1 = %00100001 
     BAUDCON = %00001111

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Software reset - What am I doing wrong?

    I am not sure if this will help or if the CAN module needs it set, but try turning the ICPRT off.
    @ __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_ON_4L & _XINST_OFF_4L
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default Re: Software reset - What am I doing wrong?

    That gives me a code programming error at 0006. Not sure why but I'm trying to figure it out. The issue isn't with the CAN module, I've isolated the problem to the 18F4550.
    Last edited by Christopher4187; - 18th August 2012 at 17:38.

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Software reset - What am I doing wrong?

    Is your programmer erasing the device before loading the new code?
    Dave
    Always wear safety glasses while programming.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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