View previous topic :: View next topic |
Author |
Message |
whynotme
Joined: 07 Aug 2011 Posts: 1
|
How is self programming different from ICSP? |
Posted: Sun Jan 08, 2012 1:11 am |
|
|
Hi everyone,
I read some PICs have the self programming feature, is it the ability to rewrite the PICs hex file by it own from inside?
I use Pickit2 to load the hex file to the PICs and normally a pin needs to be raised to 12V and some electrical requirements (I don't remember exactly). Does self programming need these kinds of electrics?
Can I do like this:
1. Send the new hex file to the PIC using USART, USB, I2C.
2. The PIC stores the file.
3. When it will be commanded, the PIC will change its features by updating the new program to its memory.
Thanks |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19540
|
|
Posted: Sun Jan 08, 2012 2:46 am |
|
|
Most modern PIC's can write to their own program memory (self programming), _but_ there has to be a program in the chip to do this. Normally a program called a 'bootloader'. This code sits in the chip, and has to be written in using another method. It runs, and normally checks for some specific signal to be received, and when it is, then switches to receiving the incoming code, and writing it to the rest of memory. No, the PIC can't 'store the file'. There is normally at least 10* as much ROM as RAM, so the programming has to take place 'block by block' as the data arrives. To store the file, you would have to add another memory at least as large as the PIC's ROM.
Do a search on 'bootloader', and you will find a lot about this.
Best Wishes |
|
|
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
|
Posted: Sun Jan 08, 2012 11:27 am |
|
|
There is programming and then there is development. Final programming the PIC comes hopefully after development unless you are getting already proven code from elsewhere. Now for programming the chip a bootloader can accept input from several peripherals USB IC2 SPI UART whereas ICSP is restricted to a few specific pins. However the pins used for ICSP are often used for ICD in circuit debugging ( debugging with realtime devices like on a target board). The ICD like a bootloader is loaded into the PIC. Since a debugger adds great value during development and since it also can act as a programmer it is often the preferred choice since it can for a release avoid the overhead of a bootloader and if desired it can program in a bootloader. The bootloader has the disadvantage of taking up some space ( and it is very tricky for a bootloader to update itself) but this is offset if a PIC needs to be upgraded in the field since it avoids the need for end users to have to have an ICD type programmer. Many developers will use both the ICD ICSP and release a work product containing a bootloader. |
|
|
|