Friday, February 23rd 2018, 5:45am UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

guyb

Beginner

Date of registration: Sep 2nd 2010

Posts: 5

1

Thursday, September 2nd 2010, 12:55pm

[SOLVED] JLinkSTM32 - clear/erase device data

Hi,



i am using the JLinkSTM32.exe to clear the device, this works fine, but i need a way to activate the sequence from within my code using c#, I tried using the JLinkARMFlash.dll but with out success, can anyone advice ?



thanks.,

Guy.

SEGGER - Alex

Super Moderator

Date of registration: Dec 18th 2007

Posts: 1,516

2

Monday, September 6th 2010, 8:37am

Hi Guy,

what are you looking for?
Sample code how to perform a chip erase or a way to call the JLinkSTM32.exe from command line?
Or would either of the two options work for you?


Best regards
Alex

guyb

Beginner

Date of registration: Sep 2nd 2010

Posts: 5

3

Tuesday, September 7th 2010, 10:11am

Alex hi,



Sample code is the best option since i am trying to run the erase in the background and the JLinkStm32 requires user interaction.



Thanks,

Guy.

SEGGER - Alex

Super Moderator

Date of registration: Dec 18th 2007

Posts: 1,516

4

Tuesday, September 7th 2010, 8:14pm

Hi Guy,

since the source code of the STM32 unlock tool is not open source,
I can not post it here.

But triggering a mass/chip erase on the STM32 is not that complicated.
Have a look at the Flash programming documentation of ST.


Best regards
Alex

guyb

Beginner

Date of registration: Sep 2nd 2010

Posts: 5

5

Sunday, September 12th 2010, 8:51am

Alex,



I am not sure what you mean by the " Flash programming documentation of ST", do documentation i am using is UM08002_JLinkArmDLL.pdf.



i tried using the "JLINKARM_FLASH_EraseChip()" but it fails every time (returns false), so i guess i need to do something diffrently. is there a guid line or a code example to erase the device, as i said currently the jlinkstm32 works fine but it needs user interaction that doesn't suit my application (the application has a full flashing cycle include user interface for hex file selection, convertion, flashing and etc and the only thing missing is the "erase" of the device at the start of the flashing process).



Thanks,

Guy.

SEGGER - Alex

Super Moderator

Date of registration: Dec 18th 2007

Posts: 1,516

6

Monday, September 13th 2010, 2:49pm

Hi Guy,

usually the EraseChip() function of the J-Link FlashDLL should work as long as the device readout protection is NOT enabled.
If the readout protection IS enabled, the flash has to be erased in a different way,
since the usual chip erase command does NOT erase the option bytes and thus has no impact on the readout protection, so it can not be used.

If NO device security is active on your STM32 device the EraseChip() function should work.
In this case we will have a look into this.


Best regards
Alex

guyb

Beginner

Date of registration: Sep 2nd 2010

Posts: 5

7

Sunday, September 19th 2010, 9:58am

Hi Alex,



I must assume that the device might be protected / locked, and the procedure i am doing should erase a locked device as well (knowing that all the data will be erased).



So what is the different way to do that ? how do i disable the readout protection / the option bytes ?



Guy.

Luigi.Lena

Beginner

Date of registration: Dec 5th 2016

Posts: 8

8

Tuesday, December 6th 2016, 6:44pm

This comment was added by mistake

This post has been edited 3 times, last edit by "Luigi.Lena" (Dec 6th 2016, 6:50pm)


SEGGER - Erik

Super Moderator

Date of registration: Dec 20th 2011

Posts: 395

9

Wednesday, December 7th 2016, 11:20am

Hi,

Quoted

So what is the different way to do that ? how do i disable the readout protection / the option bytes ?
As Alex already described, the unlock sequence is described in the ST "Programming Manual" for your used device / series. The documentation can be found on the ST website. Example for the STM32F2 series: http://www.st.com/content/st_com/en/supp…gramming_manual


Best regards
Erik