Now I am using ATMEGA328P and want to communicate with computer in serial using B connector female (also want to provide power from computer to ATMEGA328P using B connector).

So here is my question. How can I connect D+ and D- to ATMEGA328P's pin No. 2 (PD0/RX) and pin No. 3 (PD1/TX)? In other words which pin should I connect to D+ and D- ? Also is it possible to connect them directly?

Thank you in advance.

  • 1
    Have you examined the schematic of an Arduino device that uses the '328P? – Ignacio Vazquez-Abrams Nov 1 '17 at 2:21
  • I have seen the schematic of Arduino but they connect D- and D+ to ATMEGA1602. But this time I want to use ATMEGA328P only. – zalt Nov 1 '17 at 2:44
  • 1
    Did you ever stop to wonder why they do that? – Ignacio Vazquez-Abrams Nov 1 '17 at 2:45
  • I'm not quite sure, maybe due to converting. But now I am asking is it possible doing that with ATMEGA328P only? – zalt Nov 1 '17 at 2:54
  • Pull up the datasheets for both devices; you don't need the complete datasheets, just the summary datasheets will do. Examine and compare the front pages. – Ignacio Vazquez-Abrams Nov 1 '17 at 3:49

The Arduino Uno (and similar boards) have a chip on them that does serial communication via a dedicated USB chip (the ATmega16U2 chip). You can't just connect pins 2 and 3 to D+ and D- and turn that into USB.

You can conceivably do it using V-USB which does USB in software in conjunction with a few extra components.

You can also buy external serial to USB adapters which do the conversion externally. If you Google serial to usb adapter you will find quite a few for around $3.

  • The Adafruit Trinket Pro adafruit.com/product/2000 uses this, so does the usbasp (not Arduino code) fischl.de/usbasp @zalt, if you have to ask, don't do this. I has special requirements for the hardware and software, and it is something for advanced engineers. Stay away from it. – Jot Nov 1 '17 at 10:57
  • ok I did with HID-class USB Serial Communication for AVRs using V-USB. I could monitor the incoming data to PC by HID Serial Monitor. However, I need to monitor the incoming data by Serial monitor such as tera-term or Arduino's serial monitor. Is there anyway to do that with HID-class ? I tried trinket-fake-usb-serial, but did not work at all. Please I need help. – zalt Nov 9 '17 at 7:05
  • This sounds like a different question to me. First you ask if certain ports can be connected to a USB device, now you are asking about monitoring serial data with a HID-class USB. I suggest you make a new question. Offhand, using a HID (Human Interface Device) when there isn't a human there clicking away seems like a misuse of the hardware. – Nick Gammon Nov 10 '17 at 6:44
  • All I want to do is just getting the serial data from MCU(ATMEGAA328P) to PC without using serial to usb adapter. – zalt Nov 13 '17 at 2:39
  • The Atmega328P doesn't have a USB interface so what you want isn't really practical. There is no "simple wiring" that will achieve that. – Nick Gammon Nov 13 '17 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.