How to configure the EIM with WEC 2013 on colibri iMX7

I want to address the iMX7 EIM registers. For this I use this structure and map it to the address 0x30BC0000.

     /* WEIM registers */
     typedef struct {
         UINT32 CS0GCR1;
         UINT32 CS0GCR2;
         UINT32 CS0RD1; 
         UINT32 CS0RD2; 
         UINT32 CS0WR1; 
         UINT32 CS0WR2; 
         UINT32 CS1GCR1;
         UINT32 CS1GCR2;
         UINT32 CS1RD1; 
         UINT32 CS1RD2; 
         UINT32 CS1WR1; 
         UINT32 CS1WR2; 
         UINT32 CS2GCR1;
         UINT32 CS2GCR2;
         UINT32 CS2RD1; 
         UINT32 CS2RD2; 
         UINT32 CS2WR1; 
         UINT32 CS2WR2; 
         UINT32 CS3GCR1;
         UINT32 CS3GCR2;
         UINT32 CS3RD1; 
         UINT32 CS3RD2; 
         UINT32 CS3WR1; 
         UINT32 CS3WR2; 
         UINT32 CS4GCR1;
         UINT32 CS4GCR2;
         UINT32 CS4RD1; 
         UINT32 CS4RD2; 
         UINT32 CS4WR1; 
         UINT32 CS4WR2; 
         UINT32 CS5GCR1;
         UINT32 CS5GCR2;
         UINT32 CS5RD1; 
         UINT32 CS5RD2; 
         UINT32 CS5WR1; 
         UINT32 CS5WR2; 
         UINT32 WCR;
         UINT32 WIAR;
         UINT32 EAR;
     }CSP_WEIM_REGS, *PCSP_WEIM_REGS;

If I want to read the register, the program crashes. What do I have to do differently?

int wmain(int argc, wchar_t *argv[])
{
	printf("Welcome to Windows Embedded Project System \n");
	
	// Init MapMemLib
	HANDLE maphandle = Map_Init();
	tVersion libver;
	
	// Get Libversion
	Map_GetVersion(&libver);
	//read register
	volatile PCSP_WEIM_REGS g_pWEIM = (PCSP_WEIM_REGS)Map_OALPAtoVA(0x30bc0000, 0);
	_tprintf(TEXT("read: %08x\r\n"), g_pWEIM->CS0GCR2);	
	
	return 0;
}

Physical address for EIM registers is 0x021B8000, where did you get 0x30bc0000 from?

You should also enable EIM_SLOW_CLK, you can access the CCM registers directly or use clock lib calling:

HANDLE handle=Imx6Clk_Init(NULL);<br/>
Imx6Clk_EnableClock(handle,DDK_CLOCK_GATE_INDEX_R11);<br/>
Imx6Clk_Denit(handle);<br/>

hi valter,
we use the iMX7 module, the CLK functions are for the iMX6. Does this fit?
I found the adress here:
[upload|EqxVElQwVsmy72qpI2t6Ls7sFEQ=]
[upload|dWE7hWjRw6+bKjG94GLbPQpT/aI=]

Sorry, I assumed you were working on i.mx6, my bad.
Yes, you should probably enable the clock before accessing those registers.

In the header clk_imx7.h, there is no define DDK_CLOCK_GATE_INDEX_R11. Which defines do I have to select instead?
It would be great if there is a sample program, as I can put the WEIM registers on the iMX7 correctly.

This value is defined as DDK_CLOCK_GATE_INDEX_R11.
To experiment with HW registers you may use our register access tool:

hi valter, thanks for your reply. I have adapted my program to your specifications and can now read and write the register sucessfully.

I did the following test using the register access tool.
If I try accessing directly EIM_SC0GCR1 (0x30bc0000) the system freezes (may happen when accessing unclocked devices).
I checked CMM register CCM_CCGR22 (0x30384160) and it was set to 0 (all clocks disabled).
I wrote 0x00003333 into it, enabling clock for EIM module in the different power states, and then I was able to access EIM_SC0GCR1.