OzGrant 22 Posted June 3, 2016 Share Posted June 3, 2016 G'day, Other than doing a physical reset on pin 16, it is possible to initiate a reset from sketch code, Quote Link to post Share on other sites
greeeg 460 Posted June 3, 2016 Share Posted June 3, 2016 (edited) I don't use TivaC much. But it looks like you can. See the reset sources in the processor manual, taking (http://www.ti.com/tool/ek-tm4c123gxl) for example It states you can perform a system reset request from software. So it looks like all you have to do is set a flag within a register. If you wish to simulate an external reset, I believe system reset is what you'd be doing. The core reset will not reset peripherals. ----Edit: added example code ---- void app_panic( void ) { // An application error has occurred that cannot be recovered from. APINT |= SYSRESREQ; // Issue a System Reset } Edited June 3, 2016 by greeeg Quote Link to post Share on other sites
L.R.A 78 Posted June 3, 2016 Share Posted June 3, 2016 I could always just connect a pin in input (they are input by default) to the reset pin and set it to output and digital low/high (don't remember but I think it's low) when you want a reset?There are registers you can use to make a reset like greeeg said but I don't remember them on the top of my head Quote Link to post Share on other sites
spirilis 1,264 Posted June 3, 2016 Share Posted June 3, 2016 I could always just connect a pin in input (they are input by default) to the reset pin and set it to output and digital low/high (don't remember but I think it's low) when you want a reset ?There are registers you can use to make a reset like greeeg said but I don't remember them on the top of my head One thing I've wondered about this is how reliable it is - i.e. does the gpio stay in output long enough to satisfy the minimum reset pulse requirements. You'd think so since the gpio won't release until reset actually takes effect, but I wonder if that's "long enough" for a clean reset. Some type of external logic or RC timed circuit would help with that. Quote Link to post Share on other sites
OzGrant 22 Posted June 3, 2016 Author Share Posted June 3, 2016 G'day, Yup have previously used a spare O/P pin connected to RESET and it works ok. But have already made the PCB's and would have to get my customers to send the units back to me for hardware modifications. So using greeeg approach tics all the boxes. I don't normally play around with registers, and my lack of exposure is evident as I get declaration errors when I run the APINT |= SYSRESREQ; // Issue a System Reset code. RulesTivaV79.cpp: In function 'void loop()': RulesTivaV79.cpp:1851:5: error: 'APINT' was not declared in this scope USBcsv=true; ^ RulesTivaV79.cpp:1851:14: error: 'SYSRESREQ' was not declared in this scope USBcsv=true; What extra instructions do I need to execute the Reset. Grant Quote Link to post Share on other sites
greeeg 460 Posted June 4, 2016 Share Posted June 4, 2016 Hey @@OzGrant I have not used the tivaC platform. I wasn't sure on TI's implementation of CPU registers. I've fired up Energia (looks like the you're using that) Both of these look like they'll work Either: // After running this instruction the system should reset (*((volatile uint32_t *)NVIC_APINT)) |= NVIC_APINT_SYSRESETREQ; // Never reached Or: // include at top of file #include <inc/tm4c123gh6pm.h> // After running this instruction the system should reset NVIC_APINT_R |= NVIC_APINT_SYSRESETREQ; // Never reached Both should compile to the same binary instructions. NVIC_APINT_R is defined as (*((volatile uint32_t *)0xE000ED0C)) in tm4c123gh6pm.h OzGrant and Fmilburn 2 Quote Link to post Share on other sites
OzGrant 22 Posted June 4, 2016 Author Share Posted June 4, 2016 G'day greeeg, Tried your two solutions but nothing happened and the next code line executed. But you have given me a clue on how the reset can be done, and will do a deeper look at your solution, Energia allows you to duck involvement with registers, so this will be a good excuse for me to skill up in this area, Tks for your efforts, Quote Link to post Share on other sites
OzGrant 22 Posted June 6, 2016 Author Share Posted June 6, 2016 Saw a solution for MSP430 http://forum.43oh.com/topic/9678-resetting-a-msp430-from-within-energia So maybe a Watch Dog timeout the way to go. Quote Link to post Share on other sites
OzGrant 22 Posted May 22, 2017 Author Share Posted May 22, 2017 G'day, I know its been a long time since the last entry, but found a solution from TI e2e community. HWREG(NVIC_APINT) = NVIC_APINT_VECTKEY | NVIC_APINT_SYSRESETREQ; This causes a Tiva reset. Quote Link to post Share on other sites
terjeio 134 Posted May 23, 2017 Share Posted May 23, 2017 Some registers are "password" protected. From page 164, APINT-register description: VECTKEY: "This field is used to guard against accidental writes to this register. 0x05FA must be written to this field in order to change the bits in this register. On a read, 0xFA05 is returned." So if register writes does not work as expected this is something to keep in mind. Quote Link to post Share on other sites
OzGrant 22 Posted May 23, 2017 Author Share Posted May 23, 2017 G'day, The reset worked ok, but will check on the protection when I get home. Quote Link to post Share on other sites
terjeio 134 Posted May 23, 2017 Share Posted May 23, 2017 Sorry for beeing a bit terse again, OR'ing NVIC_APINT_VECTKEY with the bits you want to set is the trick to make it work since NVIC_APINT_VECTKEY is the "password" or "guard" bits to allow the other bits to be changed. My point was that some other registers are similarily protected so it is something to be generally aware of. Read the documentation carefully is my motto - and do not expect details like this to be found in the context where you might think it should be mentioned. tripwire 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.