How to reset a processor from MQX?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to reset a processor from MQX?

Jump to solution
4,430 Views
icheifot
Contributor I

Hi everyone

We are using twrk60n512+MQX 3.6.2

Can anyone point the way to reset the board from MQX?

Thanx in advance

Tags (2)
0 Kudos
1 Solution
962 Views
CarlFST60L
Senior Contributor II

Hi,

 

Sorry, the complete code is this:

 

 

#define MCF5225_CCM_RCR_SOFTRST                 (1 << 7)void MCF52259_REBOOT(void){VMCF5225_STRUCT_PTR reg_ptr = (VMCF5225_STRUCT_PTR)BSP_IPSBAR; reg_ptr->CCM.RCR |= MCF5225_CCM_RCR_SOFTRST;}

 

 icheifot, I meant to say "Maybe you can use a similar method that I use in MCF5225X" :smileyhappy:

View solution in original post

0 Kudos
9 Replies
962 Views
boogy
Contributor III

I hope I'm not making a huge mistake by doing this, but it works.

 

 __boot();

 

My starting task that calls all others first checks it's non-volatile ram for a correctly formatted firmware upgrade file and if it likes what it sees it upgrades a portion of my application then calls __boot();

 

So far so good.

0 Kudos
962 Views
icheifot
Contributor I

Thank you very much for your help

Your solution works, and i have created the support request with Freescale to confirm that calling  __boot() function will not lead to problems.

I will post here when i hear from them

Cheers

0 Kudos
962 Views
CarlFST60L
Senior Contributor II

I think this is the correct way to do it:

 

 

 VMCF5225_STRUCT_PTR reg_ptr = (VMCF5225_STRUCT_PTR)BSP_IPSBAR;
reg_ptr->CCM.RCR |= MCF5225_CCM_RCR_SOFTRST;

 

 

 

0 Kudos
962 Views
icheifot
Contributor I

Thank you for the reply Carl

However this code is for the m52259 board and im working with the K60n512 :smileysad:

Ill try to find the similar way to do it on Kinetis platform

0 Kudos
962 Views
Briwallis
Contributor I

To answer this question, to do a soft reset on the Kinetis platform you need to set the SYSRESETREQ bit in the NVIC AIRCR register.

 

In the MK40X256VMD100 header file the register is SCB_AIRCR and you cannot just do a read modify write on this register because it has a vector key that must be written correctly and doesn't read the same. Here is a little snippet of code to reset the Kinetis:

 

   uint_32 read_value = SCB_AIRCR;   read_value &= ~SCB_AIRCR_VECTKEY_MASK;   read_value |= SCB_AIRCR_VECTKEY(0x05FA);   read_value |= SCB_AIRCR_SYSRESETREQ_MASK;      _int_disable();   SCB_AIRCR = read_value;   while(1);

 

 

0 Kudos
962 Views
DavidS
NXP Employee
NXP Employee

This topic was included on a post from 4-Mach-20011 that implemented the Kinetis software reset capability inside a watchdog routine as well.

 

https://community.freescale.com/message/79984#79984

 

Briwal..thanks for your code as well.

Regards,

David

 

0 Kudos
962 Views
boogy
Contributor III

I'm using MQX  3.6 along with CW7.2 and a MCF52259. I tried Carl's solution and ended up with unknown MCF5225_CCM_RCR_SOFTRST.

Where is this defined?

 

0 Kudos
963 Views
CarlFST60L
Senior Contributor II

Hi,

 

Sorry, the complete code is this:

 

 

#define MCF5225_CCM_RCR_SOFTRST                 (1 << 7)void MCF52259_REBOOT(void){VMCF5225_STRUCT_PTR reg_ptr = (VMCF5225_STRUCT_PTR)BSP_IPSBAR; reg_ptr->CCM.RCR |= MCF5225_CCM_RCR_SOFTRST;}

 

 icheifot, I meant to say "Maybe you can use a similar method that I use in MCF5225X" :smileyhappy:

0 Kudos
962 Views
boogy
Contributor III

Thanks Carl, you have solved an ancient mystery.

0 Kudos