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 support@ccsinfo.com

Looking for source code for PC side of USB Bootloader

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
RogerM



Joined: 07 Jun 2004
Posts: 10

View user's profile Send private message

Looking for source code for PC side of USB Bootloader
PostPosted: Tue Sep 12, 2017 8:29 pm     Reply with quote

I have used the USB Bootloader in a number of cases with the CCS utilities but want to include the process in my own PC side program to make it a little easier for my users. If the code is available I would prefer to use it rather than having to reverse engineer it from the PIC side.

I'm probably going to do the PC side in python but C source would be good.

Roger
Ttelmah



Joined: 11 Mar 2010
Posts: 19255

View user's profile Send private message

PostPosted: Wed Sep 13, 2017 11:21 am     Reply with quote

You just send the hex file out the serial. Only important thing is you must enable flow control, since the bootloader has to stop you sending while it writes. You can even do it from the command line by just copying the file to the serial port, provided you have already enabled the flow control.
In c#, you can just use:

File.Copy(@"c:\boot.hex", "com1");

In MS C, you can do a similar thing using the shell, but you then need to have used a mode statement to have setup the port first.
RogerM



Joined: 07 Jun 2004
Posts: 10

View user's profile Send private message

PostPosted: Wed Sep 13, 2017 11:54 am     Reply with quote

Thanks. I was over complicating it.
I can wrap that to make it friendly

Roger
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Wed Sep 13, 2017 12:09 pm     Reply with quote

Hi,

CCS also supplies an executable 'CCSBootlader.exe' that is a command line utility used to invoke bootloading. I wrote a Windows GUI 'front-end' program in VB6 (gasp!) for my customers. The front-end allows them to select the appropriate .hex file, and COM port. Makes firmware updating a breeze!
_________________
John

If it's worth doing, it's worth doing in real hardware!
RogerM



Joined: 07 Jun 2004
Posts: 10

View user's profile Send private message

PostPosted: Fri Sep 15, 2017 5:08 pm     Reply with quote

My object was to do something like ezflyr but I wanted to "help" in finding the right USB port (on my Win 10 Dev machine that allocation of the COM port IDs is not consistent and for example a particular USB port might be COM 10 one time and COM7 another) and file so I did it all in Python and it works. I need to tidy up some items but it is looking good.

What I did notice was the CCS Bootloader does not read the "information" lines in the .HEX file that come after the EOF record so I got an error message from the Python serial USB I/O because the Boot loader on the PIC had 'gone away' so I test for the EOF record and don't transmit anything after that. A little more troubling was the CCS routines do a check sum verification on each line and do an error return if they find a failure. A straight file copy does not find this so some additional code is required. I'm a little curious to know how often this might occur?
Ttelmah



Joined: 11 Mar 2010
Posts: 19255

View user's profile Send private message

PostPosted: Sat Sep 16, 2017 1:32 am     Reply with quote

In my own code that connects to the serial, I open the registry for the CCS device:

SYSTEM\CurrentControlSet\Enum\USB\VID_2405&PID_000C

Then for each Sub Key Name in this branch I open the 'Device Parameters' entry, and read the Portname. If there is only one, I open it, if more, I offer the user these ports only.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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