2

i clearly understand jp2 is the extra leftover pins of atmega16u2 . but how to access it ? i find my arduino has less pins and jp2 are the only ones left . but if it is not accessable , why do they have it ? and also , if it requires seperate programing of the atmega16u2 , i'd like to know how . i completely dunno a thing about atmega16u2 . only thing i understand is that it makes the arduino more compatible with the usb input ...

thanks alot !

4
  • What exactly are you trying to achieve? Do you just need more IO pins? Then you should either switch to a bigger Arduino, or use extensions chips or other pin-saving principles.
    – chrisl
    Commented Mar 7, 2021 at 13:14
  • i just try my best to go on with arduino uno because others are a bit expensive ... i tried to find whether i can make my own ic but a can't .that question's link >>> arduino.stackexchange.com/questions/81762/… . (i hope you remember adding a comment)
    – Raj
    Commented Mar 7, 2021 at 13:46
  • If cost is the limiting factor, and you cannot use pin-saving principles (like arranging buttons or LEDs in matrixes, or doing some kind of multiplexing otherwise) (that highly depends on your actual circuit and what you are trying to drive, so I cannot go in detail here), you might wanna look at some of the Arduino clones. You can purchase them directly from china (for example at aliexpress) or at amazon from a reseller. They don't have the same quality, but most are very good to use. The original Nano for example costs 20€, while a clone is about 2€.
    – chrisl
    Commented Mar 7, 2021 at 14:40
  • I indicated this sort of thing in the answer I gave, but I addressed it as a more or less direct answer to the question. Otherwise, like @chrisl says regarding clones. Dig around for questions on here about getting "more pins", "sharing" pins, etc.
    – timemage
    Commented Mar 7, 2021 at 15:01

1 Answer 1

1

if it requires seperate programing of the atmega16u2,

It does. Often an ATMega8U2 is used here instead though.

i'd like to know how.

You might start by having a look at HoodLoader2 and NicoHood's related projects.

This involves replacing the normal Xu2 transceiver firmware with HoodLoader. There are different ways to do that outlined in the installation instructions. If you don't have an ISP programmer or a second Arduino to behave as one, there's a method that involved burning an installer-sketch to the 328P which turns around and reprograms the Xu2 chip.

Once you have that done you can use their board definitions for put sketches onto the ATMegaXU2 itself.

Apparently, JP2's layout is flipped on some boards. So, beware of that. In any case, the header it makes the ATMegaXU2's PB4, PB4, PB6, and PB7 available. Sketches on the XU2 would use the Hoodloader pin mapping of these:

Arduino Pin No. AVR GPIO PIN
D4 PB4
D5 PB5
D6 PB6
D7 PB7

Or course, now you need to find some way to coordinate what happens on the ATMegaXU2 with the ATMega328P.

i find my arduino has less pins and jp2 are the only ones left.

There are clever ways to reuse pins on microcontrollers. For example, it is possible to put an LED and a switch on the same GPIO pin. And there are GPIO expanders, SPI/I2C ADCs, etc.

Messing with JP2 and programming the ATMegaXU2 and having it coordinate with the 328P may be more trouble than you like just to get a couple extra pins.

but if it is not accessable, why do they have it ?

Just added capability. Usually that header is unpopulated, so there's no part cost there.

and also , i completely dunno a thing about atmega16u2 . only thing i understand is that it makes the arduino more compatible with the usb input ...

It serves the role of a USB to logic-level-serial converter for connecting to the USART of the otherwise non-USB-aware ATMega328P (you have tagged UNO). But, it can be made to run sketches. Usually if you're doing this, it's to get native USB support on an UNO (or Mega, or..), e.g. so you can have your board act as a keyboard, like you might with a Leonardo or Micro or any other board that has native-USB in normal use. And that's a large part of what NicoHood's project is about.

1
  • The Nano has two extra A/Ds available, will that do it? Same micro almost the same code.
    – Gil
    Commented Mar 10, 2021 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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