I use ATmel ATmega32U4 in a schematic which copies Arduino Leonardo almost completely. So, Caterina-Leonardo bootloader works fine with it.
Unfortunately, I have run out of all available output pins. So, I wonder whether I can use pin 22 (TXLED, PD5) as additional digital output.
As I understand from many forums and Q&As out there, I have to build custom bootloader. I’ve added my own board to Arduino IDE and built new bootloader from Caterina code (so, the compiler and LUFO libraries work well), but I don’t have a clue how to properly disable TXLED and RXLED signals, in order to use these pins for output correctly (RXLED as the 17-th Leonardo digital pin and TXLED as the 30-th one).
On the other hand, the board uses USB (ATmega32U4 pins of 3 and 4) for communication with the computer (it needs to be a plug-and-play device), sending some data to it, and for uploading new sketch’s versions through Arduino IDE. So I need to use USB functionality and TXLED as an output pin simultaneously. (The output pin doesn’t lead to the computer, just in case).
Can you please tell me, is this issue solvable, and, if yes, how can I get things done? What should I change in the bootloader sources (like caterina.h, caterina.c, descriptors.c etc.)?
Any useful information on that will be highly appreciated.
I spend hours digging bootloader code and different websites but eventually failed. For instance:
Seems like the last guy had the same problem and successfully solved it, but unfortunately he didn’t describe his solution and didn’t attach any source.
Here is my circuit diagram:
I enabled internal pull-ups in ROW1..ROW4 and want to make them LOW when switch is pressed. It works well with all STRs except the 3rd one. The problem is that STR3 is connected to pin 22 (TXLED).