Author Topic: Can I do this?  (Read 10050 times)

SteveK

  • Member
  • ***
  • Posts: 2
Can I do this?
« on: January 22, 2016, 10:29:21 pm »
I have a USB newbie question for the Forum. I have never worked with USB from the hardware end. I have paged through the Forum and some of the questions were similar to mine but I would like to clarify before I invest a lot of time in challenging the learning curve. I am not an EE and this is more personal challenge/hobby thing so apologies to the Forum if it is out of scope.

For many years I have designed and built PIC-based wired remote controllers for radio receivers capable of computer control (Icom, Uniden, etc.). These ranged from minimal control (volume, channel change, etc.) to remote display and full feature control. The reason, of course, was to eliminate the need for the computer in portable or mobile operations. These were very straightforward and communication through the serial port. I now would like to control a USB only receiver from a PIC as I have done previously with serial. There are several PICS that have USB  capability and my development suite (Proton Basic) offers several USB commands. Is it possible to accomplish communication between the target radio and a PIC acting as host? There is nothing exotic about the commands or data that need to be sent, generally two bytes and a CR for commands and an ASCII string of data for the response.

I have no problem with studying and learning what I need. Right now, I'm just looking to see if this is possible before I dive in only to find the water too deep.

Thanks and regards,

Steve K

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Can I do this?
« Reply #1 on: January 23, 2016, 08:31:03 pm »
Every USB communication is between a host and a device. The host manages communications and power on the bus. Devices respond to communications and events from the host.

The host and device have different hardware interfaces and different programming to support their functions.

On power up or device attachment, the host requests a series of data structures called descriptors that help the host determine what driver to assign to the device. The driver may support a defined USB class or another vendor-defined or generic function. If the host has a matching driver, the host can begin to use the device for its intended purpose.

The USB port on a radio receiver is almost certainly a device port that needs to connect to a host.

Microchip makes PICs that have a host interface, and Microchip provides example code for many USB classes and other popular drivers.

Proton Basic likely supports only device controllers, not hosts so you would likely need to use Microchip's C compiler.

If you want to take a stab at this, the first step is to find out what USB device driver the receiver uses. Attach the device to a Windows PC and look for the device in Device Manager. Possible categories are Ports, USB devices, or the vendor's name. To verify, detach the device and see if the entry disappears.

When you've identified the device, look under Driver and report back what you find.


In addition

SteveK

  • Member
  • ***
  • Posts: 2
Re: Can I do this?
« Reply #2 on: January 24, 2016, 03:20:50 pm »
Thanks, Jan. I will take a look at the Microchip offerings but I think that I will set this one aside for now. I would like to do it but it would take a lot more time to climb the curve than I think I want to devote. I also ran across a reference to a Maxim SPI to USB host chip but I haven't chased it down yet. Thanks again. Your writing style has always been an enjoyable read.

Steve K

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Can I do this?
« Reply #3 on: January 25, 2016, 10:13:15 am »
Yes, it sounds like there would be a learning curve for you to do this. I'm glad to hear you like my writing!