XMC4500 / FLASH0->FCON / Hard Fault

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

cross mob
User13841
Level 1
Level 1
At this early stage of development I am getting a hard fault at the first attempt to read the FLASH0.FCON register.

In the XMC4500 reference manual I see the statement...

"FCON is a Privileged Mode protected register."

... so maybe an unlocking sequence is required. But I am unable to locate any information.

Workalot.
0 Likes
3 Replies
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

The FLASH0->FCON, register is accessed in the SystemCoreSetup() function in system_XMC4500.c file. After reset you are in privilege mode. If you do not explicitly switch to unprivileged mode, you should be able to access the register.
Can you show your code?

Regards,
Jesus
0 Likes
User13841
Level 1
Level 1
Thank you jferreira.

Yes, as you say, privileged mode is about when entering the reset handler and all registers should be accessible. So after a few days of being elsewhere minded, a return to the problem. Code that occurs before the call to SystemCoreSetup() has been selectively made inactive until the offending code was identified. Why it is doing so is for further investigation and possibly another forum thread.

Workalot
0 Likes
User13841
Level 1
Level 1
The faulting code is a consequence of not RTM. XMC4000 lacks bit-banding.
0 Likes