Announcement

Collapse
No announcement yet.

"Target device does not match selected device" when try to program

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • "Target device does not match selected device" when try to program

    I've been looking at PBP for many years.. finally decided to take the plunge.
    Hopefully I'll get through the learning curve quickly.. it actually doesn't look too bad.
    In the meantime I've run into my 1st roadblock. that I can't seem to get past..

    using:
    MicroCode Studio PLUS 5.0.0.5
    Compiler version PBPX 3.1.1.4
    melabs Programmer Version 4.6.4
    There's a top header above the MicroStudio Plus toobar that says "MicroStudio Plus PICBASIC PRO - PIC18 Suite 2017.4.12.0 (BLINK.PBP)
    Advanced D-Stick (PIC18F47K40) target
    Compiling the unmodified BLINK.PBP program in the EXAMPLES folder (as it defaults when 1st installed)

    1) The COM port in Device Manager looks good.. says "MELABS COM Port (COM5)
    2) MicroCode Studio Plus is set to "18F47K40" and "COM5"
    3) Compile and ICD Compile both seem to work ok..(produce .asm & .hex files with correct time&date)
    4) Green LED is illuminated on target & Vdd measures 5.15V
    4) If I try to program it says "Target device does not match selected device"

    5) If I use the programmer options to "get target information".. it returns "Target Device ID is FFFF" (I suspect this incorrect and is a clue why it's not working..)
    6) If I use the programmer options to check if the device is blank, it seems to to this correctly.. (progress bar moves, red LED on the target illuminates while checking, and after a few seconds says "This device is blank" and Green LED comes back on)
    7) also, if I use the "Run" button on MicroCode Studio, it says "MicroCode Studio was unable to connect to the PIC.

    8) I did edit the PIC18F47K40.PBPINC file to select HFINTOSC_64MHZ and also made LVP=ON.. but I don't think this has anything to do with the "Target device not matching the selected device"

    Thanks in advance for any advice on what may be going wrong here..

  • #2
    Try re flashing the processor with LVP=OFF
    Dave Purola,
    N8NTA
    EN82fn

    Comment


    • #3
      How can I do that... I can't connect to the target with the melabs programmer to reflash it?
      The D-Stick has it's own on-board programming hardware.. I think that's what I'm unable to make a connection with?

      Comment


      • #4
        I edited the PIC18F47K40.PBPINC so that LVP=OFF.. and recompiled.. no difference. Still can't get melabs programmer past "Target Device does not match selected device", and MicroCode Studio still says "MicroCode Studio was unable to connect to the PIC"...

        Comment


        • #5
          Looking at the documentation, I'm pretty sure the Advanced D-Stick (PIC18F47K40) wants LVP=OFF.. In the 3rd paragraph of this .pdf
          http://melabs.com/downloads/DS2_Product_Insert.pdf

          It says:
          It is important to note that the D-Stick uses Low-Voltage-Programming to program the PIC18F47K40. Here is an example of the #CONFIG directive that you might use in PBP:

          It goes on to show that LVP=ON

          Comment


          • #6
            Doug, You are correct. I have never used one of the DSTICK's before but after reading about it it does say that the Low Voltage Programming directive need's to be set. Is there anything connected to the RC6 and RC7 pins that could possibility load it down? The documentation did make mention of this as being a problem. There are resistors in series with the RX and TX lines form the USB interface chip. Maybe an email to Charles Leo who is the software and hardware designer may help.
            Dave Purola,
            N8NTA
            EN82fn

            Comment


            • #7
              For these first exercises of getting acquainted, I'm using the D-Stick by itself, with nothing connected to any of the port pins...
              I'm suspicious that I may have broken the D-Stick by programming it incorrectly when I first got it. I originally assumed these needed the bootloader, and haphazardly tried to use the melabs U2 Programmer to program a bootloader hex file.. (which I couldn't find obviously because the D-Stick doesn't work that way) but that didn't stop me from trying to program the D-Stick with the U2 Programmer, with the BLINK program, at the same time not being careful about configuration settings.. I've purchased a couple new units which will let me test this theory.
              Thanks for your help with this..

              Comment


              • #8
                Are you sure you can't get the Melabs boot loader hex file from Melabs and re-flash it? I beleive it should be available. I would ask first before ordering more of the D-Stick's.
                Dave Purola,
                N8NTA
                EN82fn

                Comment


                • #9
                  I did ask this to melabs support (before I was moderator approved for this forum) and got this response from Charles Leo:

                  "The D-Stick doesn't use a bootloader, it has a programmer on-board. It can be programmed using the meProg software that also runs the U2 Programmer. There should have been a CD labeled ME Labs "Programmer included with the bundle, but you can also download it here:
                  "http://melabs.com/support/progsoft.htm

                  "When using MicroCode Studio, it should be set up to use "microEngineering Labs Programmer".


                  Comment


                  • #10
                    Test with the D-Stick connected to USB, but not inserted into any board. (D-Stick alone on the end of the USB cable.)

                    In the meProg software, select the PIC18F47K40 and click Program > Get Target Information. It should return a firmware version (from the on-board programmer) and a target id (from the target mcu). Please post the firmware version. (We already know the target id is bad.)

                    The PCB on your D-Stick should have black solder-mask. If it's red, you received a standard D-Stick by mistake. You can check for the standard D-Stick by selecting the PIC16F1937 and trying the same test.

                    This could also be a case of a defective product. It happens occasionally. If you feel this is the case, contact us via the support email to obtain a replacement.

                    I've worked with one user who did something to lock himself out of programming. Still not sure how this was done, but we recovered the D-Stick by programming it with a separate programmer as if it was a simple PIC. If you have a way to program a 40-pin PIC using something like a PICKit or U2 Programmer, you can try the same method with the D-Stick. The goal is a successful Erase. After an erasure, there should be no obstacle that will impair the on-board programmer.

                    For clarity, here is information on the D-Stick programming method.

                    The D-Stick does not use a boot-loader. It has a programmer chip on the PCB, connected to the programming clock/data pins and MCLR. The programmer chip is only capable of low-voltage-programming, but Microchip made it impossible to program the configuration for HVP when you're connected with LVP. If you do set the config data for HVP and try to program the D-Stick through the USB port, it will program all but that single config bit, you will see "Configuration Programming Error" but the programming will be successful.

                    If you connect to the USB port and Get Target Information returns a good firmware version, you have proven the USB communication is working and the programmer chip is running.

                    The virtual COM Port is not used for programming. It is implemented to accommodate PIC-to-PC serial communications at run-time. This allows it to work with the Microcode Studio Plus ICD, but it is not limited to that.

                    When you connect to the USB port on the D-Stick, it enumerates on the PC as two separate devices. One is an Human Interface Device (HID) for programming, the other is a virtual COM Port for serial communication.
                    Charles Leo
                    ME Labs, Inc.
                    http://melabs.com

                    Comment


                    • #11
                      1) with D-Stick connected to USB but not inserted into any board.. meProg with PIC18F47K40 selected, clicking Program>Get Target Information returns:
                      "melabs On-Board Programmer"
                      "Firmware version is 6.6."
                      "Target Device ID is 0000." (this was FFFF yesterday)
                      "Target device does not match selected device."

                      2) The PCB on the D-Stick has black solder-mask.

                      3) I suppose it's possible it is simply a defective module.. (maybe this will become clearer with this troubleshooting)

                      4) I used the U2 programmer and did a Program>Erase on the D-Stick.. which it said was successful

                      5) I reattached the D-Stick to the USB and relaunched the meProg and clicked Program>Get Target Information.. It returned the correct response..
                      "melabs On-Board Programmer"
                      "Firmware version is 6.6."
                      "Target Device ID is 6900."
                      "Target device matches selected device."

                      6) I launched MicroCode Studio Plus, clicked ICD Compile Program (it complies and launches meProg) then clicked the "Program" icon.. it turns on the Red LED on the D-Stick and says "Program/Verify complete"

                      7) I then click the "Run" button on MicroCode Studio Plus, it returns with:
                      "ICD CONNECTION TIMEOUT"
                      "MicroCode Studio was unable to connect to the PIC microcontroller executing the ICD code"

                      8) Looking at device manager Ports (COM & LPT) shows the virtual COM port:
                      "MELABS COM Port (COM5)

                      9) Looking at device manager Human Interface Devices shows several "HID-compliant device" and several "USB Input Device" .. with no specific descriptions.

                      10) As another test, I did a straight Compile Program & programmed the D-Stick with the example BLINK.PBP which it said it programmed successfully, and when I then power up the D-Stick on my protoboard with 5V & Gnd provided and no USB attached, it toggles PORTB.0 (rate is uncalibrated due to the example not using the DEFINE OSC directive and thus assuming 4Mhz)

                      So, It looks like erasing the D-Stick with the U2 programmer fixed the programming problem, but it looks like there's still a problem with the D-Stick connecting to MicroCode Studio for debugging..
                      I did order two more Advanced D-Sticks with second day delivery.. I'll be able to try another module in a couple of days.
                      Thanks very much for your help with this..

                      Comment


                      • #12
                        Sounds like progress. The on-board programmer is working.

                        You can test the serial connection by writing an HSEROUT command into a program on the D-Stick and sending some text. Use the Microcode Serial Communicator (or your favorite terminal emulation software) to receive the text. The serial signals can be scoped on the RC6/RC7 pins of the D-Stick. They connect to the on-board programmer which converts to USB.
                        Charles Leo
                        ME Labs, Inc.
                        http://melabs.com

                        Comment


                        • #13
                          The HSER.PBP does indeed send out "Hello World" into the Serial Communicator.
                          Using DEFINE OSC 64 and DEFINE HSER_BAUD 9600 I get 9600 baud Hello World perfectly. (BTW.. HSER_BAUD 2400 does not work.. evidently there's a lower limit)
                          I can not however see any signals on RC7 (Rxd into the '47K40) when I try to transmit characters using the Serial Communicator.. it's always just marking (at a high level on RC7, pin 26)
                          Best guess.. some kind of problem on the module?

                          Comment


                          • #14
                            Could the the USB cable be involved?
                            I just got the two new D-Sticks. They came with USB cables, and I used a new D-Stick with a new USB cable and it programs and connects to MicroCode Studio
                            I went back and put the original (not working D-Stick) on the new cable and that D-Stick works now..
                            Went back one more time, and used the original USB cable with the original D-Stick, and it'll program, but not connect with MicroCode studio.. BUT NOW THIS SETUP IS WORKING FINE
                            It seems there have been some kind of intermittent connection? that plugging in and out multiple times may have fixed??

                            In any case it seems I'm in the saddle at this point.. Thanks for help!.. I'll keep you posted how things are going!

                            Comment


                            • #15
                              I've encountered a few USB cables with mystery problems, for sure.

                              The other thing in play is the ICD-model file for the 18F47K40, which I created using the Microcode Studio Plus utility for that purpose. I know it's hard to imagine, but I may have written some code with a bug in it.

                              Keep me informed if intermittent problems persist. I'm underwater at the moment, but I can test and review the file when I get some time.
                              Charles Leo
                              ME Labs, Inc.
                              http://melabs.com

                              Comment

                              Working...
                              X