Hello again forum,
What I am trying to do is reset the autonomo through software.
After digging a bit i have found three different ways to reset, but having problems getting them to work.
They all try to set the AIRCR 2 reset bits in the system Control Block so that it resets itself, but it hangs when i call the function.
I tried defining the values in the header, Using a logical OR to write to the register, even using assemble get these examples working, result is hanging just the same.
What am i doing wrong?
Erik
PS, here are some of my sources
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0432c/Cihjajhi.html
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/Cihehdge.html
Can I ask what behaviour you are getting after triggering the reset?
What are you expecting and why does it appear to be hanging?
This should trigger a system reset request:
__DSB();
SCB->AIRCR = 0x05FA0004;
__DSB();
while(1);
I’m not sure of the __DSB() calls are strictly required. The SCB->AIRCR upper 16bits are set to 0x05FA and the SYSRESETREQ bit (bit 2) is set in the lower 16. The final loop is just to wait until the board resets.
I was expecting to get back to the setup, and loop again( once more ).
What the code did was loop like the while loop, even when that was uncommented without any reboot.
Your code works great thanks!
Other attemps:
asm volatile("LDR R0,=0xE000ED0C");
asm volatile("LDR R1,=0xFA050000");
asm volatile("STRB R0,[R1]");
or
SCB_AIRCR = SCB_AIRCR_VECTKEY(0x05FA) | SCB_AIRCR_SYSRESETREQ(1) ;
This didnt work aswell.
asm volatile("JMP 0"); // or 4