MPU PID MPC5777C

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MPU PID MPC5777C

878件の閲覧回数
Othmane1
Contributor II

Hi,

can anyone tell me how the MPU knows which PID every task has? should i set the PID somehow of each task in some special register? because the only thing i found in the reference manual of the MPC5777C is this :

Othmane1_0-1696921633737.png

where does the pid_hit get the current pid? 

0 件の賞賛
返信
5 返答(返信)

868件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

It is given by setting of PID0 core register as on screenshots below:

davidtosenovjan_0-1696944631011.png

davidtosenovjan_1-1696945030283.png

 

 

0 件の賞賛
返信

859件の閲覧回数
Othmane1
Contributor II

so if i want to have two tasks each with it's own PID i should so something like this:

void vTaskLed(void *pvParameters)
{
struct TaskLed *apCtx = (struct TaskLed *) pvParameters;
static uint32_t test_read;

for ( ; ; )
{
__asm (
"e_li %r3,0xffff8001\n" // Load the value 0x12345678 into r0
"mtspr 48,%r3\n" // Write the value in r0 to the TBL SPR (SPR number 48)
);
*(uint32_t*)0x4003F000u = 0x1;

gpio_write(apCtx->led, 1);

MSLEEP(TASK_DELAY_1000MS);

gpio_write(apCtx->led, 0);

MSLEEP(TASK_DELAY_1000MS);
}
}

 

void vTaskLed1(void *pvParameters)
{
struct TaskLed1 *apCtx = (struct TaskLed1 *) pvParameters;
static uint32_t test_read;

for ( ; ; )
{
__asm (
"e_li %r3,0xffff8002\n" // Load the value 0x12345678 into r0
"mtspr 48,%r3\n" // Write the value in r0 to the TBL SPR (SPR number 48)
);
//*(uint32_t*)0x4003F000u = 0x2;

gpio_write(apCtx->led, 1);

MSLEEP(TASK_DELAY_500MS);

gpio_write(apCtx->led, 0);

MSLEEP(TASK_DELAY_500MS);
}
}

0 件の賞賛
返信

835件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

Yes, in principle it should be like that.

Consider there are also synchronization requirements for accesses to PID registers.

davidtosenovjan_0-1697105266808.png

 

0 件の賞賛
返信

830件の閲覧回数
Othmane1
Contributor II

can you elaborate a little bit on these synchronization requirements?

0 件の賞賛
返信

825件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

In general way –

Any instruction that alters the context in which data addresses or instruction addresses are interpreted, or in which instructions are executed, is called a context-altering instruction. A Context Synchronizing Instruction ensures that all changes due to context altering instructions have taken effect.

It is stated either in core RM or EREF RM as well as synchronization requirements for SPRs. EREF RM, section 5.5.4 Synchronization.

Write to PID0 register (spr 48) needs to be followed and predecessed by 'isync', then the solution is bulletproof.

davidtosenovjan_0-1697107587396.png

 

0 件の賞賛
返信