+ Post New Thread
Results 1 to 4 of 4
-
22nd January 2019, 19:53 #1
- Join Date
- Oct 2018
- Posts
- 7
- Helped
- 0 / 0
- Points
- 99
- Level
- 1
Random execution of code after a reset.
Hi All,
I think All strange problems are with me...:P:(
After the code is flashed On first power On, the code works fine...
And I start executing some part code by external USART Messages which ends up with an intentional WDGT reset..
Once reset happens...
Code starts behaving in weird manner...
The Execution directly starts executing the "DoSomething" in default without even calling the function....
This is how the Template code is
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
void SomeFunction(void) { Switch( Variable ) { case 1: Do Something; break; case 2: Do Something: break; default: Dosomething; break; } }
How come this could happen...
Can anyone helpme with this thing??
-
Advertisment
-
22nd January 2019, 20:20 #2
Awards:
- Join Date
- Jul 2009
- Location
- Aberdyfi, West Wales, UK
- Posts
- 12,547
- Helped
- 4181 / 4181
- Points
- 76,699
- Level
- 67
Re: Random execution of code after a reset.
We would have to see the full code but usually this happens because some variable isn't initialized. A hardware reset and a watchdog reset are not identical, you should refer to the data sheet to see the state of registers after each occurs.
Brian.PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.
-
Advertisment
-
22nd January 2019, 23:05 #3
- Join Date
- Jan 2015
- Posts
- 1,004
- Helped
- 320 / 320
- Points
- 7,187
- Level
- 20
Re: Random execution of code after a reset.
I second the call to see all of the code (or, preferably, a short but complete code example that demonstrates the problem).
What device?
Can you explain how you are determining where the code starts after a WDT reset?
As the code is 'C', I'm certain that there will be code executed as part of the C runtime that sets things up before the 'main' is called. Are you setting a breakpoint in this startup code or just somewhere in your own code?
Susan
-
Advertisment
-
22nd January 2019, 23:08 #4
- Join Date
- Oct 2011
- Location
- Tallinn, Estonia
- Posts
- 1,567
- Helped
- 358 / 358
- Points
- 8,870
- Level
- 22
Re: Random execution of code after a reset.
PIC and other 8-bit microcontrollers doesn't support core fault vectors, in case of any troubles with pointers they just getting crazy. That's why learning with arms or linux is better for begginers. You can at least understand where you doing something wrong and stop guessing.
Love me or hate me. All infractions will be ignored.
+ Post New Thread
Please login