CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Command line for ICD interface - factory programming
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jeremiah



Joined: 20 Jul 2010
Posts: 1360

View user's profile Send private message

PostPosted: Mon Jan 13, 2025 3:26 pm     Reply with quote

Just a heads up. Necro'ing a year old thread is usually very bad form. It can lead to a lot of confusion in discussion and responses. In the future, it is probably better to start your own thread or it might go off the rails occasionally (plus it is good forum etiquette to not necro a thread).

For your questions: I don't know of a command line way to query which device is connected. If you are feeling froggy you could look into how to ask the OS what USB devices are connected and parse it that way. There should be some identifying which device is connected. You could then call that custom program from your script

I don't know the answer to your MODE question, but I've rarely seen a program take a command line switch twice and use both. They usually pick either the first or the second one and ignore the other.

Most of us don't do this via command line (using chip programmers that is), so my best advice is to contact CCS support directly (I recommend through phone so you can chat with someone). There's a chance they have some hidden options that are not publicized or they may have an internal document that may be more detailed. At the very least they should be able to answer questions for ya.

Sorry I don't have better answers for you than that.
newguy



Joined: 24 Jun 2004
Posts: 1912

View user's profile Send private message

PostPosted: Mon Jan 13, 2025 4:15 pm     Reply with quote

Want to echo what jeremiah has said: not many people here use the CLI. I can tell you that about a decade ago a colleague of mine did wade through the CLI of the Load-n-Go when he implemented support for it in what was supposed to be an idiot-proof custom app he was tasked to create. He got it to work very well, but I do believe he had to contact CCS directly for some undocumented details.

CCS is very good regarding answering any query you might have.
Ttelmah



Joined: 11 Mar 2010
Posts: 19600

View user's profile Send private message

PostPosted: Tue Jan 14, 2025 7:10 am     Reply with quote

In my own code scanning for my devices connected, I open the registry
SYSTEM/CurrentControlSet/Enum/USB
and look for the VID/PID combinations of my devices. This though in C++
or Python.
I don't know if there is a sneaky way of doing this in the CLI.

Thinking more about it, you can get a list of the USB devices in PowerShell.
I think it'd be:

Get-PnpDevice -PresentOnly | Where-Object { $_.InstanceId -match '^USB' }

You could then parse this for the devices you want.
temtronic



Joined: 01 Jul 2010
Posts: 9278
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jan 14, 2025 8:24 am     Reply with quote

sigh,all I know is things were simpler, easier when PCs had real RS-232 ports and an OS that allowed direct access to them.... last was WIWN98SE ?
I'm also confused as to where this post has gone.....
Jansen



Joined: 22 Jan 2018
Posts: 12

View user's profile Send private message

PostPosted: Tue Jan 14, 2025 10:10 am     Reply with quote

Sorry, I didn't realize posting to a thread a little less than a year old that didn't appear answered (at least to me) would be considered necro'ing. The title 'Command line for ICD interface - factory programming' is exactly what I'm attempting to do, just with a Prime8 instead of an ICD-U64.

The folks at support helped me get the connection test command to work for validating the programmer (not the connected target). Use the +T command option. While that worked, it returns an error. Using +TEST does the same thing, but without the error.
This helped me figured out my issue using the VERBOSE option. I needed the leading argument characters, +.
So, I added + to the start of all my command line arguments. The resulting verbose dump shows that the Prime8 is not powering the targets. Running the same command line with the LoadnGo and the target does get powered. (However the LoadnGo may use the voltage as set by its internal jumper, NOT the command line argument for voltage.)
So, why doesn't the Prime8 power the target when commanded by ccsloader? I have posted this to support, but posted here to share the info.

Here's a capture of what I'm seeing now:
Code:

C:\temp\ccsDev>ccsCLI.bat

C:\temp\ccsDev>"C:\Program Files (x86)\PICC\"ccsloader.exe +VERBOSE +DIR="C:\temp\ccsDev\" +PORT=USB* +DEVICE=PIC18LF6722 +SLOT=1,2,3,4,5,6,7,8 +VOLTAGE=5.00 +POWER=TARGET +MODE=BULK_ERASE +MODE=ERASE_ON_ERROR +AREAS=PDC +WRITE=myCode.hex
...10:33:17  Param: +VERBOSE
...10:33:17  Param: +DIR=C:\temp\ccsDev\
...10:33:17  Param: +PORT=USB*
...10:33:17  Param: +DEVICE=PIC18LF6722
...10:33:17  Param: +SLOT=1,2,3,4,5,6,7,8
...10:33:17  Param: +VOLTAGE=5.00           <------
...10:33:17  Param: +POWER=TARGET           <------
...10:33:17  Param: +MODE=BULK_ERASE
...10:33:17  Param: +MODE=ERASE_ON_ERROR
...10:33:17  Param: +AREAS=PDC
...10:33:17  Param: +WRITE=myCode.hex
Connecting
Connected to Prime-8, Version m3.22 / s3.60, Port=USB#FT4C10V9
...10:33:17  Attempting to connect   USB*
...10:33:23  DLL version 5.084
...10:33:23  EXE version 5.085
...10:33:23  Scanning file: myCode.hex
...10:33:23  Assigning chip: PIC18LF6722
...10:33:23  Loaded: PIC18LF6722
...10:33:23  Target Vdd = 0.00              <------
...10:33:23  Setting Vpp=0                  <------
...10:33:23  Target Vdd = 0.00              <------
...10:33:23  Setting Vpp=0                  <------
...10:33:23  Scanning file: myCode.hex
...10:33:23  Assigning chip: PIC18LF6722
...10:33:23  Loaded: PIC18LF6722
...10:33:23  Target Vdd = 0.00
...10:33:23  Setting Vpp=0
...10:33:24  Target Vdd = 0.00
...10:33:24  Setting Vpp=0
Programming PIC18LF6722

Erasing Target....................
Write Data: myCode.hex....................
Verify Data: myCode.hex.......................10:33:24  Assigning chip: PIC18LF6722
...10:33:24  Loaded: PIC18LF6722
...10:33:24  Target Vdd = 0.00
...10:33:24  Setting Vpp=0
...10:33:24  Target Vdd = 0.00
...10:33:24  Setting Vpp=0
...10:33:24  Write FILE -> CHIP
...10:33:39  Slot 1, Failed Target Compare
...10:33:39  Slot 2, Failed Target Compare
...10:33:39  Slot 3, Failed Target Compare
...10:33:39  Slot 4, Failed Target Compare
...10:33:39  Slot 5, Failed Target Compare
...10:33:39  Slot 6, Failed Target Compare
...10:33:39  Slot 7, Failed Target Compare
...10:33:39  Slot 8, Failed Target Compare
...10:33:39  Setting Vpp=0
...10:34:01  Set VPP Error: Could not hold the target in reset : No response from the ICD

Error: Failed slots: 1,2,3,4,5,6,7,8
Result: 65284

C:\temp\ccsDev>
temtronic



Joined: 01 Jul 2010
Posts: 9278
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jan 14, 2025 10:51 am     Reply with quote

I don't have a Prime8 but.. have used Pickey3 for years. One 'option' is to have it power the target OR target has it's own VDD, the 'problem' is the Pickit3 is low power output.

Prime8 seems to program 8 targets, so there HAS to be 'some' command to say which ones and an 'option' to power that target ??
That info should be in the manual somewhere.....
if not ask CCS, they made the unit .
jeremiah



Joined: 20 Jul 2010
Posts: 1360

View user's profile Send private message

PostPosted: Tue Jan 14, 2025 11:06 am     Reply with quote

Jansen wrote:
Sorry, I didn't realize posting to a thread a little less than a year old that didn't appear answered (at least to me) would be considered necro'ing. The title 'Command line for ICD interface - factory programming' is exactly what I'm attempting to do, just with a Prime8 instead of an ICD-U64.


No problem! Just keep in mind that thread necromancy has nothing to do with whether or not the original question gets answered, but whether or not a dead conversion was brought back to life (especially by someone other than the OP). It leads to all kinds of confusion (especially if the OPs setup is different than the setup of the person resurrecting it). It makes it super easy for folks to mix up whose post is related to the issue and then they end up answering the wrong questions.

It's definitely a good practice for the future to open your own thread and if you want to reference an older existing thread, just link it in your thread for reference. No biggie this time, but just keep it in your back pocket for next time.

Jansen wrote:

So, why doesn't the Prime8 power the target when commanded by ccsloader?

If you are giving the command line option and the docs say that prime8 supports that option, my suggestion is to report it to CCS support. Again I recommend by phone. The reason I suggest this, is CCS has been really good in the past for me in doing a quick bug fix and sending me a fixed version of the file. So hopefully they can do that for you to get you on your way to automated programming.
Ttelmah



Joined: 11 Mar 2010
Posts: 19600

View user's profile Send private message

PostPosted: Tue Jan 14, 2025 11:36 am     Reply with quote

The Prime 8 has variable output voltage, so there would need to be a
specification of the voltage as well as a simple enable. Are you sure the
format for this takes a FP value as you show?. Looks to me as if it might
be taking the 00 after the decimal.
Most command line values take integers, so possibly something like
=500, not 5.00.....

No, just checked the CCSLoad manual, and it says n.nn
I suspect it is the slot number here that is the problem. As Jay says, being
an 8 port device, possibly there needs to be something else to specify
which port the voltage is being set for.
Equally possibly the driver just is not supporting this for this device.
Definitely a call to CCS needed here.

Er. Looking at what you post, why are you not using SLOT=ALL?, and
you are specifying POWER=TARGET, so of course the programmer will
not provide power. POWER=ZIF is the mode to feed power to the socket.
Jansen



Joined: 22 Jan 2018
Posts: 12

View user's profile Send private message

PostPosted: Tue Jan 14, 2025 12:51 pm     Reply with quote

Quote:
and you are specifying POWER=TARGET, so of course the programmer will not provide power.

Since the help text doesn't actually say which power option does what, I assumed no power option on the command line was for don't power the target from the Prime8 and Power=Target was to turn on power for each slot selected. Bad assumption.
I tried ZIF as you mention. It still fails, but doesn't show the Target Vdd or Setting Vpp lines in the output.
I tried ICSP and that worked.Shocked I'm sure I tried this before, but likely had other issues with my command line. And yes, I still don't have 8 good boards to develop this with.

Here is what I now have.
Code:
C:\temp\ccsDev>"C:\Program Files (x86)\PICC\"ccsloader.exe +VERBOSE +DIR="C:\temp\ccsDev\" +PORT=USB* +DEVICE=PIC18LF6722 +SLOT=1,2,3,4,5,6,7,8 +VOLTAGE=5.00 +POWER=ICSP +MODE=BULK_ERASE +AREAS=PDC +WRITE=myCode.hex
...13:30:12  Param: +VERBOSE
...13:30:12  Param: +DIR=C:\temp\ccsDev\
...13:30:12  Param: +PORT=USB*
...13:30:12  Param: +DEVICE=PIC18LF6722
...13:30:12  Param: +SLOT=1,2,3,4,5,6,7,8
...13:30:12  Param: +VOLTAGE=5.00
...13:30:12  Param: +POWER=ICSP
...13:30:12  Param: +MODE=BULK_ERASE
...13:30:12  Param: +AREAS=PDC
...13:30:12  Param: +WRITE=myCode.hex
Connecting
Connected to Prime-8, Version m3.22 / s3.60, Port=USB#FT4C10V9
...13:30:12  Attempting to connect   USB*
...13:30:18  DLL version 5.084
...13:30:18  EXE version 5.085
...13:30:18  Scanning file: myCode.hex
...13:30:18  Assigning chip: PIC18LF6722
...13:30:18  Loaded: PIC18LF6722
...13:30:18  Scanning file: myCode.hex
...13:30:18  Assigning chip: PIC18LF6722
...13:30:18  Loaded: PIC18LF6722
Programming PIC18LF6722

Erasing Target....................
Write Data: myCode.hex....................
Verify Data: myCode.hex.......................13:30:18  Assigning chip: PIC18LF6722
...13:30:18  Loaded: PIC18LF6722
...13:30:18  Write FILE -> CHIP
...13:30:23  Slot 1, Pass
...13:30:23  Slot 2, Failed Verify
...13:30:23  Slot 3, Pass
...13:30:23  Slot 4, Failed Verify
...13:30:23  Slot 5, Failed Verify
...13:30:23  Slot 6, Failed Verify
...13:30:23  Slot 7, Pass
...13:30:23  Slot 8, Pass
...13:30:23  Setting Vpp=0

Error: Failed slots: 2,4,5,6
Result: 14852

C:\temp\ccsDev>

I can work with this!

Regarding the SLOT option, I've tried various schemes including ALL but until now nothing was working. I'll likely go back to ALL to simplify this.

Thanks for the help and bearing with me through this issue.
Best Regards!
temtronic



Joined: 01 Jul 2010
Posts: 9278
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jan 14, 2025 3:52 pm     Reply with quote

curious, had a quick read of Prime8 on CCS website.
each of the 8 ports can supply 200ma, 2-5 volts
so.... there must be a way to select what voltage EACH port requires .
something like port1=5.00, port2=3.30,port3=3.30,...... ?? Maybe allport=5.00 ??

one thing for sure, whatever their 'default' settings are will NOT be what YOU need !!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group