MapMem lib exception on VF61

Hi, I should read CAN1_MCR register of Vybrid VF61. Address is 0x400D4000 according VF61 reference manual. This code doesn’t work and exception is thrown:

void MemTest()
{
	volatile DWORD *pMem;
	HANDLE mapMem;
	DWORD regValue;

	mapMem = Map_Init();
	pMem = (DWORD*)Map_MapMemory(0x400D4000,4);

	regValue = *pMem;
	
	Map_UnMapMemory((LPVOID)pMem);
	Map_Deinit(mapMem);
}

The exception is thrown when doing regValue = *pMem.

I tried the same code with another address (IO ports) and works, is this related to the supervisor access type? In that case how can I switch the access type to Unrestricted?

Thanks!

Hi,

Do you have clock of CAN 1 enabled?

Yes, I tried this

clk = VybClk_Init(NULL);
	
clkResult = VybClk_ClockEnabled(clk,tVybClkId::clkFlexCan1);
clkResult = VybClk_EnableClock(clk,tVybClkId::clkFlexCan1,TRUE);
	
clkResult = VybClk_Deinit(clk);

But nothing changed.