I've start to build a project base on Atmega328 and I need to connect to it(via USB for availability of the USB port) for debugging (I prefer to debug it with serial communication), and I don't want to carry extra device(like FTDI module) around for debugging so I did search for how to do it .
It come to my understanding that I should use one of these solution:
- Use FTDI chip(like FT232RL or ...) on my PCB.
- Use one of the AVR MCUs with USB capability and get ride of any software or hardware convertor.
- Use a software USB to serial converter like what Arduino UNO did with ATmega16u2 by using LUFA library.
- Use V-USB to emulate USB connections.
first question: LUFA on USB-enabled devices
Why use LUFA on the chip which already have a USB capability (like at90usb162 and atmega8/16/32u2, as you can see on the LUFA example project)?
My assumption is that LUFA library helps to add software support to AVR which Don't have this kind of capability.
- Am I wrong?
- Does LUFA only work on the AVR which have D+,D-,UGND and UVCC pin on them?
- Do those (USB) pins need extra hardware/software to work?
I know Atmega16U2 is super cheap but unfortunately my local supplier doesn't have it so it is off the table.
second question: secondary MCU alternatives
Could I use an AVR (one of those cheap types like atmega8a) as an intermediate device (to put between USB port and main Atmega328p), to not use main MCU resources and pins and it works as a software USB Serial converter,If there is, What code and schematic should I use or modify to do so? Is there any example to start with? I saw V-Bus example projects but nothing was near as what I have in mind.