PDA

View Full Version : Bootloader question



gzorzi
- 28th June 2004, 10:37
Can I use bootloader if I use code-protected fuse ?

Can I check the distributions of my software if I use bootloader utility ?

Thanks

Melanie
- 28th June 2004, 14:26
Bootloader:

You cannot change the Codespace if it has been protected.
You cannot access the Configuration Fuses
You cannot access the ID (Serial Number) Bytes.
You CAN read back Codespace (even if it has been protected) with a suitably enabled Bootloader... but I'm NOT going to tell you how.

ICSP:

You can change the Codespace if it has been protected.
You can change the Configuration Fuses.
You can access the ID (Serial Number) Bytes.
You cannot Verify if the Codespace has been protected.
You cannot change back the protection fuses (once a PIC is protected, it remains protected).

Melanie

gzorzi
- 28th June 2004, 14:44
OK but...
How can I protect my firmware if I want to use bootloader to upgrade my firmware easy ?

Melanie
- 28th June 2004, 16:54
Use ICSP. The very fact you have a Bootloader, means your software is unprotected. The idea of protceting your code is just that - it is PROTECTED. You can't have a "I want it protected from everyone but me" scenario - it's either protected, or it isn't. You can't have both.

gzorzi
- 29th June 2004, 07:25
Question:
But the ID (Serial Number) is a register read only or is a register free where I can write anythink only with ICSP.

Melanie
- 29th June 2004, 11:04
The ID (Serial) bytes are only accessible by your programmer (including ICSP). They are NOT accessible internally to your program. See "Special features of the CPU" section of your PIC's Datasheet.

gzorzi
- 29th June 2004, 11:31
If I write both ID and bootloader with ICSP Can I after only read with program ID value ?

Melanie
- 29th June 2004, 11:52
Your program cannot access the ID bytes.
The bootloader cannot access the ID bytes.

The ID bytes can only be read by your programmer software.

gzorzi
- 29th June 2004, 12:44
OK but if I want that my firmware run only with a unique code identification where can I do ?

Melanie
- 29th June 2004, 13:37
There's so many things you can do, the limit is your own imagination...

If you have code protected your product, then it is reasonably safe as long as you don't have a bootloader installed and rely on ICSP or an external programmer to update your software. I use several methods depending on the value and copyability of the products by competitors...

Cheap products are code protected. They can only be code updated if the PIC is on a socket. We either send out a new PIC, or the product has to be returned to the factory for update.

Some high-risk products that need field updating have a specially written bootloader that will only work with our own host software. The PIC is usually surface mounted on the PCB and the PCB has liquid ceramic adhesive compound poured over it. You cannot get at the PIC or it's connections without destroying the device or the PCB.

Other products are fully copy protected and have ICSP circuitry on-board. They can be field upgraded the normal way using a programmer, although the code cannot be read back.

Some products also have the processor linked to an external Hardware device that will provide a Unique Serial Number. Only if your software matches that number then the software will run... this means that your PIC will ONLY function in the target PCB and nowhere else. The Dallas DS18S20 Temperature Sensor looks just like a Transistor... but contains a unique 64-bit Serial Number. If your software matches the number it runs, if it doesn't, then it won't. Some customers are not very trustworthy. They swap serial numbers between boards, then send old boards back 'under warranty'. The embedded serial number in hardware can prove those customers misbehaving.

Other products will stop working after a preset time and have to be reset by a field engineer.

Like I said... your imagination is your limit.

Melanie

gzorzi
- 29th June 2004, 14:16
I have LCD display on PORTB. Can I use ICSP on board with PIC18F458 without manual switch . What circuit schematic can I use for ISCP and LCD connection ?.

Melanie
- 29th June 2004, 14:33
http://ww1.microchip.com/downloads/en/DeviceDoc/30277d.pdf

Forgot to add... if RB6 and RB& is connected to your LCD, it should have no affect as LCD's have minimum pin loading, so isolation will probably not be required (depending on how good your programmer is)... try it and see. I generally try to assign control buttons to RB6/7 so that they're out of circuit (normally open-circuit with internal pull-up's) and don't interfere with ICSP.

Personally, I isolate Vdd from my PCB's +5v supply with a Diode and Capacitor to Vss (and have only the PIC powered via the ICSP connector when programming. It goes without saying that you will have to Diode isolate MCLR as well.

Melanie

gzorzi
- 29th June 2004, 15:04
Thanks I see the connection
I never program PIC on-board with ICSP.
If I use JDM programmer the power supply of PIC can do the on-board power supply ?
What is it the best solution for on-board ICSP circuit ?
Thanks

Melanie
- 29th June 2004, 18:28
I cannot answer questions about your JDM programmer - I don't know it.

Appended is a schematic of the ICSP portion that I employ if I'm putting ICSP on a board. If your PIC isn't a 28-pin 16F type, change the pins appropriately to suit, but the circuit basically remains the same.

R1 and C2 are the usual arrangement for MCLR. D2 prevents the programming voltage Vpp from damaging the rest of your board. During programming the PCB supply (+5v PCB) is switched off. The PIC is powered from the programmer +5v at the ICSP pin. Diode D1 prevents the ICSP programmers +5v from powering-up the rest of the PCB, limiting to applying power just to the PIC being programmed. C1 is just for decoupling.

Like I mentioned previously, if I'm going to employ ICSP, then I ensure circuitry on RB6/RB7 is relatively benign. Push Button controls that are normally Open-Circuit with internal pull-up's are my favourite choice for these pins. LCD pins should not cause too many headaches, but as always test beforehand.

Melanie

gzorzi
- 30th June 2004, 07:53
OK is a good solution.

I haven't JDM programm all the suggestion are welcome but I prefer that JDM works with ICProg (I see some solution but I don't know the best) . Now I use stand-alone P16PRO with ICProg and LPT connection and is OK.

The JDM works olso with LVP setting ?.
If YES the connection circuit is it the same ?
I don't know if PGM pin must be connect to JDM pin

gzorzi
- 2nd July 2004, 12:49
I see that the ICSP programmer power supply the board where there is a PIC to program and there are some solution with diode to isolate MCLR and VDD to the onboard power supply and ICSP connector . OK is it right. But if my board has the 2 power supply to program the PIC (5V and 13V) Can I use this power to supply the programmer without to use an external power supply only for the programmer ? I will use a switch on MCLR pin for normal and program operation.

Ioannis
- 9th July 2004, 09:15
If your Codespace is protected AND you have some serial number in this space, you can copy the serial number in the EEPROM area the first time the PIC is run. I used this technique once, where the half of the serial number was secret (user could not see/alter it) and the second half was 0000 by default and could be changed by the user as a password.

That project included a PC software that was paired with the secret serial number of the PIC.

Ioannis