LucyBR
Posts: 1
Joined: Wed Jun 22, 2022 6:52 pm

Raspberry Pi 4 Model B don't recocnise a usb male-male cable.

Wed Jun 22, 2022 7:13 pm

I need to connect a Raspberry Pi 4 Model B to laptop using a usb male-male cable. Raspberry runs a python script, this receive data via Modbus RTU. This datas are created by PyModSlave Simulator that's runs in my laptop. My problem is that Raspberry don't recocnise the usb male-male cable. I tested differents usb male-male cables, but doesn't work and usb ports of Raspberry is works with mouse e keyboard.
How to resolve this problem?

ghp
Posts: 2492
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany

Re: Raspberry Pi 4 Model B don't recocnise a usb male-male cable.

Thu Jun 23, 2022 5:05 am

RPi is a USB host.
Computers are USB host.
Not possible to bring these together.

You could use a network connection between RPi and computer and set up a socket connection.

Or use an USB to ttl serial(3.3V) like https://www.adafruit.com/product/954. Connect Adapters GND, TX, RX to RPI Gnd, Rx, Tx. Enable Uart in raspi-config and write your modbus data to Serial. On Laptop, these devices show up as USB COM port.

cleverca22
Posts: 6051
Joined: Sat Aug 18, 2012 2:33 pm

Re: Raspberry Pi 4 Model B don't recocnise a usb male-male cable.

Thu Jun 23, 2022 6:12 am

the usb-c port of the pi4 can act as a usb device, just follow any of the usb gadget tutorials for a pi-zero

but you may have trouble supplying enough power to keep the pi4 happy

User avatar
thagrol
Posts: 7443
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: Raspberry Pi 4 Model B don't recocnise a usb male-male cable.

Thu Jun 23, 2022 12:22 pm

USB A Male to A Male cables are not a standard cable type within the USB spec.

USB is a one host many devices system and does not directly support host to host or multiple hosts.

What were you expecting to happen? What type of USB device did you expect to appear on the Pi and the PC?

There are many ways to make the Pi to laptop connection, but without knowing more about the software running on both devices and what they expect it's almost impossible to suggest a solution. Odds are that there is no plug'n'play solution anyway.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 6862
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.

Re: Raspberry Pi 4 Model B don't recocnise a usb male-male cable.

Thu Jun 23, 2022 12:43 pm

thagrol wrote:
Thu Jun 23, 2022 12:22 pm
USB A Male to A Male cables are not a standard cable type within the USB spec.

...
I would argue that before OTG "happened" (USB 2 onwards?) they were but it was "understood" that the computer's USB sockets were host only and any connected device was a slave (ie. not another computer). IIRC OTG started with mobile 'phone use. Way back then one used a "laplink" cable (with included internal electronics) to link two computers (laptops) together like this one:
http://www.cpmspectrepi.uk/raspberry_pi ... Cable.html
I doubt such are available now - that one's ~10 years old!

Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B, B+, and a A+) but Buster on the P3B+, P4B's & P400. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
thagrol
Posts: 7443
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: Raspberry Pi 4 Model B don't recocnise a usb male-male cable.

Thu Jun 23, 2022 1:07 pm

FTrevorGowen wrote:
Thu Jun 23, 2022 12:43 pm
thagrol wrote:
Thu Jun 23, 2022 12:22 pm
USB A Male to A Male cables are not a standard cable type within the USB spec.

...
I would argue that before OTG "happened" (USB 2 onwards?) they were but it was "understood" that the computer's USB sockets were host only and any connected device was a slave (ie. not another computer). IIRC OTG started with mobile 'phone use. Way back then one used a "laplink" cable (with included internal electronics) to link two computers (laptops) together like this one:
http://www.cpmspectrepi.uk/raspberry_pi ... Cable.html
I doubt such are available now - that one's ~10 years old!

Trev.
IIRC, OTG came in with the mini-B connector. Became popular with the micro-B when cell phone standardised on that and started supporting it.

As for those laplink cables, those are active devices containg hardware that present as a device to both hosts and does its thing to transfer data between them. I've got one around here somewhere that came with my old Samsung Q1.

I, and I assume the OP (yeah, I know), was referring to the passive A male to A male cables that were common with cheap USB2 2.5" drive enclosures and the like or the male to male cables you see with PCIe riser cards.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 6862
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.

Re: Raspberry Pi 4 Model B don't recocnise a usb male-male cable.

Thu Jun 23, 2022 3:20 pm

thagrol wrote:
Thu Jun 23, 2022 1:07 pm
...
I, and I assume the OP (yeah, I know), was referring to the passive A male to A male cables that were common with cheap USB2 2.5" drive enclosures and the like or the male to male cables you see with PCIe riser cards.
I'm guessing my USB2 drive enclosure(s) was (were) "not so cheap" - the cable supplied was the Y type USB A-to-A with one arm of the Y being power only (requiring two USB ports at the computer end). I've re-tested one recently with an SSD in the enclosure rather than a HDD - second sample here:
file:///home/trevor/MoinMoinExport/SolidStateDrives70.html#integral_V_Series_120GB

Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B, B+, and a A+) but Buster on the P3B+, P4B's & P400. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
thagrol
Posts: 7443
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: Raspberry Pi 4 Model B don't recocnise a usb male-male cable.

Thu Jun 23, 2022 3:29 pm

FTrevorGowen wrote:
Thu Jun 23, 2022 3:20 pm
thagrol wrote:
Thu Jun 23, 2022 1:07 pm
...
I, and I assume the OP (yeah, I know), was referring to the passive A male to A male cables that were common with cheap USB2 2.5" drive enclosures and the like or the male to male cables you see with PCIe riser cards.
I'm guessing my USB2 drive enclosure(s) was (were) "not so cheap" - the cable supplied was the Y type USB A-to-A with one arm of the Y being power only (requiring two USB ports at the computer end). I've re-tested one recently with an SSD in the enclosure rather than a HDD - second sample here:
file:///home/trevor/MoinMoinExport/SolidStateDrives70.html#integral_V_Series_120GB

Trev.
Your file is missing :)

Yeah, I have some of those too. Two USB A plugs on one end (one data & power, one just power) one plug on the other though type varies. I've cables with A male, mini-B male, or micro-B male on that end. And, IIRC, those violate the spec too. They're a hack for devices that need >500mA but if the USB host does current limiting per spec (100mA only until the device sks for more) available current will top out at 600mA.

Fortunately, most USB host don't seem to apply that particular limit and will happily supply upto their limit from the get go.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 6862
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.

Re: Raspberry Pi 4 Model B don't recocnise a usb male-male cable.

Thu Jun 23, 2022 3:55 pm

thagrol wrote:
Thu Jun 23, 2022 3:29 pm
FTrevorGowen wrote:
Thu Jun 23, 2022 3:20 pm
thagrol wrote:
Thu Jun 23, 2022 1:07 pm
...
I, and I assume the OP (yeah, I know), was referring to the passive A male to A male cables that were common with cheap USB2 2.5" drive enclosures and the like or the male to male cables you see with PCIe riser cards.
I'm guessing my USB2 drive enclosure(s) was (were) "not so cheap" - the cable supplied was the Y type USB A-to-A with one arm of the Y being power only (requiring two USB ports at the computer end). I've re-tested one recently with an SSD in the enclosure rather than a HDD - second sample here:
file:///home/trevor/MoinMoinExport/SolidStateDrives70.html#integral_V_Series_120GB

Trev.
Your file is missing :)

Yeah, I have some of those too. Two USB A plugs on one end (one data & power, one just power) one plug on the other though type varies. I've cables with A male, mini-B male, or micro-B male on that end. And, IIRC, those violate the spec too. They're a hack for devices that need >500mA but if the USB host does current limiting per spec (100mA only until the device sks for more) available current will top out at 600mA.

Fortunately, most USB host don't seem to apply that particular limit and will happily supply upto their limit from the get go.
:oops: only the local version of my exported webpages has that updated info. so here's the pictures:
P1130509rrcs.jpeg
P1130509rrcs.jpeg (49.23 KiB) Viewed 113 times
P1130510rcs.jpeg
P1130510rcs.jpeg (46.58 KiB) Viewed 113 times
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B, B+, and a A+) but Buster on the P3B+, P4B's & P400. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

Return to “Automation, sensing and robotics”