PDA

View Full Version : Bootloader that can load using SPI or RS-232 without using a computer



Christopher4187
- 7th February 2016, 01:13
I searched the forums and found a little bit of information but nothing that fits exactly what I need. Is there a way to load a hex file into an 18F without the use of a computer using SPI or RS-232? Not concerned about security or the smaller details at the moment - just curious if it can be done.

HenrikOlsson
- 7th February 2016, 07:32
So you DON'T want to use either a computer, SPI or RS-232, is that correct? Or do you mean that you DO want to use SPI or RS-232 just NOT from a computer?

This isn't actually bootloading but the result, I think, is what you're after: One way to do it is to get a PICKit3 and use its Programmer-To-Go feature. You download the firmware file into the PICKit3, in the field you connect the PICKit3 to the programming header on your board and press the button - done. You do need to supply power the PICKit3 thru its USB connector but its just power, no data.

/Henrik

towlerg
- 7th February 2016, 17:04
To add to Henrik's remarks. A PicKit2 will do the same job and the USB supply can come from either a USB "brick" or a USB power bank.

George

Christopher4187
- 8th February 2016, 04:18
A PicKit2 wouldn't work. If another IC had SPI, RS-232 or some other communication protocol that would work, could that IC load the HEX file onto the PIC without human intervention?

HenrikOlsson
- 8th February 2016, 06:52
You're being quite vague IMHO, secret government project? :-)
You say no human intervention....so who's deciding when to load the new firmware?

Abyway, in theory yes. As long as the PIC can program its own memory you can create a bootloader that reads the .hex file from "anywhere" (USB, SPI, RS232, I2C, parallel bus, whatever using whatever protocol). But remember that it's actually the PIC itself that is loading/programming itself with "information" from the other device - its not the other device that is "programming" the PIC.

There are, for example, bootloaders available which reads the code from a memory card (CF, SD, MMC etc). I don't know of any written in PBP though.

/Henrik.

richard
- 8th February 2016, 08:21
a winbond flash chip (w25q32bv or similar) mounted in a sd shell would be nice . you could have the utility of a sd card slot without all the overhead of a sd fat-16 file system .

HenrikOlsson
- 8th February 2016, 10:56
I don't have any experience with memory cards outside of my digital camera etc but can't you use it basically as a "raw" memory simply by NOT formatting as FAT or whatever. I mean the protocol is likely (haven't looked it up) different than a simple SPI flash IC and without a "proper" file system you won't be able to read/write it from the PC but you can't really do that (easily in this context) with a "raw" SPI flash IC either so what's the difference?

/Henrik.

Christopher4187
- 8th February 2016, 11:33
You say no human intervention....so who's deciding when to load the new firmware?I meant there wouldn't be anyone physically at the device. The device has internet connectivity so the HEX files can be transferred that way.


There are, for example, bootloaders available which reads the code from a memory card (CF, SD, MMC etc). I don't know of any written in PBP though.This would be a good kickstarter project. Any takers?

richard
- 9th February 2016, 00:09
I don't have any experience with memory cards outside of my digital camera etc but can't you use it basically as a "raw" memory simply by NOT formatting as FAT or whatever. I mean the protocol is likely (haven't looked it up) different than a simple SPI flash IC and without a "proper" file system you won't be able to read/write it from the PC but you can't really do that (easily in this context) with a "raw" SPI flash IC either so what's the difference?

/Henrik.

only code size , simplicity and 8 bit mcu friendliness . plus I already know how to talk to a spi flash chip a quick look a sd protocol looks involved

http://alumni.cs.ucr.edu/~amitra/sdcard/Additional/sdcard_appnote_foust.pdf

http://www.microchip.com/forums/m530149.a