USB communication

Started by Lilipop13 12 months ago7 replieslatest reply 12 months ago146 views

Hello everyone,

Due to multiple parameters, I have chosen to use a USB connection between my card and my different peripherals : 

- Card : Renesas Rcar H3 starter kit

- Peripherals : 

1) Radar with CAN transmission

2) USB relay 

3) Serial Leds, motor

* For that I will use a USB HUB with 4 ports, since my card has only one USB port : USB Hub link.

My first question : 

Since I will be working on a linux OS, how will the different accesses be done to the peripherals through the USB Hub ? I have been looking into more details around that but haven't found any.

* To adapt the different communications, I will be using a Serial/USB adapter (easily picked) and a CAN/USB converter. The point is either to get data through the com (from the radar), or send commands (to Leds and motor)

My second question : 

I have found many CAN/USB adapters, with many bad comments on their functionning, I have a few links, but would like if someone could suggest a product they used that fits and guarantees my needs. I need an adapter that makes sure the radar's data is sent and received by the card. Here are the links I found.

Link1 - Link2 - Link3

Thanks in advance for your help and experience sharing.


[ - ]
Reply by KocsonyaJune 8, 2023

I don't know the answer to your second question, but for the first it won't be different. Linux handles the hub internally and you don't have to do anything with it. It pops up as a USB device, with hub class, but you can safely ignore it and talk to your endpoint devices. Under Linux the hub is transparent.

[ - ]
Reply by Lilipop13June 8, 2023


Thanks for the reply. Another matter is disturbing me, I read that unpowered USB hubs might not be able to produce enough power to supply the different elements plugged to it.

Since I am planing to plug :

- USB/CAN adapter

- USB relay

- USB/Serial adapter 

Would that be a problem ? If anyone has the answer I'd be greatful.

[ - ]
Reply by KocsonyaJune 8, 2023

Well, you need to look at the data sheets. 

If your hub is unpowered, then all power is supplied by the USB port on your board. It then has to power the 3 USB peripherals you plan to plug in plus the hub itself. 

You need to check how much the board's USB can supply, and check how much the individual peripherals and the hub consume.

[ - ]
Reply by jimbrosJune 8, 2023

Since your using Linux, may wish to consider using libusb (https://libusb.info/).

It will allow you to access at the PDU level. Also, include a separate reader thread.


[ - ]
Reply by dnjJune 8, 2023

I was thinking about how much it would cost to build a usb <--> CAN adapter. For $15 in parts, board and assembly, it wouldn't be bad when compared with the $234 adapter that I found in Amazon. However, compared to your links, those are more in-the-ballpark for reasonable prices. 
I do want to add a little advice. Do not forget to terminate the ends of the CANBUS with 120 ohm resistors if they are not already in the radar unit and the adapter. Connect the CAN-HI to the CAN-LO at both ends of the network through a 120 ohm resistor.

[ - ]
Reply by VadimBJune 8, 2023

If you insist on using a separate USB-CAN adapter (rather then on-chip CAN controller) I would recommend https://esd.eu/produkte/can-usb-2 or https://www.peak-system.com/PCAN-USB.199.0.html

They both are guaranteed to work with SocketCAN.

[ - ]
Reply by HamiltonJune 8, 2023

I will recommand you IXXAT CAN to USB adapter, it is expensive but works like a charme.