Use internal oscillator of arduino uno, what's the pin characteristics of PB6/PB7?

Hi, I use the internal oscillator of arduino uno (atemga328p-pu), then two pins, PB6 and PB7, can be used for other purposes:


I find that the PB6 and PB7 can be used as regular IO pins, namely, PB6→20, PB7→21.
Does the two pins has other characteristics? such as INPUT_PULLUP, or PWM, or interrupt?
Best regards.

PB6 & 7 are not exposed on the uno

your diagram is for the atmega chip.

If you are using the bare chip you will need to refer to the data sheet.

If you are using a bare atmega328 chip, those pins will be regular digital input/output pins, with INPUT_PULLUP but not PWM.

If you are using Uno, those pins are not accessible. If you try to attach wires directly to the chip's pins while the chip is on the Uno board, you risk physically damaging the chip or its socket, and you risk damaging the external oscillator with your circuit, or the external oscillator could prevent your external circuit working as expected.

If you are using the Uno core, I don't think pins 20 & 21 will be available to your sketch. If you use miniCore with a stand-alone atmega328, they will be available as pins 20 & 21. If you try to use miniCore with the atmega chip on the Uno board, I don't know if you will be able to program it with serial programming.

1 Like

Thank you for replying.
Yes, I use the atmega328p-pu chip.I Sorry, I confused the UNO board with the M328P chip.
Best regards.

Thank you for replying.
This is how it happened: I searched in the web, and find that the miniCore says that the PB6 and PB7 can be used as pin20 & pin21:

Then I use Platformio as the IDE, the arduino code is:

#include "Arduino.h"

void setup()
{
  pinMode(21,OUTPUT);
}

void loop()
{
  digitalWrite(21,HIGH);
  delay(1000);
  digitalWrite(21,LOW);
  delay(1000);
}

and the .ini file is:

[env:ATmega328P]
platform = atmelavr
board = ATmega328P
framework = arduino

After compiling, I get the .hex file, and using a ISP programmer to burn the .hex file, I found that the pin21 (PB7) works very well.

At this time, I have a question: whether PB6/PB7 can be used like other pins in the arduino framwork? I know that some pins has pwm, some pins has external interrupt, and some pins has input pull-up, some pins can be used as both ordinary IO pins and analog input pins, etc. These information can be easily found on the official website of arduino, but what about PB6/PB7? Are they only used as regular IO pins?

Best regards.

See your picture in the first post - all additional functions of the pins are described in diagram.
Pins PB6/PB7 has only two functions - it can be inputs for external clock (XTAL1/XTAL2) and can be used as source of PCINT interrupt.

Thank you for replying.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.