Hello all,
Recently I have been working on a personal project which involves designing my own PCB for standalone Arduino with MCP23017 I/O expander and MAX7219 LED drivers.
To give a quick rundown, MCU used is Atmega 328P (Atmega328P-AU), with MCP23017 I/O expander connected via I2C, and MAX7219 LED drivers connect via SPI. For USB communication, I am using FT231XS USB to Serial communcation IC.
Initially, I tested everything on a breadboard, then designed PCB afterwards. For reference, I have used SparkFun's Redboard, as they use same FTDI chip for USB to Serial Communcation.
After my PCB has arrived, I assembled all the parts, then connected Arduino UNO via ICSP pins to burn bootloader into standalone board. This worked with no issues so far. Problem came afterwards.
After burning a bootloader to Atmega328P-AU, I plugged in a USB cable to the computer and to the board, then tried to upload a sketch into the MCU. This is where I have the problem; after clicking upload;
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\CS\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"
Using Port : COM13
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xf1
And after 10th attempt, avrdude stops. So after searching through the forum and internet, I have tried following troubleshooting procedures to fix the issue;
Starting with general troubleshooting;
- Is USB cable bad? Is USB port bad?
- I have tested different cables and different ports on my computer, and no issue was found.
- Which version of IDE am I using?
- I am using latest stable version; 1.8.12
- Which settings am I using for uploading bootloader?
- I am using Arduino UNO as board, and programmer is "Arduino as ISP"
Moving onto FTDI chip;
- Does FT231XS properly recognized by the computer?
- Yes, I am using x64 Windows 10, after installing the driver, computer shows my FT231XS chip as COM13.
- Does FT231XS having issue with RX and TX?
- No, I have tested this using loopback method by connecting RX and TX of FT231XS pins, opened the serial terminal, then sending a string to see if there was any loss.
- Are there any short circuit on the board?
- No, after soldering the parts onto the board, I have checked for any short circuits or overlapping solder joints.
Then moving onto Atmega328P-AU;
- Is MCU isolated when chip is being programmed? (By programmed, meaning burning the bootloader or uploading a sketch via programmer)
- Yes, although all the chips are soldered into one board, other components, such as MX7219 or MCP23017 are powered on a separate rail. So during programming, MCU is powered only by Programmer Arduino Uno.
I also have small circuit to select bootloading mode to prevent any communication between Atmega328P and FT321XS(Shown below).
- Was there any issue during burning bootloader?
- No, and this has been confirmed by two different methods; using standard procedure and by using NickGammon's Atmega Board Programmer Sketch.
Both methods shows successful output of writing all the fuses and flashing the bootloader.
- Have I tried changing fuse settings from the board.txt?
- Yes, I first burning the 0xFF 0xDE 0xFD, and it worked, but could not upload a sketch through FT231XS.
Then I used 0xFF 0xDE 0x05, and it worked, but could not upload a sketch through FT231XS.
- Can I upload sketch with "Upload Using Programmer"?
- Yes, and I also confirmed uploaded sketch works by checking on my 7-segment display soldered onto the board.
- Is RX and TX pins connected to TX and RX pins of FT231XS?
- Yes, as shown in the schematic below, I have connected TX of Atmega328P to RX of FT231XS, and RX of Atmega238P to TX of FT231XS.
Here is pin connection on Atmega328P side.
- Is there a RC circuit on RESET pin?
- Yes, 0.1uF ceramic capacitor in series to DTR pin and 10k resistor to pull RESET pin high.
- Does Atmega238P quickly pulses RESET pin when uploading starts?
- Yes, this was confirmed by looking at the 7-segment display quickly flashing and going back to initial loop.
This also confirmes that DTR pin on FT231XS drives RESET pin low quickly.
- What happens when IDE starts uploading sequence?
- RX indicator on FT231XS flashes 3 times initially, then each time when communication fails, RX indicator flashes once.
So here I am, with a board that works with ICSP but no USB connection.
My last troubleshooting would be my Atmega328P-AU MCU damaged internally, and cannot use PD0 and PD1, so I am about to desolder the old Atmega328P and re-solder new Atmega328P-AU.
BUT, before I do that, I'd like to know if there is ANY other troubleshooting I can do before I confirm current MCU being bad.
So to sum up my question...
- Is there any issue with my current setup?
- Is there any other troubleshooting I can do without physically damaging the board(that is, cutting the copper trace off)?
Thanks in advance guys, sorry for the long post. If you need any more information regarding my schematics, let me know.