cancel
Showing results for 
Search instead for 
Did you mean: 

Why (stm32 discovery) pins are resetting ?

YAY.1
Senior

When i use iar embeded workbench its work correctly with out f11 .

While it works by itself , its pins are resetting.

I want to learn what happening here .

Even power is enough.

Model : stm32f429

COD:

CONTROLREAD

LDR R0, =USART2_DR        

LDR R1, [R0]      

MOVE               

                LDR R2, =0x31 ;forward "1" signal 

                LDR R3, =0x32 ;back "2" signal 

                LDR R4, =0x33 ;right "3" signal 

                LDR R5, =0x34 ;left "4" signal  

                CMP R1, R2

                BEQ   FORWARD

                CMP R1, R3

                BEQ   BACK

                CMP R1, R4

                BEQ   RIGHT

                CMP R1, R5

                BEQ   LEFT

                B    CONTROLREAD

FORWARD 

                LDR R0, =GPIOD_ODR

                LDR R1, =(BIT0|BIT1|BIT4)

                STR R1, [R0]

                B    CONTROLREAD

14 REPLIES 14
Danish1
Lead II

Most of us don't do much assembly-code programming. Once a program gets over a certain size, I find C or C++ much easier.

Do you manage to set the pins "while it works by itself"?

Which pins are resetting? All of them or just some? When does it happen?

Do you have a watchdog running? (That can, after a while, reset the processor and thereby reset the bits).

How strongly do you know the program gets as far as CONTROLREAD?

You don't show the code for BACK, RIGHT, LEFT. Do they all set specific pins in GPIOD_ODR then branch back to CONTROLREAD?

It might be good practice to check there's something worth reading in USART2_DR (by looking at the RXNE bit of USART2_SR) before reading it, although I don't think that's your problem.

Hope this helps,

Danish

YAY.1
Senior

The problem is when i send a messege to go forward , it is going some then it is stopping but it should go forever.

All cod:

> i send a messege to go forward , it is going

Do you have some motor connected?

Try disconnecting it and then run the code, observe outputs by connecting LEDs on them.

JW

I have checked with just connect multimeter.

It is same....

If there isn't enough power, how can i learn ?

Instrument your code - place code changing output pins state to various places (reset, fault vector), and observe.

JW

Single step with debugger, inspect RCC, GPIO etc with peripheral view.

Should perhaps check USART RXNE to see if data is actually available.

Could also output messages to USART so you have some feedback on the terminal.

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

I have just checked again with no connection.

It is same...

The problem is it is resseting completely.

What do you suggest ???

What should i do now ???

YAY.1
Senior

I have tried to make loop , the voltage is fall down a bit then rise up .

So it is resetting again but it is very fast.

In my program , it is same but falling down is big because it is complicated than loop.

The main question is why it is resetting and if board is broken , how can i learn this ????????????

Pls , i need help......

Piranha
Chief II

@Danish​ and @Community member​ have asked you a questions and you have ignored them, making it impossible to help.