AnsweredAssumed Answered

K82: Enable user access to SIM

Question asked by Eugene Hiihtaja on Jun 3, 2019
Latest reply on Jun 5, 2019 by Kerry Zhou

Hello !

 

I have some problem when enable clock for I2C0/i2C1 driver when enable clock in SIM module.

 

AIPS0 is configured to give access with User privileges to SIM module. But CLOCK_EnableClock cause BusFault

when clock is going to be enabled for I20 or (I2C1) interfaces.

From other side, enable clock for CLOCK_EnableClock(kCLOCK_PortB) is not cause any problem.

 

In function  I2C_MasterInit()

....

/* Enable I2C clock. */
_SYSCALL(PRINTF("AIPS0->PACRJ ( 0x%08lX ) - 0x%08lX\r\n", &AIPS0->PACRJ, AIPS0->PACRJ));

-> AIPS0->PACRJ ( 0x40000054 ) - 0x15115500   // OK


//CLOCK_EnableClock(s_i2cClocks[I2C_GetInstance(base)]); // Original code


clock_ip_name_t clock = s_i2cClocks[I2C_GetInstance(base)]; // Code split for 2 parts for detect root cause
PRINTF("kCLOCK_I2c0 ( 0x%08lX ) - 0x%08lX\r\n", kCLOCK_I2c0, clock);

-> kCLOCK_I2c0 ( 0x10340006 ) - 0x10340006 // API OK !


_SYSCALL(/**/CLOCK_EnableClock(clock)/**/); // OK in privileged mode


CLOCK_EnableClock(kCLOCK_I2c0);

or CLOCK_EnableClock(clock);    // Bus Bault  !!!!

 

// This macro is used for escalate supervisor privileged 

#define _SYSCALL(CODE) \
{ \
BaseType_t xRunningPrivileged = xPortRaisePrivilege(); \
CODE; \
vPortResetPrivilege(xRunningPrivileged); \
}

 

It means, access to SIM is enabled with User privileges.

 

But call CLOCK_EnableClock(clock);  cause Bus Fault

 

BUT if I call twice  e.g with supervisor privileges and after that with User privileges :

 

_SYSCALL(/**/CLOCK_EnableClock(clock)/**/);

CLOCK_EnableClock(clock);    // OK ?!!!!!!!!!!!!

 

It is also work.

 

Can it be some HW defect when twice call for enable I2C clock is really required ?

 

Issue is repeatable all the time.

 

But one call  CLOCK_EnableClock(clock);  should work if SIM can be accessed in User mode.

 

What can be problem ?

 

Regards,

Eugene

 

Outcomes