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 1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
robleso7473



Joined: 25 Mar 2009
Posts: 47

View user's profile Send private message

Command line for ICD interface - factory programming
PostPosted: Tue Feb 06, 2024 2:51 pm     Reply with quote

Hello once again,

I thought my yearly CCS forum visit was satisfied last month but here I am again!

So, I am close to launching my first product and I'm still working out the factory testing details. One thing I've not settled on is how I will program my MCU. On the bench I just fire up CCS info compiler and run the ICD interface app to program my targets, BUT in the factory I want to integrate the programming operation into some python or even command line interface. The plan is to use the ICD-U64 as the programmer connected to my production target MCU.

The big question: can I run ICD Interface from within Python or command line?

Why I want to do it this way:
I want to simplify the interface for the factory worker where they don't have to crack open ICD Interface app separately and have them accidentally click on some button that will mess up the entire programming operation.

Any thoughts and/or ideas?

Thanks much,
O
robleso7473



Joined: 25 Mar 2009
Posts: 47

View user's profile Send private message

PostPosted: Tue Feb 06, 2024 5:26 pm     Reply with quote

Maybe I'm going to answer my own question but is ccsloader the command line version of the GUI ccsload? Was not easy to find this information if that's the case.
O.
temtronic



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

View user's profile Send private message

PostPosted: Tue Feb 06, 2024 6:29 pm     Reply with quote

from their website...ccsload..
Command Line Options

OS Support - Powerful Controls through Windows or Linux
Operational Settings - Specified at the Execution Level
Easy Set-up - Perform Tasks like Save, Set Target VDD, and more...
Presets - Operational or Control Settings
Batch Files - Simplify Routine or Repetitive Programming

so you 'should' be able to .

In the MSDOS days, you'd create 'batch' file which had the executable file(exe) with options, make an icon, save on desktop. DBL click to run the program.

I'm a dinosaur but I suspect someone can show that this IS possible ?
robleso7473



Joined: 25 Mar 2009
Posts: 47

View user's profile Send private message

PostPosted: Tue Feb 06, 2024 7:13 pm     Reply with quote

Thanks temtronic.
leach67



Joined: 13 Feb 2024
Posts: 3

View user's profile Send private message

PostPosted: Fri Feb 16, 2024 5:48 am     Reply with quote

temtronic wrote:
from their website...ccsload..
Command Line Options

OS Support - Powerful Controls through Windows or Linux
Operational Settings - Specified at the Execution Level
Easy Set-up - Perform Tasks like Save, Set Target VDD, and more...
Presets - Operational or Control Settings
Batch Files - Simplify Routine or Repetitive Programming

so you 'should' be able to .

In the MSDOS days, you'd create 'batch' file which had the executable file(exe) with options, make an icon, save on desktop. DBL click to run the program.

I'm a dinosaur but I suspect someone can show that this IS possible ?


informative... much thanks for this.!
Jansen



Joined: 22 Jan 2018
Posts: 13

View user's profile Send private message

PostPosted: Wed Jan 08, 2025 6:29 pm     Reply with quote

I'm developing a production app that will call out to ccsloader.exe. Here's a batch file that will connect to a LoadnGo at least. It will likely work with the U64. Eventually, I plan to work with the Prime8, but I don't have one available to develop with at the moment.

It currently does several things. You can REM out the different sections to test one at a time. I may need to use the connection test first then the write file to target for better control

Code:

@echo off
set EXEPATH="C:\Program Files (x86)\PICC\"
set EXENAME="ccsloader.exe"
set WORKPATH="C:\BoardProgrammer\"
set HEXFILE="target-v.01.02.03.hex"
set TARGETDEVICE=PIC18LF6722
set TARGETPOWER=3.3
set USBPORT=USB*
REM set USBPORT=USB#PLWQS5E8 - if you know the specific USB name of your programmer you can use that.

REM PROGRAM FILE TO TARGET
@echo on
%EXEPATH%%EXENAME% DIR=%WORKPATH% PORT=%USBPORT% SLOT=ALL VERBOSE POWER=TARGET VOLTAGE=%TARGETPOWER% AREAS=PDC MODE=BULK_ERASE MODE=ERASE_ON_ERROR DEVICE=%TARGETDEVICE% WRITE=%HEXFILE%
@echo off

REM 0=Success
REM 1=Failed to connect to programmer
REM 4=Operation failed - Write, read, verify,
echo Result: %errorlevel%

REM VERIFY FILE
@echo on
%EXEPATH%%EXENAME% DIR=%WORKPATH% PORT=%USBPORT% SLOT=ALL VERBOSE POWER=TARGET VOLTAGE=%TARGETPOWER% DEVICE=%TARGETDEVICE% AREAS=PDC VERIFY=%HEXFILE%
@echo off
echo Result: %errorlevel%

REM TEST CONNECTION
@echo on
%EXEPATH%%EXENAME% DIR=%WORKPATH% PORT=%USBPORT% SLOT=ALL VERBOSE POWER=TARGET VOLTAGE=%TARGETPOWER% TEST=PIC18LF6722
@echo off
echo Result: %errorlevel%

REM TEST AND PROGRAM in one command
@echo on
%EXEPATH%%EXENAME% DIR=%WORKPATH% PORT=%USBPORT% SLOT=ALL VERBOSE POWER=TARGET VOLTAGE=%TARGETPOWER% TEST=PIC18LF6722 MODE=BULK_ERASE MODE=ERASE_ON_ERROR DEVICE=%TARGETDEVICE% AREAS=PDC WRITE=%HEXFILE% 
@echo oFF

echo Result: %errorlevel%

REM OPEN HELP BROWSER
%EXEPATH%%EXENAME% /Help


Actually, I don't believe 'VERBOSE' does anything.

Now that I have this working, I need to add launching it and parsing stdout in my app to show pass/fail and any error output. For PRIME8 I hope to be able to catch which ports are connected and which ports passed/failed.
Is there a means to query what type of programmer is attached?
I'd like to be able to programmatically select either U64 or Prime8 or even LoadnGo. The output from the Prime8 I expect will include per port results. I should have one tomorrow to develop with.

I do know for speed, not all target chips automatically use full chip erasing in ccsload. This can cause programming fails if you use the PICs code protect config bits. I'm hoping the MODE=BULK_ERASE forces a full chip erase every time for all targets.

Does using the MODE option twice on one command line support both?
temtronic



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

View user's profile Send private message

PostPosted: Wed Jan 08, 2025 8:02 pm     Reply with quote

I don't use any of those but....perhaps....

VERBOSE , at least in the dinodays, meant that when you sent a command to a device, the response was returned in a phrase as opposed to a number.
IE when 'commanding' a modem to change a register, it usually responds '0' but if 'verbose' was enabled 'OK cr lf' is returned.

Hopefully somewhere in the 'documentation' you have, it explains this ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19615

View user's profile Send private message

PostPosted: Thu Jan 09, 2025 2:51 am     Reply with quote

In IBM Unix C, there use to be an include file, for 'VERBOSE', so that if this
was #defined, the output messages were displayed, while if not these were
suppressed. Adding it to the command line in the compile. #defined it.
That include (very slightly altered, but basically the same), is available in
GitHub at:
[url]
https://gist.github.com/AndrewGuenther/9257752
[/url]
Many of the standard utilities in the OS, had an option that if VERBOSE
was included in the command line, they gave more detailed messages.
It is one of those things that a few parts still support, but little now does.
Jansen



Joined: 22 Jan 2018
Posts: 13

View user's profile Send private message

PostPosted: Thu Jan 09, 2025 1:21 pm     Reply with quote

Quote:
Actually, I don't believe 'VERBOSE' does anything.

This statement is from observed output from ccsloader.exe. Adding VERBOSE to the command line did not appear to actually change or increase the output, even though the manual says it does.

Quote:
VERBOSE | Enables additional error information when using the command line CCSLOAD. This is the same information as seen in the GUI when clicking on the status bar info button.


Granted even the GUI is rather terse with error information, IMO.
temtronic



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

View user's profile Send private message

PostPosted: Thu Jan 09, 2025 3:12 pm     Reply with quote

hmm..re: Enables additional error information when using the command line CCSLOAD.

.. if there's no errors , no messages are sent , and of course no additional ones if VERBOSE was enabled....

One test... make it 'error' somehow, see what's reported, then enable VERBOSE, run again and see what NEW information is reported.
Jansen



Joined: 22 Jan 2018
Posts: 13

View user's profile Send private message

PostPosted: Thu Jan 09, 2025 3:30 pm     Reply with quote

Been doing that with no difference in output.
You folks are focused on a passing observation I made in my original post. Does anyone have a response to my actual questions?
Ttelmah



Joined: 11 Mar 2010
Posts: 19615

View user's profile Send private message

PostPosted: Fri Jan 10, 2025 2:25 am     Reply with quote

I think the reason we were not replying, was that nobody was sure what
the question was?.
You were referring to ICD.

CCSload, handles ICSP, _not_ ICD.
ICD, requires a debugger program, that interfaces to the ICD core uploaded
when ICD is specified. You need a complete program to interface with this
core, and the core itself to be loaded.
So you would have to have PCW on the system, with It's licensing data.
This can be loaded with a file specified, but nothing else, so any debugging
would require the user to use this. The program would have to be recompiled
with the debug option selected, and reloaded with the core attached.

Now the only command line system available that might be able to do this
is MPLAB IPECMDBoost, which was a utility that MicroChip has which allows
command line control of the MPLAB-X environment, but given you won't
know what actually wants to be done by the IDE, the code for this will
be hell. In fact this specifically says that 'Running IDE with this is not
supported', so 'no'.

However though talking about an ICD unit, you seem to only be wanting
to use ICSP. If so, CCSLoad will handle this fine, and can be driven by
the command line.
temtronic



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

View user's profile Send private message

PostPosted: Fri Jan 10, 2025 7:52 am     Reply with quote

One problem I have, being a dinosaur', is that 'Jansen' asked something in 'Robs' post which threw me for awhile. In my mind ,I see a PC--> programmer--> product with PIC but he talks about THREE different 'programmers'. That,to me ,says that THREE different PC programs have to be created to talk to them, so overall, seems very 'time consuming' compared to using just one programmer, known to work. Of course I don't know the time it takes to do the actual task, connect target, press button,wait,done, disconnect, next..... or quantity of targets(10,10, 10,000 )? I looked up 'Prime8' and can see it would be 'complicated' to code a PC program to use the app to control the programmer.At the very least a LOT of time would be spent 'working out the bugs'.

It might have been better to start a new post,with better detail of what is required to avoid confusion.
Jansen



Joined: 22 Jan 2018
Posts: 13

View user's profile Send private message

PostPosted: Mon Jan 13, 2025 11:06 am     Reply with quote

Now that I have a Prime8 to develop with I found a few things:
    1. The SLOT parameter does not seem to work. Using SLOT=ALL is the only option that at least begins to work.
    2. When the CLI appears to not actually do the command, the returned errorlevel is 4. When it does appear to do something, the returned errorlevel is 65284 which is 0xff04. Is the ff byte supposed to be the slot bit mask? Note that 4 is likely the operation failed indication.
    3. Using MODE=ERASE_ON_ERROR seems to cause errors for the Prime8. Perhaps because I also have MODE=BULK_ERASE on the same command line.?? But using both MODE options with the LoadNGo does not seem to cause issues.
    4. The ERASE command returns immediately and does not seem to do anything, but returns no indication execpt errorlevel=0, which is Success.
    5. The VERIFY=BLANK command in the GUI requires only one slot selected, however for the CLI only SLOT=ALL appears to do anything, but even with zero targets connected to the Prime8 the CLI reports Chip 100% Erased.
    6. When programming appears to actually run, it always reports Failed slots:1,2,3,4,5,6,7,8. However, when I program using the GUI app with the same hardware setup, it shows 4 of the 8 target boards passed programming. (Yes, I don't have 8 good targets at the moment. Sad )

Has anyone else successfully used the CLI command with the Prime8?
Any suggestions would be appreciated.

Also, before using the batch file, I close the GUI app to prevent conflicts, but I have to power cycle the Prime8, too. Does that seem right?
Jansen



Joined: 22 Jan 2018
Posts: 13

View user's profile Send private message

PostPosted: Mon Jan 13, 2025 12:40 pm     Reply with quote

Ttelmah wrote:
CCSload, handles ICSP, _not_ ICD.

I used to have an ICD-U64 as mentioned in the original post on this thread. I used it with the CCSLOAD GUI app just like programming through a Load-n-Go via USB. Use of the ccsloader command line app was also mention before my post, so I thought my questions where related to the topic at hand.

temtronic wrote:
In my mind ,I see a PC--> programmer--> product with PIC but he talks about THREE different 'programmers'. That,to me ,says that THREE different PC programs have to be created to talk to them, ...

The ccsload and ccsloader programs as available from CCS supports all their programmers in one app and can be run from the command line. I have my own GUI app that launches a command line process for different programmers from CCS and Microchip for different target PIC processors. I use the old DOS batch file methods (because I'm old) to figure out what the command line needs to be when launched from my GUI app. My app then parses the standard out from that CLI process to post pass/fail/error indication to the user. This way I'm not tied to a specific vendor's GUI for my production app.

If I'm on the wrong forum or thread my bad. Where would be a better place to post?
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 1, 2, 3  Next
Page 1 of 3

 
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