Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is UPDI pin having Vcc as output? #1188

Open
tobivan opened this issue Dec 30, 2024 · 5 comments
Open

Why is UPDI pin having Vcc as output? #1188

tobivan opened this issue Dec 30, 2024 · 5 comments

Comments

@tobivan
Copy link

tobivan commented Dec 30, 2024

Hi there,

simple circuit: LED at PA1 :-)
Trying some blinky-stuff, and I wonder why the UPDI pin is showing +Vcc
To save some energy, I took this function and I thought that PIN0 was the UPDI pin:

void disableAllPeripherals(void) {
  PORTA.DIRCLR = PIN0_bm; //  set port A0 to input
  //PORTA.DIRCLR = PIN1_bm; //  LED
  PORTA.DIRCLR = PIN2_bm; //  set port A2 to input
  PORTA.DIRCLR = PIN3_bm; //  set port A3 to input
  PORTA.DIRCLR = PIN6_bm; //  set port A4 to input
  PORTA.DIRCLR = PIN7_bm; //  set port A5 to input        
        
  PORTA.PIN0CTRL = PORT_ISC_INPUT_DISABLE_gc; // disable input buffers
  //PORTA.PIN1CTRL = PORT_ISC_INPUT_DISABLE_gc;
  PORTA.PIN2CTRL = PORT_ISC_INPUT_DISABLE_gc;
  PORTA.PIN3CTRL = PORT_ISC_INPUT_DISABLE_gc;
  PORTA.PIN6CTRL = PORT_ISC_INPUT_DISABLE_gc;
  PORTA.PIN7CTRL = PORT_ISC_INPUT_DISABLE_gc;
}

What am I missing? Do I need to connect UPDI pin if not needed?
Thanks a lot!

@hmeijdam
Copy link

You need to first set the UPDI pin as GPIO pin to be able to use it as GPIO pin.
After doing so, you will need to have a HV programmer to ever set it back to UPDI and reprogram the chip. Which is the reason why this choice is hidden/commented-out as "expert-mode" in the boards.txt file.

@tobivan
Copy link
Author

tobivan commented Dec 30, 2024

Thanks for your answer.
I don't want to use it as a GPIO pin. But why can I read VCC voltage on the UPDI pin? If it is a "programming pin" I would have expected it to be either input or connected to GND, but in no case to Vcc.

@hmeijdam
Copy link

hmeijdam commented Dec 30, 2024

Because the UPDI is HIGH in it's idle state and it has a internal pullup resistor. That's what you are measuring. If you connect a led to it, you will see it lights up a little (current flowing through the pullup resistor).

If you want to read more about the half-duplex protocol over one wire, this Microchip application note may be of interest to you.

@tobivan
Copy link
Author

tobivan commented Dec 30, 2024

Thanks, that explains it very well!
But unless not connected, it cannot draw any current, can it?

@hmeijdam
Copy link

But unless not connected, it cannot draw any current, can it?

"Unless not connected" means it is connected.

If not connected it cannot draw current.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants