This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf51822 GPIO PIN_CNF

Hello.

I don't know difference of GPIO's input/output direction setting. There is two register for gpio setting.

  • DIRSET : Dir set register
  • PIN_CNF[n] : Configuration of GPIO pins

If i change direction of GPIO, DIRSET and PIN_CNF are all needs to change?

Best and regards. Thank you.

Parents
  • Hi,

    You can use both DIRSET and PIN_CNF[n] to configure the direction of a GPIO pin. You don’t have to use both to set the direction, if you use PIN_CNF[n] the DIR registers will be updated, and if you use DIRSET the PIN_CNF[n] will be updated. With PIN_CNF[n] you will be able to configure one individual pin at the time. With DIR, DIRSET and DIRCLEAR you can change the direction of multiple pins at the time.

    I recommend to use the GPIO driver functions to configure the GPIO pins.

Reply
  • Hi,

    You can use both DIRSET and PIN_CNF[n] to configure the direction of a GPIO pin. You don’t have to use both to set the direction, if you use PIN_CNF[n] the DIR registers will be updated, and if you use DIRSET the PIN_CNF[n] will be updated. With PIN_CNF[n] you will be able to configure one individual pin at the time. With DIR, DIRSET and DIRCLEAR you can change the direction of multiple pins at the time.

    I recommend to use the GPIO driver functions to configure the GPIO pins.

Children
No Data
Related