callwyat / mplab-extension

Build, Program, and Debug MPLAB Projects from the comfort of VS Code
Other
22 stars 9 forks source link

Programming in High Voltage Mode #30

Open nate-plxs opened 1 week ago

nate-plxs commented 1 week ago

I am trying to use the following launch configuration to program in high voltage mode.

        {
            "name": "(prod) PIC (MDB)",
            "type": "mdb",
            "request": "launch",
            "filePath": "${command:cmake.launchTargetPath}",
            "device": "PIC18F66K40",
            "toolType": "pickit5",
            "toolOptions": {
                "programoptions.pgmentry.voltage": "high",
                "system.yestoalldialog": "true"
            },
            "stopOnEntry": true,
        },

I get this message in VS Code Debug Console, but am not sure how to accept or continue. I had added the system.yestoalldialog option to try and get past this, but it didn't appear to have an effect.

CAUTION: Check that the device selected in MPLAB IDE (PIC18F66K40) is the same one that is physically attached to the debug tool. Selecting a 5V device when a 3.3V device is connected can result in damage to the device when the debugger checks the device ID. Do you wish to continue?

NOTE: If you would like to program this device using low voltage programming, select Cancel on this dialog. Then go to the PICkit 5 node of the project properties and check the Enable Low Voltage Programming check box of the Program Options Option Category pane (low voltage programming is not valid for debugging operations).

Any ideas?

callwyat commented 1 week ago

Oh man, that is a tricky one! If you are only trying to program, I’m not sure how I’d get around this. Where it looks like you are debugging though, it should be possible to address this. I’ll see if I can catch this and raise a message.

In the mean time, you might be able to accept that message in MPLABX, and the extension will run with it, but that is a long shot.

nate-plxs commented 1 week ago

Thanks for the response!

VS Code does prompt me when this happens with the message pasted above. However, it only gives me the option to cancel or open the launch.json file, not continue or click okay.

callwyat commented 1 week ago

I am having a hard time getting that message to pop up, can you send me the whole log for when this occurs? I know I have seen this before in MPLABX, I just can't remember what I was using.

nate-plxs commented 6 days ago

Here is a snippet of the pop up I do currently get if I try to use high voltage programming. image

And this is the Debug Console from VS Code Output.

>Device PIC18F66K40
set programoptions.pgmentry.voltage high

>HwTool pickit5

>

*****************************************************

CAUTION: Check that the device selected in MPLAB IDE (PIC18F66K40) is the same one that is physically attached to the debug tool. Selecting a 5V device when a 3.3V device is connected can result in damage to the device when the debugger checks the device ID. Do you wish to continue?

NOTE: If you would like to program this device using low voltage programming, select Cancel on this dialog. Then go to the PICkit 5 node of the project properties and check the Enable Low Voltage Programming check box of the Program Options Option Category pane (low voltage programming is not valid for debugging operations).

>

While it looks like there's a prompt there, I haven't been able to enter something into that console.

Note, if I do have set system.yestoalldialog true in the launch.json options, I do see that in the Debug Console. But this run above did not try to set that.

callwyat commented 6 days ago

This is perfect! Thanks you! I am struggling to figure out how to send this message back to VSCode :/ One thought was to send it as a breakpoint, so pressing play/resume would accept the prompt and continue. Do you think that is acceptable? Or do you think it needs a full on dialog?

nate-plxs commented 5 days ago

It seems like the message is already being sent to VS Code in the snippet of the prompt I sent above. It seems like that pop up should be able to have an okay or proceed button added to it.

If sending a breakpoint didn't provide the dialog, I think it's a little risky that someone now does high voltage programming without realizing it and damages their device.

callwyat commented 4 days ago

Ahh man, I wish I could figure out how to customize that prompt. Right now it is being generated because the Debug Adapter throws an exception, leaving it in an in recoverable state.

I’ll keep looking to see if there is a way for the Debug Adapter to tell VSCode to show a prompt and send back the result.

callwyat commented 1 hour ago

Alright, I have published pre-release version 0.2.3. This version will scan the out from the Microchip Debugger for any questions from the tool and forward them to the user. It does not currently support remembering the answer, so it will prompt you every time you program, but you will be able to move forward again. Let me know if you run into any issues with the current system.

I ended up needing to make a custom Debug Adapter Message, which is not ideal because means any IDE that uses this adapter will need to implement this custom command as well, but for the time being, this is only used by VSCode as far as I know.

callwyat commented 1 hour ago