Skip to main content
Vikas Bhardwaj
Associate
February 17, 2017
Solved

GPIOS Input mode pins affecting output mode pins.

  • February 17, 2017
  • 2 replies
  • 1057 views
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?

    This topic has been closed for replies.
    Best answer by Vikas Bhardwaj
    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? 

    2 replies

    Oliver Beirne
    Associate II
    February 17, 2017
    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

    Vikas Bhardwaj
    Associate
    February 17, 2017
    Posted on February 17, 2017 at 13:02

    Thanks!!

    S.Ma
    Principal
    February 18, 2017
    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.

    Vikas Bhardwaj
    Vikas BhardwajAuthorBest answer
    Associate
    February 20, 2017
    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?