I am trying to figure out how to interface a A2235-H GPS module.

The datasheet says that one pin(nRST) must be connected to open collector or open drain output of uC while an other one(ON_OFF) must be connected to push-pull output of uC.

I am using an AVR uC. Is it wrong to connect directly in AVR pins or should I build some circuit between?


The port pins of the AVR series microcontrollers do not have an open-drain mode as such, like there is from many other manufacturers (PIC, Freescale, etc). They only have a DDxn (data direction register, input or output), port in register (PINxn), and port out (PORTxn).

For these other micros, you can set a output pin to be open-drain, and then switch it to zero or high impedance simply by writing a 0 or 1 in the PORT register.

You can simulate this behavior for the AVRs, by doing the following:

To sink current, set the data direction pin DDxn to 1 (output). Then set the bit in the output PORTxn register to 0.

To change this to a high-impedance open-drain, set the data direction pin DDxn to 0 (input), while leaving the PORTxn bit 0.

So instead of toggling the PORT pin, you are toggling the data directionpin.

Here is a table out of the datasheet for the ATmega328:

enter image description here

Note that in this configuration (DDxn = 0, PORTxn = 0), there is no internal pull-up resistor. If you want one, then you can set the PORTxn bit to 1 instead of 0, assuming pullups are enabled for the port in the PUD register.


Assuming that you are powering the AVR at the same voltage as the GPS module the ON_OFF pin can be driven directly from a push-pull pin of the microcontroller. The nRST pin I would drive from an open-collector (or open-drain) pin if the AVR has one. If not, add a NPN transistor such as a BC848 to drive the pin. The manufacturer has specifically stated to use an open-collector drive to nRST, there may be a good reason for this.

  • \$\begingroup\$ BC848 with a limiting resistor in base i pressume..? \$\endgroup\$ – Tedi Jan 20 '16 at 23:36
  • 1
    \$\begingroup\$ Yes, 10k should do nicely. \$\endgroup\$ – Steve G Jan 20 '16 at 23:41

A Typical microcontroller GPIO has Three States.

  1. Output Low
  2. Output High
  3. Input/High-Impedence (Hi-Z)

A Push-Pull output is 1 and 2. It directly connects the output to a high or low state. Push aka High, 1, Source. Pull aka Low, 0, Sink. This is a normal output pin.

A Open Collector or Open drain is 1 and 3. It only pulls the line low, and lets it go, by going into High-Impedence Input mode. Typically this means there is an external pull-up resistor. This Open Collector mode is used to prevent multiple ICs from trying to push or pull a line at the same time, causing a dead short (One goes High, one goes Low). In Open Collector mode, the multiple ICs can only pull it low.

You can mimic an open collector in your AVR microcontroller by switching between Output Low and Input. Never switch it to Output High. If you don't feel comfortable with that, any common npn transistor will work.

The Dotted line is the inside of your AVR's GPIO pins, simplified. The Pull-Up resistor in this case, is inside the A2235-H GPS's nRST pin (as far as I can tell from it's data sheet).


simulate this circuit – Schematic created using CircuitLab

  • 1
    \$\begingroup\$ Does the AVR actually have bipolar outputs? \$\endgroup\$ – Krunal Desai Jan 19 '16 at 21:04

You should be fine tying it to the output of the microcontroller as long as nothing else is driving that same net. You wouldn't want a scenario where one device is pulling the net low while another is pulling high creating a low-resistance, high current path from power to ground.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.