Author Topic: ATmega8u2  (Read 4256 times)

0 Members and 1 Guest are viewing this topic.

Offline franksterb92Topic starter

  • Contributor
  • Posts: 43
  • Country: us
ATmega8u2
« on: December 06, 2020, 12:31:58 pm »
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
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 14135
Re: ATmega8u2
« Reply #1 on: December 06, 2020, 12:55:43 pm »
For an Arduino clone?
If so see https://www.arduino.cc/en/Hacking/DFUProgramming8U2
You'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.
« Last Edit: December 06, 2020, 11:49:44 pm by Ian.M »
 

Offline franksterb92Topic starter

  • Contributor
  • Posts: 43
  • Country: us
Re: ATmega8u2
« Reply #2 on: December 06, 2020, 09:59:01 pm »
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 stuff
is really confusing to me  and that link is dead is there any recourses were all this stuff would be documented thanks so much
« Last Edit: December 06, 2020, 10:03:27 pm by franksterb92 »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 14135
Re: ATmega8u2
« Reply #3 on: December 06, 2020, 11:50:54 pm »
 :palm: Link now fixed
 

Offline franksterb92Topic starter

  • Contributor
  • Posts: 43
  • Country: us
Re: ATmega8u2
« Reply #4 on: December 08, 2020, 08:45:17 am »
so Ian.M is this acualy an example   of 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 from https://github.com/arduino/ArduinoCore-avr/tree/master/firmwares/atmegaxxu2
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4668
  • Country: us
Re: ATmega8u2
« Reply #5 on: December 08, 2020, 10:17:17 am »
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.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 14135
Re: ATmega8u2
« Reply #6 on: December 08, 2020, 11:13:32 am »
@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 from https://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/FLIP

As 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. 
 

Offline franksterb92Topic starter

  • Contributor
  • Posts: 43
  • Country: us
Re: ATmega8u2
« Reply #7 on: December 08, 2020, 12:48:07 pm »
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
« Last Edit: December 08, 2020, 01:05:37 pm by franksterb92 »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 14135
Re: ATmega8u2
« Reply #8 on: December 08, 2020, 01:04:11 pm »
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.
« Last Edit: December 09, 2020, 08:07:05 am by Ian.M »
 

Offline franksterb92Topic starter

  • Contributor
  • Posts: 43
  • Country: us
Re: ATmega8u2
« Reply #9 on: December 08, 2020, 01:07:25 pm »
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
 

Offline franksterb92Topic starter

  • Contributor
  • Posts: 43
  • Country: us
Re: ATmega8u2
« Reply #10 on: December 09, 2020, 07:40:17 am »
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
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->