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

nrf51822 GPIO as open collector driver

I need to drive low a IO from a GSM modem: image description

They suggested to this with a open collector driver. On other microcontrollers usually I have a floating option for the IO, so I can have the IO on a floating state and than drive it low. How can I achieve it with the nrf51822 GPIO? I didn't get well the drive options on the reference manual. What standard, high drive and disconnect means and why there are two parameters? Do you have a schematic that could explain it better?

thank you

  • If the manual says open collector, then you better put a NPN transistor such as 3904 or 8050 there.

    If M95 internally pulled high to +5V, then it is there will be a current (small through) flowing through the nRF internal clamping diode.

    If you really want to do your "trick". 51822 IO can be configured as input without No Pulls, which is floating. Then configure it to output and set to 0.

    I hope this helps.

  • According to the ref manual, nRF51822s have open collector mode.

    In the pin's PINCTL register, set the pin drive to S0D1 "standard 0, disconnect 1". I would expect that's what you want.

    Be mindful of voltages though..... You might need an external transistor/FET/etc to buffer the micro.

  • There is somewhat an open collector guide available here.

    To explain a little what the different pin settings mean I include the comments for the drive options from the nRF51 SDK:

    #define GPIO_PIN_CNF_DRIVE_S0S1 (0x00UL) /*!< Standard '0', Standard '1'. */
    #define GPIO_PIN_CNF_DRIVE_H0S1 (0x01UL) /*!< High '0', Standard '1'. */
    #define GPIO_PIN_CNF_DRIVE_S0H1 (0x02UL) /*!< Standard '0', High '1'. */
    #define GPIO_PIN_CNF_DRIVE_H0H1 (0x03UL) /*!< High '0', High '1'. */
    #define GPIO_PIN_CNF_DRIVE_D0S1 (0x04UL) /*!< Disconnected '0', Standard '1'. */
    #define GPIO_PIN_CNF_DRIVE_D0H1 (0x05UL) /*!< Disconnected '0', High '1'. */
    #define GPIO_PIN_CNF_DRIVE_S0D1 (0x06UL) /*!< Standard '0', Disconnected '1'. */
    #define GPIO_PIN_CNF_DRIVE_H0D1 (0x07UL) /*!< High '0', Disconnected '1'. */
    

    The different options specify how a configured GPIO pin sinks current when you set it low (write 0 to the pin) and how a configured pin sources current when you set it high (write 1 to the pin).

    • Standard means the pin will be sourced or sinked with up to 0.5 mA for the assigned signal (high or low)
    • High source means the pin will be sourced with up to 5.0 mA for high signal
    • High sink means the pin will be sinked with up to 15.0 mA for low signal
    • Disconnected means there is no drive, the pin is high impedance. Consequently, there is no current flowing to or from the pin, no matter the drive of any external circuit connected to the pin

    Examples:

    • Option GPIO_PIN_CNF_DRIVE_S0S1: When writing 0 to the configured pin, the pin is driven to low signal with up to 0.5mA. When writing 1 to the configured pin, the pin is driven to high signal with up to 0.5mA.
    • Option GPIO_PIN_CNF_DRIVE_H0D1: When writing 0 to the configured pin, the pin is driven to low signal with up to 15.0mA drive strength. When writing 1 to the configured pin, the pin is disconnected (no drive) and will be floating if it is not driven by an external pullup/pulldown resistor or IC.

    Note: nRF51 can source+sink GPIO pins with maximum 15mA totally. This means that you should not let combined sink and source current of all GPIOs exceed 15mA at any time.

  • hi,stenfan: if i want the pin output 1.2mA as 1 (high signal), the other is 0 (low signal) , how to config the drive strength option?

Related