Odd ICSP behaviour


+ Reply to Thread
Results 1 to 9 of 9

Thread: Odd ICSP behaviour3452 days old

  1. #1
    Member Peter Truman's Avatar
    Join Date
    Dec 2003
    Posts
    312
    Thumbs Up
    Received: 9
    Given: 7
    Total Downloaded
    406.61 MB

    0 Not allowed!

    Default Odd ICSP behaviour

    Hi All

    I've found an odd issue and haven't been able to see where I've gone wrong. Built a project using a PIC16F628A - when I program it, the programmer (Microengineering labs USB) appears to program the chip ok the first time I try it, expect that the verify fails. The program seems to run ok.

    If I try to reprogram the chip it just reports the chip not recognised. If I take the chip out of the socket and program it in the ZIF socket (for this I use an old Micropro serial programer) - everything works perfectly as expected.

    Would somone mind having a look at the code segment below and seeing if I have done somthing stupid? (I can post the rest of the code if needed) - BTW - there is nothing else connected to the vpC & vpD pins - Vpp is pulled up to 5v via a 10k resistor.

    Many thanks
    Peter
    Code:
    Device=16F628A'device name
    ALL_DIGITAL=true 'all digital
    PORTB_PULLUPS=On 'enable pullups
    XTAL=20 '20 MHZ xtal
    Config BOREN_ON, CP_OFF, DATA_CP_OFF, PWRTE_OFF, WDT_OFF, LVP_OFF, MCLRE_OFF, HS_OSC
     
    Symbol running =PORTA.0
    Symbol RTS =PORTA.1
    Symbol main_led=PORTA.2
    Symbol ok_led =PORTA.3
    Symbol rly4 =PORTB.0
    Symbol rly3 =PORTB.1
    Symbol rly1 =PORTB.2
    Symbol rly2 =PORTB.3
    TRISA=%00000011 
    TRISB=0
    Low rly1
    Low rly2
    Low rly3
    Low rly4 'all low to start with
    Declare RSIN_PIN PORTB.5
    Declare RSOUT_PIN PORTB.4
    Declare RSOUT_MODE inverted
    Declare RSIN_MODE INVERTED
    Declare SERIAL_BAUD 9600
    Declare RSIN_TIMEOUT 20
    Input PORTB.5
    Input PORTA.0
    'variables
    Dim general As Byte
    Dim speed As Byte
    Dim null1 As Byte
    Dim null2 As Byte
    Dim null3 As Byte
    Dim action As Byte
    Dim p_status As Byte
    Dim flash_count As Byte 
    Dim hr1 As Byte
    Dim hr2 As Byte
    Dim min1 As Byte
    Dim min2 As Byte
    Dim hrs As Byte
    Dim mins As Byte
    Dim e_flash As Byte
    Dim mins_2_run As Word
    Dim mins_left As Word
    Dim clock As Word
    Dim tenths As Byte
    Dim seconds As Byte
    Dim minutes_run As Word
    Dim tick As Byte
    Dim p_strg[5] As Byte 'array
    Dim t_strg[5] As Byte
    Dim flip_bit As Bit
    Clear
    Str t_strg="Pump "
    ' Timer1 Registers: 
    ' Prescaler=1:8; TMR1 Preset=3036; Freq=10.00Hz; Period=100,000,000 ns
    T1CON=%00111100 '
     
    ON_INTERRUPT INTERRUPT_ROUTINE ' WHERE TO GO ON AN INTERRUPT
    GoTo over_interrupt 
    INTERRUPT_ROUTINE: 'get here on timer 1 oveflow interrupt Inc tick
    If tick>99 Then '10 ticks per second
    If p_status=1 Then Inc seconds 'count seconds since pump running
    tick=0
    flip_bit=~flip_bit 'simple clock at 1Hz
    EndIf
    Clear PIR1.0 'CLEAR TMR1 INTERRUPT FLAG
    TMR1H = $E7 ' preset for timer1 MSB register
    TMR1L = $9A ' preset for timer1 LSB register
    Context Restore'END INTERRUPT ROUTINE
    '***************************************************************************
    over_interrupt:
    PIR1.0 = 0 ' CLEAR TMR1 INTERRUPT FLAG
    INTCON = %11000000 ' GLOBAL AND PERIPHERAL INTERRUPTS ON
    PIE1.0 = 1 ' ENABLE TMR1 AS PERIPHERAL INTERRUPT SOURCE
     
    T1CON.0 = 1 ' SET TIMER1 RUNNING
    'startup:
    For general=0 To 25 'just to show we're working
    GoSub flash_ok
    DelayMS 50
    Next general
    DelayMS 100
    

    Peter Truman

  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
    Prolific Poster pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    2,942
    Thumbs Up
    Received: 25
    Given: 31
    Total Downloaded
    926.61 MB

    0 Not allowed!

    Default Re: Odd ICSP behaviour

    Hi Peter,

    Does it make any difference if you have the board powered when you program it?.

  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
    Kapitan
    Guest Kapitan's Avatar

    0 Not allowed!

    Default Re: Odd ICSP behaviour

    Hi Pete, have you anything connected to the ICSP programming pins ? . or, are they totally dedicated. ?
    having something connected to vpc and vpd can make a heck of a difference and cuasue just the problems you say.

    Hope ya get it sorted !

  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 bill9399's Avatar
    Join Date
    Aug 2004
    Posts
    1,702
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    1.29 GB

    0 Not allowed!

    Default Re: Odd ICSP behaviour

    Peter,
    the Melabs USB programmer can fail verification as a result of some configuration settings, although this is usually as a result of the read protection configuration bits. Been there, seen it. I have one of these programmers. Try programming one of your pics(tm) without these config settings and see if this allows re-programming.

    I have also had problems with reprogramming with this programmer, and, on occasion, have had to use a different programmer to clear the pic. Strangely enough, I have then been able to program the pic using Melabs USB programmer.

    Try setting LVP_ON, and see if that makes any difference. Check also use of MCLR for ICSP

    Might be worth your while looking at using a Pickit2 as an alternative. To date I have had absolutely no problems using same.


    regards
    Last edited by bill9399; 19th December 2010 at 14:25.
    A wise man may listen and say nothing. A fool may listen and have nothing to say. Which one are you???

  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
    Prolific Poster pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    2,942
    Thumbs Up
    Received: 25
    Given: 31
    Total Downloaded
    926.61 MB

    0 Not allowed!

    Default Re: Odd ICSP behaviour

    Bill, I use Pickit 2, and with one of my laptops I have no problem. On the older one however, I sometimes get a programming fail. It appears that the older laptop is not always able to power the board, and program it at the same time. If I power the board first, it programs perfectly everytime. I have all the ICSP just dedicated to programming.

  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
    Prolific Poster bill9399's Avatar
    Join Date
    Aug 2004
    Posts
    1,702
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    1.29 GB

    0 Not allowed!

    Default Re: Odd ICSP behaviour

    Quote Originally Posted by pic-ignorant View Post
    Bill, I use Pickit 2, and with one of my laptops I have no problem. On the older one however, I sometimes get a programming fail. It appears that the older laptop is not always able to power the board, and program it at the same time. If I power the board first, it programs perfectly everytime. I have all the ICSP just dedicated to programming.
    OK on that, but, for that reason, it is also highly recommended that the board/pcb design should be such that the ICSP programmer only powers the pic(tm), not the complete board. A single diode in the right place works wonders. It is, in many cases, not prudent to have power to the rest of the PCB whilst programming your pic(tm).
    Spurious OOPS's can cause accidents.
    Last edited by bill9399; 19th December 2010 at 14:41.
    A wise man may listen and say nothing. A fool may listen and have nothing to say. Which one are you???

  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.

  13. #7
    Prolific Poster pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    2,942
    Thumbs Up
    Received: 25
    Given: 31
    Total Downloaded
    926.61 MB

    0 Not allowed!

    Default Re: Odd ICSP behaviour

    True Bill, it was an oversight on my part

  14. 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.

  15. #8
    Member Peter Truman's Avatar
    Join Date
    Dec 2003
    Posts
    312
    Thumbs Up
    Received: 9
    Given: 7
    Total Downloaded
    406.61 MB

    0 Not allowed!

    Default Re: Odd ICSP behaviour

    Sorry guys - got tied up with somthing else. Right, I'll give those suggestions a go and see what happens. I can confirm however that the program and clock pins are dedicated to programming - not used for anything else.

    If I had a zif socket for my USB programmer I could confirm if the problem is only assicated with the board or not. Oddly, I'm sure I have in the past programmed chips on this board before by using the serial programmer with ICSP - so it seems the problem is somthing specific to the USB programmer!

    Anyway, I'm not at my bench at the moment so I will try this out a bit later on -

    Thanks
    Peter
    Peter Truman

  16. 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.

  17. #9
    Kapitan
    Guest Kapitan's Avatar

    0 Not allowed!

    Default Re: Odd ICSP behaviour

    Quote Originally Posted by Peter Truman View Post
    Sorry guys - got tied up with somthing else. Right, I'll give those suggestions a go and see what happens. I can confirm however that the program and clock pins are dedicated to programming - not used for anything else.

    If I had a zif socket for my USB programmer I could confirm if the problem is only assicated with the board or not. Oddly, I'm sure I have in the past programmed chips on this board before by using the serial programmer with ICSP - so it seems the problem is somthing specific to the USB programmer!

    Anyway, I'm not at my bench at the moment so I will try this out a bit later on -

    Thanks
    Peter
    Hi Peter, try pulling the RB4 / PGM pin low via a 47K resistor.
    II have had this issue on other units.
    Joe

  18. 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. Odd USART behaviour
    By Peter Truman in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 6th November 2018, 10:55
  2. Something odd about %0
    By towlerg in forum Website / Forum Issues
    Replies: 1
    Last Post: 31st March 2013, 17:43
  3. Odd problem with Timer Macros
    By johngb in forum Proton Plus Compiler v3
    Replies: 5
    Last Post: 7th July 2012, 03:38
  4. Odd PIC behaviour near a VFD - very subtle
    By Peter Truman in forum Proton Plus Compiler v3
    Replies: 15
    Last Post: 3rd November 2010, 15:56
  5. [SOLVED !] Transistor switching - odd behavior at odd voltages
    By rackley in forum The Lounge
    Replies: 11
    Last Post: 30th November 2005, 16:05

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