cancel
Showing results for 
Search instead for 
Did you mean: 

My code is not entering in while loop

Prasad Dait
Associate II
Posted on March 11, 2018 at 09:10

The STM32F103C8 is throwing an error it is repeating the code from main loop again and again and not entering inside While loop. I am also unable to debug it in attolic studio since it is showing an error also. I have tried various codes but nothing is working .

The error coming while debugging is..

Failed to execute MI command:

target extended-remote localhost:61234

Error message from debugger back end:

Remote communication error. Target disconnected.: No error.

 The code is attached in zip file. It is not entering in While loop but repeatedly running main loop from begining till begin of while

https://community.st.com/tags♯/?tags=stm32f103c8

#stm32f103c8
6 REPLIES 6
Posted on March 11, 2018 at 10:15

Sorry to hear that, care to share enough detail so others might be able to assist you?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 11, 2018 at 10:37

throwing an error

What, exactly, does that mean?

it is repeating the code from main loop again and again

Is the watchdog restarting it?

I am also unable to debug it in attolic studio since it is showing an error

So what error, exactly, is it showing?

How do you expect anyone to help you to resolve that error without even knowing what error it is?!

Posted on March 11, 2018 at 11:14

i have updated question as per your suggestions thank you

Posted on March 11, 2018 at 15:10

Chrome will strip the formatting/tabulation, Firefox won't.

You look to have a return 0 ; in main(), you don't want to do this as it is either likely to cause the system to crash, or re-enter.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 11, 2018 at 22:11

No sir It is not a problem because of that return condition I am receiving same problem in common blink function too the code I  have updated in answer which will give you proper understanding of this issue. I am sure about code since even a normal gpio toggle is not working

Posted on March 12, 2018 at 01:34

Code seems to evolve and be different.

Perhaps consider a better, more robust, debugger?

Look at the startup.s code and replace the BX LR after it calls main with an infinite loop. Not seeing anything here immediately that would cause a reset. If it does this across lots of programs, scope the supply pins, and the NRST pins and confirm there is nothing odd going on there.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..