cancel
Showing results for 
Search instead for 
Did you mean: 

GPIOS Input mode pins affecting output mode pins.

Vikas Bhardwaj
Associate II
Posted on February 17, 2017 at 10:33

I am using STM32F4 micro controller and few GPIO pins i am making as input pins for sensor input staus and few as output pins to activate the LEDs. As soon as i configure few pins as input pins for sensor, few out pins for LED drive stop working, I am confuse, what could be the reason, software or hardware?

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on February 20, 2017 at 06:26

Thanks for your suggestion.

Problem has been resolved, It was because of optimization settings of the tool. I disabled option for  'common sub expression delete' then firmware start working properly, So seems like my code optimized by the tool and getting this issue . 

Could some body tell me coding rules or standard(MISRA C), so that I could avoid this problem? 

View solution in original post

4 REPLIES 4
Oliver Beirne
Senior
Posted on February 17, 2017 at 12:49

Hello

I have moved your question to the

https://community.st.com/community/stm32-community/stm32-forum?sr=search&searchId=6c49c51e-345f-465b-bac5-e5d475b0e81b&searchIndex=0

‌ where someone should be able to assist you.

Thanks

Oli

Posted on February 17, 2017 at 13:02

Thanks!!

S.Ma
Principal
Posted on February 18, 2017 at 16:29

Use BSSR register from Gpio to modify digital outputs, not DR directly. Make sure MODER register is written properly too. If using a debugger, stop the code in your main loop, open the register window and view the gpio register. Manually play with them to check it out.

Posted on February 20, 2017 at 06:26

Thanks for your suggestion.

Problem has been resolved, It was because of optimization settings of the tool. I disabled option for  'common sub expression delete' then firmware start working properly, So seems like my code optimized by the tool and getting this issue . 

Could some body tell me coding rules or standard(MISRA C), so that I could avoid this problem?