Questions about PicKit 3.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stj
    Great Sage 齊天大聖
    • Dec 2009
    • 30923
    • Albion

    #61
    Re: Questions about PicKit 3.

    http://www.microchip.com/forums/m883106.aspx

    Comment

    • Spork Schivago
      Badcaps Legend
      • Mar 2012
      • 4734
      • United States of America

      #62
      Re: Questions about PicKit 3.

      Originally posted by stj
      status led only changes when the programmer software does something.

      on the forum there was a couple of interesting things.

      1: dont run the IDE and IPE (programming) apps at the same time - they will both try to mess with the pk3 and could clash.

      2: win10 may need a reg patch unless your using the latest mplab-x version which is 3.10 or higher.
      I haven't even started IPE yet so I'm good there. Thanks for letting me know.

      I'm using the latest version of MPLab X I do believe, 3.15. Downloaded it from MicroChip last night and installed it.

      Device Manager shows it's using Microsoft drivers from 2006 (just generic HID drivers). It shows up under device manager as USB Input Device. I had the PC look for newer drivers using the Update Driver tab, no luck though.
      -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

      Comment

      • Spork Schivago
        Badcaps Legend
        • Mar 2012
        • 4734
        • United States of America

        #63
        Re: Questions about PicKit 3.

        I believe the PicKit3 is now working. There's only one issue but it's not a big one Stj. If I unplug the PicKit3 from the PC, I have to wait 20 - 25 seconds or so before plugging it back in. If I do not wait this amount of time and plug it in, all three lights stay solidly lit and the device is never recognized as being plugged in. I even went into the registry and changed EnhancedPowerMangementEnabled to 0 as suggested in the comment section to the link you posted.

        As for the video, where they talk about disabling driver signature enforcement, am I supposed to be using MicroChip drivers? I've printed out the manual and it shows for the PicKit3, it's just recognized as a HID device under Windows. To me, that means it's supposed to use the Microsoft drivers.
        -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

        Comment

        • Spork Schivago
          Badcaps Legend
          • Mar 2012
          • 4734
          • United States of America

          #64
          Re: Questions about PicKit 3.

          Is there a chance when I plugged it in for the first time with the bad USB cable and MPLab X updated the firmware that something might not of gotten updated properly? I mean, I remember something about the output window saying Uploading blah blah blah, Uploading blah blah blah, error connecting to device. I wish I could find away to force it to reupdate it now that we got a good USB cable there.
          -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

          Comment

          • stj
            Great Sage 齊天大聖
            • Dec 2009
            • 30923
            • Albion

            #65
            Re: Questions about PicKit 3.

            firmware is device specific,
            if you change the settings for a different pic chip it will re-upload the firmware to the pk3.
            then change it back to the 16f628a or whatever.

            the 25seconds thing is probably win10 polling the usb pretty slow because it's a laptop, check the power settings so it's not running in low-power mode.

            Comment

            • Spork Schivago
              Badcaps Legend
              • Mar 2012
              • 4734
              • United States of America

              #66
              Re: Questions about PicKit 3.

              Originally posted by stj
              firmware is device specific,
              if you change the settings for a different pic chip it will re-upload the firmware to the pk3.
              then change it back to the 16f628a or whatever.

              the 25seconds thing is probably win10 polling the usb pretty slow because it's a laptop, check the power settings so it's not running in low-power mode.
              I disabled the power save mode for the device in Device Manager. Didn't change anything. Is that what you're talking about with the power settings? The USB port is powering the device, because the 3 lights stay on. Could be a polling issue I guess. I couldn't find a way to safely remove the device so I just unplug it. Perhaps that's part of the problem?
              -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

              Comment

              • Spork Schivago
                Badcaps Legend
                • Mar 2012
                • 4734
                • United States of America

                #67
                Re: Questions about PicKit 3.

                Hopefully I can some PIC in some old PCB somewheres and remove it and pop it in. Thanks!
                -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

                Comment

                • Spork Schivago
                  Badcaps Legend
                  • Mar 2012
                  • 4734
                  • United States of America

                  #68
                  Re: Questions about PicKit 3.

                  I hooked up a USB hub and when I plug the PicKit3 into the hub, I don't have the problem. The USB Hub is powered by the USB port and I don't remove the hub. So looks like this is more than likely the polling problem you was talking about Stj. To me though, I think I'm happy with this setup
                  -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

                  Comment

                  • Spork Schivago
                    Badcaps Legend
                    • Mar 2012
                    • 4734
                    • United States of America

                    #69
                    Re: Questions about PicKit 3.

                    Originally posted by mariushm
                    PIC16F628A is a relatively weak microcontroller, it has very few features, little memory and ram, there's much better chips out there with more built in features like hardware i2c and spi, which could be useful.

                    My favourite goto for tests is PIC16F1519 : http://www.digikey.com/product-detai...2FP-ND/2651374

                    It's wide dip so it's easy to put on prototyping board, it's dip40 so it has lots of i/o pins, has 28 KB of flash (16 kwords because each word is 14 bits) so you can just code without worrying about optimizations to reduce program size, built in 16 mhz oscillator so you don't need to use external oscillator to go above 4 Mhz (as it happens with your chosen pic)

                    It's kinda hard to damage a pic just by programming it with bad code. MPLAB-X is pretty good about spotting mistakes so it would be kinda hard to create a broken binary and have mplab program it to a pic and damage the pic.
                    Do you know C at all? I want to set all inputs to digital and I'm not sure how to do that on the PIC16F628A. I've been reading the datasheet but all the examples are in assembly. I think I just need to set CMCON to 0x07. That should comparators off and enable the pins for I/O. Would that make them digital though? Or is there some special function or preprocessor directive I need to set that I'm not aware of?
                    -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

                    Comment

                    • mariushm
                      Badcaps Legend
                      • May 2011
                      • 3799

                      #70
                      Re: Questions about PicKit 3.

                      See page 33 of datasheet: https://cdn.badcaps-static.com/pdfs/...bb83564137.pdf

                      Your mcu has 2 ports, PORTA and PORTB .
                      You need to set the direction with TRISA and TRISB (to either input or output) and you may need to disable the comparator like it says in the datasheet using CMCON or CMCONbits (check out the pic16f628.h file in the xc8 include folder)
                      If some pins on the A port share functionality with other features, you may need to disable those features for the pins to become digital input only.

                      Basically, start any project by configuring the defining _XTAL_FREQ with the frequency you're going to use, if you plan on using built in delay functions, then configure the internal oscillator bits, disable the internal watchdog timer (it's not a good idea during development) then set the ports to their proper directions and enable or disable the features i want.

                      You basically have a built-in wizard which should help you set the parameters like you want and then just insert the code in your project... check Window menu > PIC Memory views > Configuration bits , set everything and then hit the generate source code to output

                      Comment

                      • stj
                        Great Sage 齊天大聖
                        • Dec 2009
                        • 30923
                        • Albion

                        #71
                        Re: Questions about PicKit 3.

                        Originally posted by Spork Schivago
                        Do you know C at all?
                        not me, i hit them with machinecode.

                        Comment

                        • Th3_uN1Qu3
                          Believe in
                          • Jul 2010
                          • 6031
                          • Romania

                          #72
                          Re: Questions about PicKit 3.

                          Same here. PICs have very limited resources which are gobbled up quickly by the C compiler. Also they have a fairly simple assembler language - no reason not to learn some of that.
                          Originally posted by PeteS in CA
                          Remember that by the time consequences of a short-sighted decision are experienced, the idiot who made the bad decision may have already been promoted or moved on to a better job at another company.
                          A working TV? How boring!

                          Comment

                          • mariushm
                            Badcaps Legend
                            • May 2011
                            • 3799

                            #73
                            Re: Questions about PicKit 3.

                            On the contrary. No need to waste time with learning assembly especially with an architecture like the PIC one with its quirks that make it more difficult/different compared to other architectures.

                            The free xc compiler produces quite decent code, the pro version (for which you can find patch/keygen if you look hard enough) enables some optimizations which reduce the binary size by about 10%, at best 20% - it used to be more in the past.

                            The performance increase is also minimal between the generated c code and hand assembly, I'd say it really depends on what you do. You can always just do inline assembly in your C project if something is really critical.

                            Besides all this, there's so many pic versions with so many options regarding ram size and flash size (storage) that unless you sell something in thousands of units, it's cheaper to just go for the next pic mcu in the series, for something like $0.1-0.2 more.

                            Comment

                            • Spork Schivago
                              Badcaps Legend
                              • Mar 2012
                              • 4734
                              • United States of America

                              #74
                              Re: Questions about PicKit 3.

                              Originally posted by mariushm
                              See page 33 of datasheet: https://cdn.badcaps-static.com/pdfs/...bb83564137.pdf

                              Your mcu has 2 ports, PORTA and PORTB .
                              You need to set the direction with TRISA and TRISB (to either input or output) and you may need to disable the comparator like it says in the datasheet using CMCON or CMCONbits (check out the pic16f628.h file in the xc8 include folder)
                              If some pins on the A port share functionality with other features, you may need to disable those features for the pins to become digital input only.

                              Basically, start any project by configuring the defining _XTAL_FREQ with the frequency you're going to use, if you plan on using built in delay functions, then configure the internal oscillator bits, disable the internal watchdog timer (it's not a good idea during development) then set the ports to their proper directions and enable or disable the features i want.

                              You basically have a built-in wizard which should help you set the parameters like you want and then just insert the code in your project... check Window menu > PIC Memory views > Configuration bits , set everything and then hit the generate source code to output
                              Thanks for giving me the run down. I had already figured out how to set te Configuration bits and the direction of the pins. I already had _XTAL_FREQ set to 4000000 (4MHz I believe). I had defined this before any #includes, because it seems some includes actually depend on it being defined in order to work (for example, the definition of the delay functions)

                              I'm still a bit confused as to what the comparators are, but from what I've read, if I just want the PORTA pins as digital I/O, I need to disable the comparators. I saw on some PICs, there's this ANSEL / ANSELH function you use to set the ports as digital or analog. Thanks for the help!
                              -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

                              Comment

                              • Spork Schivago
                                Badcaps Legend
                                • Mar 2012
                                • 4734
                                • United States of America

                                #75
                                Re: Questions about PicKit 3.

                                Originally posted by mariushm
                                On the contrary. No need to waste time with learning assembly especially with an architecture like the PIC one with its quirks that make it more difficult/different compared to other architectures.

                                The free xc compiler produces quite decent code, the pro version (for which you can find patch/keygen if you look hard enough) enables some optimizations which reduce the binary size by about 10%, at best 20% - it used to be more in the past.

                                The performance increase is also minimal between the generated c code and hand assembly, I'd say it really depends on what you do. You can always just do inline assembly in your C project if something is really critical.

                                Besides all this, there's so many pic versions with so many options regarding ram size and flash size (storage) that unless you sell something in thousands of units, it's cheaper to just go for the next pic mcu in the series, for something like $0.1-0.2 more.
                                I debated whether I wanted to go down the assembly route or not. I figured at this point in time, because I know C, stick with that to make it a little easier on me. Maybe once I get a bit better at this, I'll convert my code to assembly or something.
                                -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

                                Comment

                                • stj
                                  Great Sage 齊天大聖
                                  • Dec 2009
                                  • 30923
                                  • Albion

                                  #76
                                  Re: Questions about PicKit 3.

                                  comparators are for working with analog inputs.

                                  Comment

                                  • Spork Schivago
                                    Badcaps Legend
                                    • Mar 2012
                                    • 4734
                                    • United States of America

                                    #77
                                    Re: Questions about PicKit 3.

                                    Originally posted by stj
                                    comparators are for working with analog inputs.
                                    Thank you. So by simply turning off the comparators, I'm setting the inputs to digital then. That's what I thought but wasn't 100% certain. There's a little bit of a learning curve here but I think I'm catching on.
                                    -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

                                    Comment

                                    • Spork Schivago
                                      Badcaps Legend
                                      • Mar 2012
                                      • 4734
                                      • United States of America

                                      #78
                                      Re: Questions about PicKit 3.

                                      I just want to make sure I got this right. I have PORTA's RA5, RA6 and RA7 set to I/O by setting the configuration bits, so they should be taken care of. For RA0, RA1 and RA3, I just need to disable the comparator and it'll switch them to digital I/O. For RA2, I see the function can be RA2, AN2 or VREF. If I disable the comparator, that leaves RA2 or VREF.

                                      According to the datasheet, I can manipulate VRCON (The Voltage Reference Control Register, Page 67 of the datasheet). To do this, I'd set VRCON to 0b00000000. The only bits that really matter there are bits 6 and 7, right?

                                      Code:
                                      [FONT="Times New Roman"]
                                      bit 7    VREN: VREF Enable bit
                                             1 = VREF circuit powered on
                                             0 = VREF circuit powered down, no IDD drain
                                      
                                      bit 6    VROE: VREF Output Enable bit
                                             1 = VREF is output on RA2 pin
                                             0 = VREF is disconnected from RA2 pin
                                      
                                      bit 5    VRR: VREF Range Selection bit
                                             1 = Low range
                                             0 = High range
                                      
                                      bit 4    Unimplemented: Read as ‘0’
                                      
                                      bit 3-0  VR<3:0>: VREF Value Selection bits 0 ≤ VR <3:0> ≤ 15
                                             When VRR = 1: VREF = (VR<3:0>/ 24) * VDD
                                             When VRR = 0: VREF = 1/4 * VDD + (VR<3:0>/ 32) * VDD
                                      [/FONT]
                                      For RA4, I am going to be using the internal clock and not any external ones, so I want to turn T0CKI off, right? Page 23 of the datasheet says:
                                      Code:
                                      [font="Times New Roman"]
                                      4.2.2.2   OPTION Register
                                      
                                      The Option register is a readable and writable register,
                                      which contains various control bits to configure the
                                      TMR0/WDT prescaler, the external RB0/INT interrupt,
                                      TMR0 and the weak pull-ups on PORTB.
                                      
                                      Note: To achieve a 1:1 prescaler assignment for
                                      TMR0, assign the prescaler to the WDT
                                      (PSA = 1). See [B]Section 6.3.1 “Switching Prescaler Assignment”.[/B]
                                      
                                      [B]REGISTER 4-2: OPTION_REG – OPTION REGISTER (ADDRESS: 81h, 181h)[/B]
                                      
                                      bit 7    RBPU: PORTB Pull-up Enable bit
                                             1 = PORTB pull-ups are disabled
                                             0 = PORTB pull-ups are enabled by individual port latch values
                                      
                                      bit 6    INTEDG: Interrupt Edge Select bit
                                             1 = Interrupt on rising edge of RB0/INT pin
                                             0 = Interrupt on falling edge of RB0/INT pin
                                      
                                      bit 5    T0CS: TMR0 Clock Source Select bit
                                             1 = Transition on RA4/T0CKI/CMP2 pin
                                             0 = Internal instruction cycle clock (CLKOUT)
                                      
                                      bit 4    T0SE: TMR0 Source Edge Select bit
                                             1 = Increment on high-to-low transition on RA4/T0CKI/CMP2 pin
                                             0 = Increment on low-to-high transition on RA4/T0CKI/CMP2 pin
                                      
                                      bit 3    PSA: Prescaler Assignment bit
                                             1 = Prescaler is assigned to the WDT
                                             0 = Prescaler is assigned to the Timer0 module
                                      
                                      bit 2-0    PS<2:0>: Prescaler Rate Select bits
                                      [/font]
                                      So I'd set OPTION_REG = 0b11010111 or am I way off on this stuff? I see I'm going to need to do stuff with INTCON as well. If I don't need to worry about a certain bit, instead of setting it to either a 0 or a 1, should I be ORing or ANDing the values I do care about with the various registers? OR it 1 to turn on one of the bits I care about or AND it with 0 to turn off one of the bits and just leave the other ones at their defaults values?
                                      Last edited by Spork Schivago; 12-09-2015, 11:46 AM.
                                      -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

                                      Comment

                                      • stj
                                        Great Sage 齊天大聖
                                        • Dec 2009
                                        • 30923
                                        • Albion

                                        #79
                                        Re: Questions about PicKit 3.

                                        make sure you disable the watchdog timer. (wdt)

                                        Comment

                                        • Spork Schivago
                                          Badcaps Legend
                                          • Mar 2012
                                          • 4734
                                          • United States of America

                                          #80
                                          Re: Questions about PicKit 3.

                                          I did that with the configuration bits I believe. I set WDTE (Watchdog Timer Enable Bit) to OFF. I think I found how to set the individual bits. Hadn't read through the header file at the time I wrote the question there. From the header, I see stuff like:
                                          Code:
                                          // Register: INTCON
                                          extern volatile unsigned char      INTCON       @ 0x00B;
                                          #ifndef _LIB_BUILD
                                          asm("INTCON equ 0Bh");
                                          #endif
                                          // bitfield definitions
                                          typedef union {
                                            struct {
                                              unsigned RBIF          :1;
                                              unsigned INTF          :1;
                                              unsigned T0IF          :1;
                                              unsigned RBIE          :1;
                                              unsigned INTE          :1;
                                              unsigned T0IE          :1;
                                              unsigned PEIE          :1;
                                              unsigned GIE          :1;
                                            };
                                            struct {
                                              unsigned            :2;
                                              unsigned TMR0IF         :1;
                                              unsigned            :2;
                                              unsigned TMR0IE         :1;
                                            };
                                          } INTCONbits_t;
                                          extern volatile INTCONbits_t INTCONbits @ 0x00B;
                                          So I should be able to do stuff like:
                                          Code:
                                          INTCONbits.GIE = 1;
                                          if I want the Global Interrupt Enable bit set to 1 (enables all un-masked interrupts)
                                          -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

                                          Comment

                                          Related Topics

                                          Collapse

                                          • tommy1331
                                            hp envy 15t k000 debugging
                                            by tommy1331
                                            Hi, I'm quite new to this, I am trying to debug a faulty motherboard (DAY31AMB6C0). There was a fault in the DC input circuit with a faulty TVS diode after the first MOSFET shorting the VAD rail to ground. I was able to clear that fault by removing the diode and now the input section seems to be working correctly and I get the V3PCU power rail.

                                            But trying to start the board still fails, I put some RAM in it and shorted the power button to start it up but it only blinks the power LED in the DC jack assembly 3 times. Maybe the AC detect circuit is broken? Or is this more likely to be...
                                            04-28-2025, 08:12 AM
                                          • Ihandyrepair
                                            ID smd 6pin chip - GM2 for electric scooter display
                                            by Ihandyrepair
                                            Hi

                                            working on a not turning on Wheelspeed WS1 scooter.
                                            diagnosed - issue is the display/power button

                                            on the board, with the multimeter I noticed there is a short to ground. as the red wire has 0 ohm to ground.
                                            with infrared camera, this chip (photo circled) would heat up if I push power button on.
                                            but I can't find any replacement or online info of this chip.
                                            on the chip you can see it has a label GM2H, I have another good working display with the same chip but it has label GM2C

                                            could anyone help me id this chip and guide me to...
                                            05-08-2024, 06:59 PM
                                          • seppde
                                            Benq Zowie XL2540K / Power board failure / 6Pin-SOP-Chip identification
                                            by seppde
                                            Hello everyone,
                                            I've got a Benq power board of a XL2540K monitor which suffered from a power cut and is since defective / won't turn on. It's got obvious defects, some blown resistors, some burning around the drain pin of a MOSFET...
                                            ... and some 6-pin IC I struggle identifying, that is driving said MOSFET.
                                            The IC is labeled as IC601, so someone with a circuit schematic could probably identify it really quick, unfortunately I can't find the schematics.
                                            In other power boards of Benq for which I did find the schematics, IC601 is an 8-pin NCP1200 PWM controller - I suppose...
                                            02-09-2024, 05:19 AM
                                          • belalmondeo
                                            Car code scanner OBD1 adapter enquiry
                                            by belalmondeo
                                            Hello everyone there
                                            If You do remember me then I am Belal who posted an issue of his J2534 pass-thru Multi-Diag 2015 OBD II device a while ago and aside from my thanks that show my gratitude to all of those who have given me help with my issue I just wanted to go straight into my question which is whether using the OBD II to OBD I adapter to diagnose an older model vehicle like a GM 12 adapter safe enough and not gonna cause any catastrophic failure to my device and if it still can perform scanning with no issues?
                                            there's a link for the adapter: https://ebay.to/2UCWDDx
                                            ...
                                            04-05-2019, 06:00 PM
                                          • thrinrot
                                            Zotac GTX 960 2GB- 6pin PCIE Power not recognized
                                            by thrinrot
                                            Hi all!
                                            A friend of mine brought me a defective Zotac GTX 960 with a failing power detection.
                                            Even though the 6 pin PCIe power cable is plugged in, the card says "Plugin PCIe power cable and reboot".

                                            Since I have no schematics it is hard to find out the NVVDD_PGOOD trace.

                                            I checked if the Controller (NCP81174) sends a Power good signal and the signal VR_RDY at pin 3 is high. So I assume the controller is not sending a bad signal (?).

                                            I appreciate your help! :-)
                                            09-25-2021, 12:29 PM
                                          • Loading...
                                          • No more items.
                                          Working...