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


    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

  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?

    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.

  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?

    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.

  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?

    Is your programmer erasing the device before loading the new code?
    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 was part of my issue from the very beginning. I've used the 18F4550 for a number of projects and in all of them I used the ICSP. I've never had a problem. With these demo boards the erase always fails. I had to go into options -> more options -> erase -> and uncheck configuration/user ID and calibration. It still erases because when I hit the erase the program is wiped clean but I don't know what these two settings do.

    You think this is my issue? I don't understand how the ICPRT setting affects the 18F powering up.

  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?

    I have never had this problem before either and the 4550 or 2550 is what I use the most.

    I normally have the MCLRE off and alway have the ICPRT off. The ICPRT is only available on the 44 pin packages and yes I use those too.

    I have been reading section 25.9 of the data sheet trying to understand this.
    Dave
    Always wear safety glasses while programming.

  7. #7
    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?

    Never mind.
    I looked at the schematic for the demo board and ICPRT has to be ON.
    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