Jump to content

Recommended Posts

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

 

post-274-0-63611200-1464925232_thumb.jpg

 

It states you can perform a system reset request from software.

 

post-274-0-53354700-1464925236_thumb.jpg

 

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 by greeeg

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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,

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...