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.
Thanks in advance for your help and experience sharing.
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.
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.
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.
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.
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.