ATmega8u2  - Page 1
Forum section: electronics / general

author: franksterb92
author_rank: Contributor
timestamp: December 06, 2020, 12:31:58 pm
content: hi guys and gals im wanting to know if the ATmega8u2 needs to be programmed to program the atmega328p if that makes since lol and if so how would i go about that thanks

author: Ian.M
author_rank: Super Contributor
timestamp: December 06, 2020, 12:55:43 pm
content: For an Arduino clone?If so seehttps://www.arduino.cc/en/Hacking/DFUProgramming8U2You'll also need to program the ATmega328P with an Arduino compatible bootloader via ISP, so it may be simpler to program the ATmega8U2 with its CDC serial port firmware via ISP.

author: franksterb92
author_rank: Contributor
timestamp: December 06, 2020, 09:59:01 pm
content: sort of im making a project were i want usb control as well as being able to just plug right in my boards usb port to flash the 328p sorry this stuffis really confusing to me and that link is dead is there any recourses were all this stuff would be documented thanks so much

author: Ian.M
author_rank: Super Contributor
timestamp: December 06, 2020, 11:50:54 pm
content: Link now fixed

author: franksterb92
author_rank: Contributor
timestamp: December 08, 2020, 08:45:17 am
content: so Ian.M is this acualy an exampleof what i would do just instead of stm32 it would be in my case atmega8u2 and use flip by atmel or could i use what dave is using and use the code fromhttps://github.com/arduino/ArduinoCore-avr/tree/master/firmwares/atmegaxxu2

author: westfw
author_rank: Super Contributor
timestamp: December 08, 2020, 10:17:17 am
content: In an Arduino-Uno-like design, the ATmega8u2 is used as a USB to Serial Converter, for talking to the ATmega328p "main" microcontroller.You have to program the 8u2 with the USB/Serial firmware, AND you have to program the 328p with the bootloader, before you can "upload" from the Arduino IDE to the 328p. You could also program either or both chips with ISP programming (needing an external "programmer" of some kind), without any prior programming (ISP is how you'd normally put the firmware and bootloader on the chips.)Note that "normally", the 8u2 does not "program" the 328; it merely provides a communications channel, and the the bootloader in the m328 "self-programs" the chip.

author: Ian.M
author_rank: Super Contributor
timestamp: December 08, 2020, 11:13:32 am
content: @franksterb92,Not really. That's for a completely different make of processor, and because Dave is using a cross-platform DFU utiility for that processor he runs into all that hassle with LibUSB drivers and Zadig.You'd be using Atmel FLIP, either the native Windows version or the native Linux version, so shouldn't have the Zadig hassles! Get FLIP fromhttps://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/FLIPAs Westfw points out, and as I mentioned earlier you'd still need an ISP programmer for the ATmega328P, either to load the final application firmware or to install a bootloader so the whole assembly can be programmed as-if it was an Arduino. Its possible to use an Arduino to emulate an Atmel ISP programmer (low voltage only) using the ArduinoISP sketch, but proper Atmel ISP compatible programmers are cheap enough that its generally not worth the hassle. Check the AVRdude hardware support list for what types of programmers will work.

author: franksterb92
author_rank: Contributor
timestamp: December 08, 2020, 12:48:07 pm
content: Thanks guys sorry this stuff gets confusing looking around the net for little bits here and there so to explain why I'm putting the 8u2 on my project so it can be easier to just plug right in my board as I make programming changes to the 328 so I dont have to plug extra stuff in my board as I currently have it plus I thought it would be cool to write a pc program to controll my project which my project essentially is the usupply I've learned so damn much doing this I just appreciate being able to ask people on here wen I get stuck or dont understand something but anyway so this is is how this will work in my mind so wen I get the 8u2 in the mail I'll solder it up attach a usb port to the related pins of the 8u2 plug a usb in the port use the flip software to put firmware on it so the 8u2 can change usb to uart for the 328p I've already put arduino bootlader on via arduino as ISPbtw is that right or am I gonna have to use the spi pins of 8u2 and use arduino as ISP to do the firmware upload hope I'm conveying all this right I know somewhat what I'm doing just not sure if this usb method will work thats why iwas asking about what Dave did i understand he using diff chips but more of how he just plugged in the chip he used to dfu it I should have clarified

author: Ian.M
author_rank: Super Contributor
timestamp: December 08, 2020, 01:04:11 pm
content: It would have been easier if you'd used a CH340 or FT232 USB<=>serial chip, which wouldn't need programming, so you'd only have to flash the ATmega328P with a suitable bootloader (as you have already done) to make it 'look' like an Arduino. However if you flash the ATmega8U2 with the official Arduino serial interface firmware, that will also work.Basing your design on an ATmega32U4 with the Arduino Leonardo bootloader would have given you more options for PC connectivity, e.g. control it as a custom USB HID device. Arduino Uno clones only have a COM port interface for PC connectivity, unless they've got at least an ATmega16U2 for their host interface and you load that with custom USB firmware rather than the usual serial interface firmware.

author: franksterb92
author_rank: Contributor
timestamp: December 08, 2020, 01:07:25 pm
content: Yea that's my back up lol incase this dont work lol it's in the same digikey package on way to my house that how I'm programming my project now well with a breakout ftdi

author: franksterb92
author_rank: Contributor
timestamp: December 09, 2020, 07:40:17 am
content: ohh ok i always wondered what the deal with the Leonardo was that sounds like a better plan then seeing how i can use it as a hid and not just a serial port see i wrote a visual studio program that had a slider and i got it adjusting the dac which was awesome but wen i tried to adjust it via rotary encoder it glitched up thanks for the advice tho