Problem accessing GPT registers in unprivileged mode

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem accessing GPT registers in unprivileged mode

155 Views
krystianwasik
Contributor I

Hi,

I am trying to configure GPT while in unprivileged mode (CONTROL=0x3), but was unable to so far. I am not getting any exceptions (which should be the case if it was MPU or AIPSTZ related problem if I understand correctly), but writes have no effect and every read operation returns 0 (even for registers whose reset value is 0xffffffff).

Clocks are configured properly. After switching back to privileged mode, accessing GPT registers works just fine. The same goes for debugger.

MPU is completly disabled. Each AIPSTZ is configured as follows:

MPR=0x77000000
OPACR=0
OPACR1=0
OPACR2=0
OPACR3=0
OPACR4=0‍‍‍‍‍‍

What else could be preventing access to GPT? Am I missing something?

Any help would be appreciated.

Labels (1)
0 Kudos
2 Replies

55 Views
krystianwasik
Contributor I

Hi,

Thanks for the reply. I was able to solve the problem.

I'm using i.MX RT1064 by the way.

The issue was that from userspace driver I tried to access GPT registers using pointer to structure with packed attribute. It appears that in this case compiler uses strb and ldrb instructions for accessing memory (byte access) in order to avoid unaligned access, while GPT only supports word access.

Wanting to check if GPT can be accessed from kernel (I'm using RTOS), I simply used pointer to uint32_t, which worked since it results in word access. That's where the wrong diagnosis came from.

0 Kudos

55 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi krystianwasik,

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
Which RT chip do you use? In further, I was wondering if you can share a simple demo which can replicate this phenomenon.
Looking forward to your reply.


Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos