EPIT registers not accessed by C code at runtime

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

EPIT registers not accessed by C code at runtime

1,471 Views
abhijeet_ghodga
Contributor III

Hi,

I am programming EPIT1 registers 20D_0000 to 20D_0010 using memtools in the Linux OS on my imx6 board. After programming them, I want to access the value of the counter at run-time using C code.

Currently, I have created a memory pointer that gets the entire memory block from 20DXXXX address and then compares if some specific count value has been reached.

The error that I am getting is:

ERROR: Unhandled fault: external abort on non-linefetch (0x1818)

My doubt is that the way of declaring the memory pointer (using page_mask and page_size) must be wrong? What is the correct way of accessing EPIT registers using C pointers? What is the general calculations done in allocating a memory block to the pointer via mmap?

Best,

Abhijeet

Labels (1)
5 Replies

1,367 Views
shaojun_wang
NXP Employee
NXP Employee

Attached is an example to configure EPIT.

1,367 Views
abhijeet_ghodga
Contributor III

Hi,

I have enabled EPIT registers, and written a C application code, that creates a memory pointer and accesses control and count register. Currently, the issue I am facing is of interrupt handling.

Studying your patch on epit.c, there are some RAM write functions and irq calls. Since, epit.c is in the kernel level, I will have to modify the kernel. Is there a way to implement the RAM write functions and irq calls, into an application code, that can be cross-compiled into an exe.

Best,

Abhijeet

0 Kudos

1,367 Views
igorpadykov
NXP Employee
NXP Employee

Hi Abhijeet

epit may be used by linux system timer as described in sect.2.1.3.2 Timer Features

attached Linux Manual.

Best regards
igor

0 Kudos

1,367 Views
igorpadykov
NXP Employee
NXP Employee

Hi Abhijeet

 linux uses mmu and one can look at memtool example function map_address()

memtool.c\memtool\test - imx-test - i.MX Driver Test Application Software 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,367 Views
abhijeet_ghodga
Contributor III

Hi Igor,

I am already using memtools to access the EPIT registers, I run the memtools script from my C file exe, so everytime I run the exe, the registers are set, and the downcounter starts.

I am unable to get access to the OCIF or the interrupt of the EPIT Timer through the C code.

Best,

Abhijeet

0 Kudos