Author Topic: Atmega328P AU vs 32U4  (Read 48677 times)

0 Members and 1 Guest are viewing this topic.

Offline QuincyJones

  • Thread Starter
  • Posts: 270
  • Location: The Greatest Of Them All, England
Atmega328P AU vs 32U4
« on: Sun, 03 July 2016, 19:59:18 »
what's the difference between a p and u4? I can't find anything on Google about the versions! Would a 'p' serve as a decent board for keyboard controller?
« Last Edit: Sun, 03 July 2016, 20:01:59 by QuincyJones »
SENT FROM MY TRKA-100-ULTRA-PRO-1R WITH FLASHY MULTI-COLOURED LEDS FOR MEGA ULTRA COOLNESS
(please like me)

       

Offline engicoder

  • Posts: 721
  • Location: North Carolina
Re: Atmega328P AU vs 32U4
« Reply #1 on: Sun, 03 July 2016, 20:10:17 »
what's the difference between a p and u4? I can't find anything on Google about the versions! Would a 'p' serve as a decent board for keyboard controller?

The ATMega328P and ATMega32U4 are both in the AVR family and have 32K of flash memory (hence the 32 in the name). They differ in package and what peripherals are offered. The biggest difference is that the 32U4 has a USB Device peripheral (hence the U in the name) the 328P does no have a dedicated USB peripheral, although a bit-bang library (V-USB) does exist. If you want to use the chip for a USB keyboard, the ATMega32U4, or any of the other USB equipped devices in the AVR family is a better choice.

Edit: The AU suffix seen in the part number ATMega32P-AU is simply a package/case designation. The P is for PicoPower which is a set of features that allows for saving power including turning off peripherals that are not in use.
« Last Edit: Sun, 03 July 2016, 20:17:54 by engicoder »
   

Offline kolec94

  • Posts: 111
Re: Atmega328P AU vs 32U4
« Reply #2 on: Sun, 03 July 2016, 20:11:01 »
depends on what you are doing the atmega328p is cheaper and supports serial and you need a serial to usb converter to use with usb
the atmega32u4 work with usb but not with serial
for a keyboard I would go with the atmega32u4, but their are time when the atmega328 is useful because it uses serial
« Last Edit: Sun, 03 July 2016, 20:13:07 by kolec94 »

kbparadise v60 blues

Offline QuincyJones

  • Thread Starter
  • Posts: 270
  • Location: The Greatest Of Them All, England
Re: Atmega328P AU vs 32U4
« Reply #3 on: Sun, 03 July 2016, 20:47:03 »
Oh, I thought I'd be able to use the onboard USB connector that are on say, arduino nano boards for usb writes?
« Last Edit: Sun, 03 July 2016, 21:09:39 by QuincyJones »
SENT FROM MY TRKA-100-ULTRA-PRO-1R WITH FLASHY MULTI-COLOURED LEDS FOR MEGA ULTRA COOLNESS
(please like me)

       

Offline kolec94

  • Posts: 111
Re: Atmega328P AU vs 32U4
« Reply #4 on: Sun, 03 July 2016, 22:34:12 »
Oh, I thought I'd be able to use the onboard USB connector that are on say, arduino nano boards for usb writes?
you can the difference with the atmega328p is their is a ftdi chip to send it over serial

kbparadise v60 blues

Offline QuincyJones

  • Thread Starter
  • Posts: 270
  • Location: The Greatest Of Them All, England
Re: Atmega328P AU vs 32U4
« Reply #5 on: Mon, 04 July 2016, 02:32:09 »
Oh, I thought I'd be able to use the onboard USB connector that are on say, arduino nano boards for usb writes?
you can the difference with the atmega328p is their is a ftdi chip to send it over serial

And this is where I get really confused. Does this mean that a computer won't natively understand / recognise the USB device? I'm looking at the cheaper ones on ebay which use the CH340G which need drivers.

Are these additional drivers only for communication when programming, or would any computer that the keyboard is to be used on need those drivers too?
SENT FROM MY TRKA-100-ULTRA-PRO-1R WITH FLASHY MULTI-COLOURED LEDS FOR MEGA ULTRA COOLNESS
(please like me)

       

Offline engicoder

  • Posts: 721
  • Location: North Carolina
Re: Atmega328P AU vs 32U4
« Reply #6 on: Mon, 04 July 2016, 07:32:39 »
And this is where I get really confused. Does this mean that a computer won't natively understand / recognise the USB device? I'm looking at the cheaper ones on ebay which use the CH340G which need drivers.

Are these additional drivers only for communication when programming, or would any computer that the keyboard is to be used on need those drivers too?

The FTDI chips and the CH340G are both USB VCP to serial bridges. They allow the microcontroller to use it's serial UART to talk to the PC via a Virtual COM Port (VCP). Driver software must be installed in order for the OS to communicate properly with the bridge chip and create the virtual COM port. The drivers are specific the the bridge chip used. The arduino requires these a driver as well, but is usually installed as part of the Arduino tools installation.

A USB VCP to serial bridge chip does not support the USB HID protocol used USB keyboards. In other words, you could not use the ATMega328P and CH340G  bridge chip to create a plug and play USB keyboard.

Note: Most of the Arduino's have used a USB VCP to Serial bridge chip for programming and communications purposes.  The morerecent UNO replaced the dedicated bridge chip with an ATMega8U2 with custom firmware that functions as a bridge. The 8U2 could be reprogrammed to act as a USB HID to serial bridge allowing the Arduino to act as an HID keyboard. The Arduino Micro has an ATMega32U4 and can also be programmed to act as an HID keyboard.
« Last Edit: Mon, 04 July 2016, 07:39:25 by engicoder »
   

Offline QuincyJones

  • Thread Starter
  • Posts: 270
  • Location: The Greatest Of Them All, England
Re: Atmega328P AU vs 32U4
« Reply #7 on: Mon, 04 July 2016, 13:16:04 »
And this is where I get really confused. Does this mean that a computer won't natively understand / recognise the USB device? I'm looking at the cheaper ones on ebay which use the CH340G which need drivers.

Are these additional drivers only for communication when programming, or would any computer that the keyboard is to be used on need those drivers too?

The FTDI chips and the CH340G are both USB VCP to serial bridges. They allow the microcontroller to use it's serial UART to talk to the PC via a Virtual COM Port (VCP). Driver software must be installed in order for the OS to communicate properly with the bridge chip and create the virtual COM port. The drivers are specific the the bridge chip used. The arduino requires these a driver as well, but is usually installed as part of the Arduino tools installation.

A USB VCP to serial bridge chip does not support the USB HID protocol used USB keyboards. In other words, you could not use the ATMega328P and CH340G  bridge chip to create a plug and play USB keyboard.

Note: Most of the Arduino's have used a USB VCP to Serial bridge chip for programming and communications purposes.  The morerecent UNO replaced the dedicated bridge chip with an ATMega8U2 with custom firmware that functions as a bridge. The 8U2 could be reprogrammed to act as a USB HID to serial bridge allowing the Arduino to act as an HID keyboard. The Arduino Micro has an ATMega32U4 and can also be programmed to act as an HID keyboard.

Thanks for a great explanation. You've just saved me about £8 as I had a few lined up to buy!
SENT FROM MY TRKA-100-ULTRA-PRO-1R WITH FLASHY MULTI-COLOURED LEDS FOR MEGA ULTRA COOLNESS
(please like me)

       

Offline QuincyJones

  • Thread Starter
  • Posts: 270
  • Location: The Greatest Of Them All, England
Re: Atmega328P AU vs 32U4
« Reply #8 on: Mon, 04 July 2016, 14:06:16 »
Uhm, thinking outside the box, would it be possible to attach an USB breakout board and use software emulation from the 328P? Or, would the emulation have to be done at the hardware level?
SENT FROM MY TRKA-100-ULTRA-PRO-1R WITH FLASHY MULTI-COLOURED LEDS FOR MEGA ULTRA COOLNESS
(please like me)

       

Offline kolec94

  • Posts: 111
Re: Atmega328P AU vs 32U4
« Reply #9 on: Mon, 04 July 2016, 16:06:05 »
Uhm, thinking outside the box, would it be possible to attach an USB breakout board and use software emulation from the 328P? Or, would the emulation have to be done at the hardware level?
yes you can do serial over usb persay
adds more room for error

kbparadise v60 blues