Read FUSE bit and modify without effect any damage to program space

Thread Starter

micropad

Joined Dec 24, 2011
109
Bootloader then in user can load firmware themselves. Bootloader can be made to read firmware to load so as
user can't. crypto-Bootloader
Hear firmware mean hex code right ?

This is the solution what i am searching please elaborate more or any links
 

djsfantasi

Joined Apr 11, 2010
9,237
What is the solution to read protect
I’m confused. Your objective is to update or flash the firmware. And you have the source and hex code. Then, I don’t understand why you have to read it.

In one case, you already have the code. Read that for whatever you want.

In another case, you are updating the code. That will overwrite the old code and hence, there is no reason to read it.

So, is there yet another case?
 

Thread Starter

micropad

Joined Dec 24, 2011
109
I’m confused. Your objective is to update or flash the firmware. And you have the source and hex code. Then, I don’t understand why you have to read it.

In one case, you already have the code. Read that for whatever you want.

In another case, you are updating the code. That will overwrite the old code and hence, there is no reason to read it.

So, is there yet another case?
My objective is flash the firmware ( HEX Code ) by overwriting old firmware ( HEX Code ) as well as to stop read it by the end user or our tech body

My Original question in this forum base on some one else requirement for my objective

please advice
 

djsfantasi

Joined Apr 11, 2010
9,237
My objective is flash the firmware ( HEX Code ) by overwriting old firmware ( HEX Code ) as well as to stop read it by the end user or our tech body

My Original question in this forum base on some one else requirement for my objective

please advice
So as others have suggested, you reset the chip to its default state first. Then you flash the code and set the code protect bits in the process.

Done!

PapaBravo said this in an earlier Post
 

Papabravo

Joined Feb 24, 2006
22,083
Is there any hex upload procedure by end user without reading code in side the MCU
Why do you think you need to read what is there? Maybe to be sure that what is there is older than what you propose to put there. You're not exactly expressing what you want to do and why with crystal clarity.
 

djsfantasi

Joined Apr 11, 2010
9,237
Why do you think you need to read what is there? Maybe to be sure that what is there is older than what you propose to put there. You're not exactly expressing what you want to do and why with crystal clarity.
He doesn’t want nor need to read the old code. He wants to ensure that after loading the new code, it is protected.

Is this correct, @micropad
 

Papabravo

Joined Feb 24, 2006
22,083
He doesn’t want nor need to read the old code. He wants to ensure that after loading the new code, it is protected.

Is this correct, @micropad
So he wants to know if he can bulk erase the existing firmware, upload new firmware, and program the code protect bits to protect the new firmware. It has been a struggle, but I think he can get to yes.
 
So he wants to know if he can bulk erase the existing firmware, upload new firmware, and program the code protect bits to protect the new firmware. It has been a struggle, but I think he can get to yes.
That is distinctly NOT what he said he wanted to do. Based on what he said he wanted to do, I am sticking with saying that he can not do what he said he wanted to do. I realize that there may be a language disadvantage here, but we can only go on what he has said.

Post #1
I need read the fuse bits of PIC18F2550 and modify it and to be re programmed without any damaged to the program space
You can only modify the CP bits in one direction - you can turn them on if they are off - we all know that, UNLESS, you do a full Chip or Block erase.

This is stated clearly in the datasheet for his chip https://ww1.microchip.com/downloads/en/devicedoc/39632c.pdf
Note:Code protection bits may only be written to a ‘0’ from a ‘1’ state. It is not possible to write a ‘1’ to a bit in the ‘0’ state. Code protection bits are only set to ‘1’ by a full Chip Erase or Block Erase function. The full Chip Erase and Block Erase functions can only be initiated via ICSP operation or an external programmer.

How do you interpret "programmed without any damaged to the program space"? If that means, without changing the contents of the program space, then the answer is a definitive NO. If it means, allowing the chip to be reprogrammed, then the answer is a definitive yes AFTER an appropriate erase..

In Post #5, he clears it up...
I Want to upgrade new firmware without erasing entire chip

He can't do that, as stated early.

If he wanted to erase the chip and then re-program it, we all understand that he can do that. When he says, explicitly, "without erasing the entire chip", the answer is simply NO (at least with regard to all blocks that were CP on).

I know that there are other comments that are confusing, but the gist of it was given early (and correctly answered often).

If we anticipate further, based on:
Our Company is the legal owner of the code and I too have them
Currently we provide hex code to the our technical staff to upload the code to the end user location . but company is requesting to find the solution upgrade firmware some other way without giving to technician
Then the OP needs to clearly state what he is after because on the surface, there is no way to do this other than the obvious ways that have already been repeatedly mentioned.
 
Last edited:
Microchip used to send me new versions of their PICSTART16B every few weeks, or so it seemed.
20.jpg
Just burn new chips and send them to the technicians and have the old ones returned (for erasing and reuse). Everything remains protected and technicians do not need hex code of anything.
 

djsfantasi

Joined Apr 11, 2010
9,237
That is distinctly NOT what he said he wanted to do. Based on what he said he wanted to do, I am sticking with saying that he can not do what he said he wanted to do. I realize that there may be a language disadvantage here, but we can only go on what he has said.

Post #1


You can only modify the CP bits in one direction - you can turn them on if they are off - we all know that, UNLESS, you do a full Chip or Block erase.

This is stated clearly in the datasheet for his chip https://ww1.microchip.com/downloads/en/devicedoc/39632c.pdf
Note:Code protection bits may only be written to a ‘0’ from a ‘1’ state. It is not possible to write a ‘1’ to a bit in the ‘0’ state. Code protection bits are only set to ‘1’ by a full Chip Erase or Block Erase function. The full Chip Erase and Block Erase functions can only be initiated via ICSP operation or an external programmer.

How do you interpret "programmed without any damaged to the program space"? If that means, without changing the contents of the program space, then the answer is a definitive NO. If it means, allowing the chip to be reprogrammed, then the answer is a definitive yes AFTER an appropriate erase..

In Post #5, he clears it up...


He can't do that, as stated early.

If he wanted to erase the chip and then re-program it, we all understand that he can do that. When he says, explicitly, "without erasing the entire chip", the answer is simply NO (at least with regard to all blocks that were CP on).

I know that there are other comments that are confusing, but the gist of it was given early (and correctly answered often).

If we anticipate further, based on:


Then the OP needs to clearly state what he is after because on the surface, there is no way to do this other than the obvious ways that have already been repeatedly mention.
It’s difficult to respond to his inquiry, because the TS has stated inconsistent objectives.

Based on his most recent response in post #24, your interpretation of his objective is not valid. As he stated, that is someone else’ interpretation of the requirements. Based on the post #25, erasing the chip, uploading new code and protecting the chip satisfies his objective.

Or it doesn’t! He needs to reply to post #27.
 
It’s difficult to respond to his inquiry, because the TS has stated inconsistent objectives.

Based on his most recent response in post #24, your interpretation of his objective is not valid. As he stated, that is someone else’ interpretation of the requirements. Based on the post #25, erasing the chip, uploading new code and protecting the chip satisfies his objective.

Or it doesn’t! He needs to reply to post #24.
I think that my interpretation of his objective is valid and I also see your point. The first response to his initial post by @Sensacell and the datasheet pretty much addressed his option of erase and reprogram.

If the OP wants to change his mind, that is fine with me...also, if, as a result of the thread, he has a clearer understanding of his situation, that is also fine.
 

Thread Starter

micropad

Joined Dec 24, 2011
109
Microchip used to send me new versions of their PICSTART16B every few weeks, or so it seemed.
View attachment 176665
Just burn new chips and send them to the technicians and have the old ones returned (for erasing and reuse). Everything remains protected and technicians do not need hex code of anything.
This can not be implemented now because we have to re change the board and everything
 

Thread Starter

micropad

Joined Dec 24, 2011
109
It’s difficult to respond to his inquiry, because the TS has stated inconsistent objectives.

Based on his most recent response in post #24, your interpretation of his objective is not valid. As he stated, that is someone else’ interpretation of the requirements. Based on the post #25, erasing the chip, uploading new code and protecting the chip satisfies his objective.

Or it doesn’t! He needs to reply to post #27.
I am finding boot loader method that post #19 is pointed out that can be helped to get rid of this. please help to have more info in this regarding
 
Last edited:

Thread Starter

micropad

Joined Dec 24, 2011
109
I check with other department who handle the remote area.
They send the laptop with technician and connect everything to machine. and IT department log to the laptop remotely and upload the hex code . This method also not safe as per the management

Note As per them to get rid of malfunction of the machine they upload the same hex code to solve the problem
 
Last edited:

bertus

Joined Apr 5, 2008
22,928
Hello,

From the manual, page 306:

Memory that is not code-protected can be erased using
either a Block Erase, or erased row by row, then written
at any specified VDD. If code-protected memory is to be
erased, a Block Erase is required. If a Block Erase is to
be performed when using Low-Voltage Programming,
the device must be supplied with VDD of 4.5V to 5.5V.


Bertus
 

Attachments

Top