I have made my own Arduino UNO board for a small project and I am struggling with the USB functionality to upload sketches. I have designed my board using the ATMEGA328P and the ATMEGA16U2 in the exact same way than on an Arduino UNO board, the only differences with the UNO board are on the 328 I/O which are broken out in a different way (I have included the CAN shield directly on the board as well).
I bought as well an AVR programmer as I thought I will use it to program first both chip for the board to be recognized as an UNO through the IDE.
I have access to both ICSP header (one for the 328, one for the 16U) and I think I have loaded both bootloader. The all board is now recognized as 'Arduino UNO' when I connect the USB from the 16U2, which I think at least means that the 16U2 is correctly programmed. However, I cannot send any sketch through the IDE as it timeout with a "avrdude: stk500_recv(): programmer is not responding".
If I connect through the 328 ICSP header and use the 'Upload Using a Programmer' option, it works fine all functionalities are behaving as expected.
I think the only thing not working is the connection between the 328 and 16U when trying to load a sketch through USB, but not sure why? (wrong bootloader, wrong init...). On the circuitry I have kept as it is on an UNO all quartz, resistors, links, so I'm not sure if I missed something software-wise to declare both chips..
If anyone have a starting point or could guide towards something I would appreciate it massively!