It says it is accessible for both privileged
and unprivileged code when access Peripheral
But when I change the Control register with the following assembly code:
/* void ResetPrivileged( void ) */
ResetPrivileged:
MRS r0, control
MOVS r1, #1
ORRS r0, r0, r1
MSR control, r0
DSB
ISB
BX lr
and access the register PTA->PSOR = (1ul << 5)
it go to the HardFault Handler
So in the non-privileged mode, can I access the registers of peripheral devices?
已解决! 转到解答。
Hi @LijieDu,
Sorry, I meant OPACRF.
OPACRA[SP0] is FTFC
OPACRA[SP1] is DMAMUX
...
OPACRF[SP1] is PortA
BR, Daniel
Hi @LijieDu,
It is protected by the AIPS.
Have a look at Peripheral Memory Map in the S32K1xx_Memory_Map.xlsx file that is attched to the RM.
PortA is configurable in PACRF[26-24].
You would need to clear OPACRF[26].
Regards,
Daniel
First of all, thank you for your answer
PACRF register not found in the reference manual Rev13 below:
I can't understand the memory mapping table. Can you explain how to map one to one in detail
Thanks for your reply
Sorry, maybe I didn't describe the problem correctly,PTA type is GPIO_Type defined in s32k118.h
According to your prompt,and Refer to map table below, I clear the bit 3 of PACRB and can control IO output in user mode,it did not go to hardfault again
Thanks very much!