Thursday 14 August 2014

microcontroller - How can I program an Atmega32u4 over USB with this schematic?


This is my first time trying to program an Atmega32u4. I made a PCB with the following schematic:


schem


Now I've soldered all the parts onto the PCB, and I've plugged a micro usb cable from my computer into J1.


I assumed that when I pressed down SW1, the bootloader would activate and and the device would register as a serial device on my computer, so that I can program it using avrdude.



However, when I pressed the reset button, I couldn't find which port it's communicating over. I tried the command avrdude -p m32u4 -P USB -c avr109 to intialise it, just in case that port happened to work, but the output was:


avrdude: ser_open(): can't open device "USB": No such file or directory

avrdude done. Thank you.

So what's the issue here? Is there something wrong with my schematic, or with my software approach? Again, I'm a complete beginner to this, so any information at all is useful.


EDIT: I plugged it into a different USB port on my computer and now lsusb lists: "Bus 001 Device 020: ID 03eb:2ff4 Atmel Corp. atmega32u4 DFU bootloader", however when I try to use dfu-programmer (as has been suggesteed), this happens:


j4cob-antergos :: /sys/class/tty » sudo dfu-programmer atmega32u4 dump --debug 4        5 ↵
target: atmega32u4
chip_id: 0x2ff4

vendor_id: 0x03eb
command: dump
quiet: false
debug: 4
device_type: AVR
------ command specific below ------

0% 100% Reading 0x7000 bytes...
[ X ERROR


EDIT 2: I tried to use avrdude instead again, and this happened:


j4cob-antergos :: ~ » sudo avrdude -p m32u4 -P usb -c flip1                                              1 ↵

avrdude: Warning: Failed to read USB device string 1: Input/output error
avrdude: Warning: Failed to read USB device string 2: Input/output error
avrdude: Warning: Failed to read USB device string 3: Input/output error
avrdude: Warning: USB bDeviceClass = 255 (expected 254)
avrdude: Error: Failed to reset DFU state: Input/output error
avrdude: AVR device initialized and ready to accept instructions


Reading | | 0% 0.00savrdude: Error: DFU_DNLOAD failed: Input/output error
avrdude: Error: Failed to get DFU status: Input/output error
avrdude: error reading signature data for part "ATmega32U4", rc=-1
avrdude: error reading signature data, rc=-1

avrdude done. Thank you.

This is looking more hopeful, but at this point it seems like my schematic just doesn't work. Any thoughts?



Answer



From the datasheet:



enter image description here


Your schematic doesn't have a bypass capacitor on VCC. Adding one might help. To maximize its effectiveness, solder it on as close to a pair of VCC/GND pins on the chip as possible. Looking at your schematic, the best bet would be pins 14 and 15.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...