XMC4500 Flash protection in practice?!

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User8734
Level 4
Level 4
Good day,

I have read "XMC4500 Reference Manual"
chapter 8.4.8 Flash Protection, but it is still unclear for me how it should be realized?

Say, I choose to set up "Flash Read Protection", using option:
– UCB0: Read protection that can be disabled with the password of UCB0 for whole Flash.

For that, I shall set bit PROCON0[15] = RPRO = 1 in UCB0

Meanwhile, description for it says:

This bit indicates whether read protection is
configured for PFLASH by user 0.

0B No read protection configured
1B Read protection and globalwrite protection is
configured by user 0 (master user)


So, looks like it is Global R/W Protection bit.

Bits PROCON0[0:10] - write protection per sectors - can be used independently.

A “UCB” is a specific logical sector contained in the configuration sector.
Apparently, UCB blocks are not affected, when whole Flash is erased by Programmator.
As far UCB blocks may be rewritten reliably only 4 times!

It means theoretically, that if only "Read Protection" was installed, you are able to rewrite Flash, but as far protection still in place,
you do not able to verify it without erasing UCB0 block as well, applying special procedure.

Global R/W Protection as well may be disabled temporary, o.w. until next System Reset. It is used in MemTool. (See below)
But, it requires ASC Bootstrap connection - through P1.4 RxD, P1.5 TxD lines.

BR
K
0 Likes
4 Replies
User8734
Level 4
Level 4
I have found post in thread:

https://www.infineonforums.com/threads/3240-Flash-protection?highlight=Bootloader

When you program a UCB with password and R/W sector protect, the UCB is considered operational. At this stage you can always temporary

unprotect the flash for software update with the correct password. And the MCU will return to protect state after a reset.

Sounds great, but still unclear how to achieve this?

Unfortunately Travis has not visited this forum more than 6 monts 😞
0 Likes
User8734
Level 4
Level 4
Get MemTool 4.07.03 and connect to it using ASC Bootstrap (P1.4 RxD, P1.5 TxD) at speed 57600.

2670.attach

Meanwhile, to activate HW Protect button, in upper left field shall be vailid address space
and PFLASH must be enabled. Other way to make it active - load some .HEX file.

2674.attach

Then protection may be activated. Please configure Setup first.
"Try to disable protection.." - is most important option, as far it removes
protection temporary, not erasing UCB0 block!

2678.attach

Press OK on warning message and get Flash protected:

2675.attach

After reconnect, as far protection temporary removed, it looks as below:

2676.attach

I was able to Erase and Program Flash successfully in this mode, but Verify option failed on some reason.
0 Likes
User8734
Level 4
Level 4
XMCLoader.exe is able to do similar job.
It is located in "TOO_Bootloader_ASC_examples_v1_1"
XMC4000_ASCBootloader -> XMCLoad -> Release -> XMCLoad.exe
It loads ASCLoader.hex into PSRAM ( 0x1000 0000 ) and starts it.

Mentioned example contains source codes for ASCLoader.hex (Dave 3, Keil, IAR),
and for XMCLoad.exe as well.

I was able to connect on 57600bps speed, next 4096 must be choosen 🙂

2671.attach
0 Likes
User8734
Level 4
Level 4
So, let's protect Flash, using XMCLoader:

2672.attach

And unprotect then:

2673.attach

Looks like it is can be done relaibly 4 times only, as far seems that XMCLoader erases UCB0 every time

In case Flash Protection detected, NO option cause program termination.

2677.attach
0 Likes