Hello,

you are right, you have add the pre-check.


Regards,

Mathias

On 10.01.2012 12:01, Bruno Fleurette wrote:
> Hi Mathias,
> 
> My tree was up to date and I think you didn't understand my fix.
> I am talking about checking the FLASH_CR register BEFORE trying to unlock:
> when the flash access is already unlocked and the stm32x_unlock_reg()
> function is called, it just fails...
> Regards,
> 
> Bruno
> 
> -----Original Message-----
> From: Mathias K. [mailto:[email protected]] 
> Sent: mardi 10 janvier 2012 11:27
> To: Bruno Fleurette
> Cc: [email protected]
> Subject: Re: [OpenOCD-devel] Patch for stm32f2x nor flash driver
> 
> Hello,
> 
> you should rebase your tree to get the latest changes.
> 
> http://openocd.git.sourceforge.net/git/gitweb.cgi?p=openocd/openocd;a=commit
> ;h=c132304ee9fe43c3078caaf64ae0ee2f3a9542fe
> 
> 
> Regards,
> 
> Mathias
> 
> On 10.01.2012 10:12, Bruno Fleurette wrote:
>> (plain text version)
>> Hi,
>>
>> I was sometimes faced to the following errors when I was trying to erase
> or
>> write a fw to the my STM32 flash:
>>
>> Error: JTAG-DP STICKY ERROR
>> Error: MEM_AP_CSW 0x23000052, MEM_AP_TAR 0x40023c08
>> Error: JTAG-DP STICKY ERROR
>> Error: MEM_AP_CSW 0x23000052, MEM_AP_TAR 0x40023c08
>>
>> After some time of debugging. it appeared the stm32f2xx generates an error
>> when you try to write something on the FLASH_KEYR register (0x40023c08)
> and
>> the flash access has already been unlocked.
>>
>> Here is the patch I submit to your approval: in the stm32x_unlock_reg()
>> function I propose to first read the FLASH_CR register and check whether
> the
>> flash access is locked or not before writing to the FLASH_KEYR register.
>>
>> Thanks!
>>
>> Bruno FLEURETTE
>>
>>
>>
>>
> ----------------------------------------------------------------------------
> --
>> Write once. Port to many.
>> Get the SDK and tools to simplify cross-platform app development. Create 
>> new or port existing apps to sell to consumers worldwide. Explore the 
>> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
>> http://p.sf.net/sfu/intel-appdev
>>
>>
>>
>> _______________________________________________
>> OpenOCD-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/openocd-devel
> 
> 
> 


------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to