Flash read protection - cannot connect anymore

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

cross mob
User8620
Level 2
Level 2
I am having issues with the Flash protection.
My goal is to protect the flash from reading (only).

My current code is as follows:
#include 

#define FLASH_PASSWORD_1 0x01234567
#define FLASH_PASSWORD_2 0x89ABCDEF

void flashProtection_enable() {
// XMC_FLASH_EraseUCB(0);
XMC_FLASH_InstallProtection(0, XMC_FLASH_PROTECTION_READ_GLOBAL, FLASH_PASSWORD_1, FLASH_PASSWORD_2);
XMC_FLASH_ConfirmProtection(0);
bool protected = XMC_FLASH_VerifyReadProtection(FLASH_PASSWORD_1, FLASH_PASSWORD_2);
}

void flashProtection_disable() {
XMC_FLASH_lDisableReadProtectionCommand(FLASH_PASSWORD_1, FLASH_PASSWORD_2);
}


However, the enable function seems to also enable write protection. After I run this code in debug mode, the debugger can not read anything anymore, which is what I want to have.
But I also cannot download new code to the device or even connect to it. My understanding of read protection is that I should be able to reprogram the device.
I tried to connect to the microcontroller wit the J-Link Commander to erase the flash. But connecting fails every time.
How can I connect to my device?

I am using an XMC4500-F100x1024
0 Likes
4 Replies
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

The read protection will also enable a global write protection and the debugger will not have access anymore.
See Flash Protection in reference manual.

"For an effective IP protection the Flash read protection must be activated. This ensures
system wide that the Flash cannot be read from external or changed without
authorization."


You need to foresee this and implement a backdoor if you wish to disable the protection using another communication interface.

Regards,
Jesus
0 Likes
Not applicable
To connect to your device you can use ASC BOOT Loader.
The shortest way is to use any kind of COM Port (usually USB-UART device) to lines P1.4 P1.5 and connect to it by Infineon Memory Tool.
Note that lines TMS and TCK must be grounded at reset, which forces ASC BOOT mode in the device.
At least you can disable FLASH protection and unbrick you device for further development.
0 Likes
Not applicable
SashaBelykh wrote:
To connect to your device you can use ASC BOOT Loader.
The shortest way is to use any kind of COM Port (usually USB-UART device) to lines P1.4 P1.5 and connect to it by Infineon Memory Tool.
Note that lines TMS and TCK must be grounded at reset, which forces ASC BOOT mode in the device.
At least you can disable FLASH protection and unbrick you device for further development.


Hi SashaBelykh,

I have similar problem in AURIX TC234 platform. Could you please share how to disable FLASH read protection with me?
0 Likes
Manda3
Level 1
Level 1
5 replies posted First question asked First reply posted

Hello, have you found a solution to remove read protection on tc234.Thank you very much in advance for your reply

0 Likes