Reseting the K64 chip programatically

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Reseting the K64 chip programatically

1,650 次查看
igor-imx
Contributor IV

Hi Everyone

We were previously working on K60M512Z chip and the following code worked perfect for reseting the device programatically:

void deviceReset(void)

{

  VCORTEX_SCB_STRUCT_PTR scb = (VCORTEX_SCB_STRUCT_PTR)&(((CORTEX_SCS_STRUCT_PTR)CORTEX_PRI_PERIPH_IN_BASE)->SCB);

  uint32_t temp_AIRCR=0;

  temp_AIRCR = (UINT)scb->AIRCR;   //Read AIRCR register

  temp_AIRCR &= 0x0000ffff;   //DES mask of the top 16-bits

  temp_AIRCR |= 0x05Fa0000;   //DES When writing to AIRCR the update 16-bit must be "0x05FA" per ARMv7-M Architecture Reference Manual (must register on ARM.com to get)

  temp_AIRCR |= SCB_AIRCR_SYSRESETREQ_MASK;   //DES set the SYSRESETREQ bit to generate software reset

// Reboot...

_time_delay (50);

  scb->AIRCR = temp_AIRCR;

  for(;;)

  return;

}

however im testing the same code with K64 chip (MK64FN1M0VLQ12) and its not causing the reset anymore.

Both setups are using MQX 4.1.0

Can anyone shed any light on whats wrong?

thank you in advance

0 项奖励
回复
2 回复数

977 次查看
DavidS
NXP Employee
NXP Employee

Hi Igor,

I tried your code and it worked using MQX4.1 with the MQX/examples/event project for TWR-K64F120M.

I did have to change the variable

temp_AIRCR = (UINT)scb->AIRCR;   //Read AIRCR register

as I didn't have UINT defined so made it uint32_t.

My terminal output looks like:

Starting event example:

Tick 0

Tick 1

Tick 2

Tick 3

Tick 4

Tick 5

Tick 6

Tick 7

Tick 8

Tick 9

Tick 10

Starting event example:

Tick 0

Tick 1

Tick 2

Tick 3

File attached (event.c).

Regards,

David

0 项奖励
回复

977 次查看
Carlos_Musich
NXP Employee
NXP Employee

Hi Igor,

Please try using next instruction:

SCB_AIRCR = 0x05FA0004;

Regards,

Carlos

0 项奖励
回复