Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5528

Interfacing (DSI, CSI, I2C, etc.) • Re: USB interface between PC and Pi zero 2 w

$
0
0
Is there a way to use the micro USB port (not the power one) as a Serial or something similar?

Yes. As long as you don't need the zero2w to be a USB host at the same time.

This assumes RPiOS.
  1. Locate you config.txt and cmdline.txt. On Bookworm look in /boot/firmware. On Bullseye and earlier look in /boot
  2. Add the following to the end of config.txt:

    Code:

    dtoverlay=dwc2
  3. Add the following to the end of cmdline.txt:

    Code:

     modules-load=g_serial
  4. Reboot
The Pi will now have a /dev/ttyGS0 serial port and your USB host should detect a serial device.

There are also the ethernet gadget, the mass storage gadget, and others. Loading g_cdc will give both a serial port and an ethernet interface.

One word of caution: The +5v pins in both micor USB sockets and the GPIO header are directly connected together so if you connect the data port to a USB host and the power port to a PSU there will be a conflict and one supply will try to feed into the other.
WOW! Thank you very much. It worked! I can see that the Raspberry Pi is detected. Unfortunately, it seems that I can't connect to it via Matlab... Anyway...
Thank you for your warning about the power source. I was totally going to connect both USB.

Statistics: Posted by MessierW — Mon Feb 12, 2024 1:35 pm



Viewing all articles
Browse latest Browse all 5528

Trending Articles