I thought I understood what I was doing with from-scratch Arduinos, but apparently I do not.
I recently built a project using a an Atmega328p-AU and an RFM69. Because of the great libraries for the RFM69 and our technicians' existing familiarity with the Arduino IDE, I've decided to use the Arduino bootloader for the project.
I've had success getting the AVR to run on 3.3V using its internal 8Mhz clock. However, I'm having a lot of difficulty setting the right fuses, getting the clock source right, and getting any connection to the UART on the 328p.
I have an AVR Dragon, a basic FTDI USB-to-UART, and an Uno at my disposal. Here's what I've tried so far:
- Burning the bootloader manually from Atmel Studio with AVR Dragon. Can't program with Arduino IDE
- Flashing the compiled hex from IDE in Atmel Studio with AVR Dragon. Program works but no UART comms.
- Flashing compiled hex + bootloader. Program works, but cannot be programmed or communicate over UART.
- Burning bootloader with Arduino UNO and the IDE. Bricked the AVR when I had the Arduino Nano selected as my board.
- Tried manually setting clock speed/fuses using a fuse calculator. Bricked the AVR.
As far as I understand, there's only a handful of bootloaders I can try. Burning them with Atmel studio does not set the appropriate fuses, whereas burning them with the Arduino IDE sets the fuses according to the board/options selected.
The operating voltage is 3.3V and I've attached a 16Mhz crystal. I have a feeling this may be part of the problem when I brick the chip I'm using. I only have 17 of the 20 pins broken out for using the AVR Dragon as a HVPP, so I can't risk bricking many more of these chips. I lifted the schematic directly from the Pro Mini. All of the labelled lines just go out to headers. I've noticed recently that my RX LED has been lit while booted up.
Here's my schematic:
My specific questions are:
- Why can I not communicate or program over UART?
- What fuses do I need to set to get this to work (not brick when I set the clock source)?
- What specific bootloader do I need to get this to work?