Skip to main content
ugkmen
Associate II
August 11, 2009
Question

GPIO_WriteBit function problem

  • August 11, 2009
  • 3 replies
  • 1102 views
Posted on August 11, 2009 at 18:37

GPIO_WriteBit function problem

    This topic has been closed for replies.

    3 replies

    ugkmen
    ugkmenAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:20

    Hi all,

    I use GPIO_WriteBit in my code like that

    GPIO_WriteBit(GPIOD, GPIO_Pin_0, Bit_SET);

    GPIO_WriteBit(GPIOD, GPIO_Pin_1, Bit_SET);

    GPIO_WriteBit(GPIOD, GPIO_Pin_2, Bit_SET);

    GPIO_WriteBit(GPIOD, GPIO_Pin_3, Bit_SET);

    And i am debugging the code by ULINK Cortex Debugger. But, surprisingly if i debug with F10 (step over), the GPIO_WriteBit function resets the other pins. For example, when i set the Pin_1 to high ; then Pin_0, Pin_2 and Pin_3 are reset to low.

    if i debug with F11 (step) there is no problem.

    What may be the problem?

    Thanks in advance...

    ugkmen
    ugkmenAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:20

    Hello,

    I think, it is a GPIOD Problem.

    Thanks...

    design5
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:20

    Hi:

    I suggest you try Bit Banding to access the port bits and see if you have the same issue. In general, Bit Banding is better for single bit operations because they are atomic.

    Garry.