News:

Let's find out together what makes a PIC Tick!

Main Menu

USB Bootloader for programing 18F2550

Started by Yves, Jun 05, 2021, 02:32 PM

Previous topic - Next topic

Yves

Hello all,

I believe that USB-capable Pics like the 18F2550 can be programmed using its USB port instead of Pickit 2 or 3. where could I download such a bootloader? This capability could simplify the circuit tremendously. Is the bootloader should be programmed initially using Pickit first?   

Cheers,

Yves
Yves

Picprogrammer

Hi,

Internal USB routines are very complicated because of many compliancy issues and the bootloader would end up taking a lot of memory space if it is not optimized well, because its usually done via so called HID. You also need USB analyzers to resolve any issues with the protocol. I'd suggest you take a look at FTDIchip products unless you are willing to develop your own driver interface. This seems to be very common practice on small quantity consumer devices on the market and allows you to integrate countless free UART bootloaders.

towlerg


Yves

Yves

Stephen Moss

Quote from: Yves on Jun 05, 2021, 02:32 PMHello all,

I believe that USB-capable Pics like the 18F2550 can be programmed using its USB port instead of Pickit 2 or 3. where could I download such a bootloader? This capability could simplify the circuit tremendously.   
I have a bootloader for the 18F4550 from an old undergraduate project run at work. It will probably work with the 2550 as they are almost identical devices and if it does not work only a small changes should be necessary to make it do so. I did not write or source the bootloader originally so would be unlikely to be of help if it does not work but it would give you something to go on, click here to download it (download button near top right corner).

Two buttons are required a "Reset" button connected to MCLR and a "Bootloader" button connected to RB4.
From the project documentation it looks like you may need to install the MCHPFSUSB_Setup.EXE from Microchip to get the drivers for their USB PIC Demo board unless you have another method of obtaining them (maybe Windows will automatically find them when you connect the device).
To put the PIC in Bootloader mode, hold down the "BOOTLOADER" button connected to RB4 and then press the "RESET" button. When in bootloader mode it will toggle pin D0, which can be seen if connected to an LED.
QuoteIs the bootloader should be programmed initially using Pickit first?
Yes, you will need to install the bootloader program into the PIC with a programmer of some kind before you can use it.

top204

#5
As has been stated here, a USB bootloader with the firmware inside the microcontroller is not a good idea because it takes quite a bit of code memory and RAM.

I'm hoping that Microchip eventually use the method of the new AVR devices for programming, that implement a single wire on the reset pin that acts like a built-in bootloader using Async coms. Now that will be excellent, and should have been implemented into PIC devices a decade ago, when bootlaoders really started to become common place, but Microchip being Microchip, they have very few developments of their own and will use the "Atmel" AVR mechanims because they now own AVR devices and the development is done for them, as they have done with virtually all of their semiconductor devices now. :-(

trastikata

There used to be a Wiki article written by Tim how to construct an USB bootloader in the old forum, maybe he can re-post it here?

Based on his work, I expanded it and built an "universal" for my needs USB bootloader, both FLASH and EEPROM based versions, together with a PC host application to flash the devices.

The way it works is that when the device is switched on, the bootloader firmware will wait 3 seconds and wait for communication (command) from the PC application. If there is none, then the bootloader jumps to the main program execution address, unless there is none or the last update was unsuccessful.   

Because in the bootloader code I set the fuses to write protect the bootloader area and the fuse configuration area, the user of my devices can always flash the main firmware again and can not render the device unusable. Thus the downside is that the fuses are pre-set in the bootloader and can not be changed in the main code if I wanted, but this is not really a problem since I compile the bootloader for each device according the needs of the project.

If Tim can't post the article again, I can post my code based on his article, however I am not using much of commenting and could be difficult to read.

Yves

That would be a great contribution if Tim could post his article again.

Regards,

Yves
Yves

John Drew

Joseph (Joesalibra) created a universal boot Loader which was on the old forum. He might also reload that onto the forum. How about it Joseph?
John

Yves

I agree,

There were a lot of good tips in the Wiki pages on the old forum. I wish some will be brought back.

Cheers,

Yves

Yves

joesaliba

Quote from: John Drew on Jun 07, 2021, 12:57 AMJoseph (Joesalibra) created a universal boot Loader which was on the old forum. He might also reload that onto the forum. How about it Joseph?
John

No John, it was not me. It was Joe Kaptan if I remember.

towlerg

#11
If memory is an issue look at 18F25K50, kindda of an upgraded 2550.

Accepting everything thats been said above, USB is far and away the easiest for end users. Although I suppose theres and argument that CDC is just as convenient.

TimB


I had not checked this thread out.

Not sure where my article is. I will look.

I have a few times implemented a USB bootloader. Its not hard, the biggest issue is the PC end. JohnB did that.

Tim

trastikata

Quote from: TimB on Jun 07, 2021, 04:43 PMIts not hard, the biggest issue is the PC end. JohnB did that.

This is not much of a problem either, I posted in the Wiki a framework for MS VB.Net how to handle two-way USB communication using the HID protocol, from there writing a PC application for sending the data to be written in the PIC is relatively easy and mostly question of understanding the FLASH structure of the device and the Microchip hex files.

towlerg

#14
As trastikata posted, once you've done it once USB on a PC really is not that difficult.

Cocoloco

Hi,
USB Bootloader for 18F,i will check for latest file in My Huge Backup from old Proton Forum. I ve worked on it with CaptainSlarty ten years agoes. instruction include.

the latest cover all usb PIC18F,i will Check if needed.

basiclover

found version 1.07a By Joe Hanley/Captainslarty downloadable from this dutch site
http://www.knutselaar.eu/WP/usb-bootloader-voor-18f2550-en-18f4550-voor-proton-basic/

wirecut

Leo.
Luck does not exist: there is a moment when talent meets opportunity. SENECA