PSoC 5LP communicate with USB device

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
xixu_3705391
Level 1
Level 1
5 likes given First reply posted First question asked

Hi everyone,

I'm in a project that involves controlling a medical device using raspberry pi via USB port. Since the raspberry pi is mainly sending some parameters to the medical device, we are thinking of using a PSoC instead of the PI.

So my doubts is: is it possible to use the PSoC like a computer to transfer data to another usb device? More specifically can PSoC 5 LP do it? (we have a PSoC5LP). 

 PS. I have the C library files to give commands to the medical device from the device's manufacturer. 

Thanks in advance

0 Likes
1 Solution

xixu,

Here is a link to further forum discussions detailing USB host abilities of the PSoC:

USB-Host-support 

It's a little bit confusing.  To summarize:  The PSoCs with USB HW support were designed primarily for USB Client usage. 

Theoretically, all PSoCs with USB HW can support USB host operation.  The PSoC6 (according to the TRM) has additional register support for USB host mode operations.   The other PSoCs do not have this additional register support.

However, even for the PSoC6, the Host mode SW stack development was started but is on indefinite delay.   

Maybe some creative designer ha created a host stack and can share it with the forum.  I have not found any other threads with such host stack code.

I have a particular application where I can use the PSoC as a USB host.  This could be useful to me as well.

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

12 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

xixu,

In a USB system, there is only one "Host" and one or more "Clients".

I'm assuming your PI was configured as a "Host" and the medical device as a "Client".

Theoretically, the PSoC5 could act as a "Host from a HW standpoint".  Sadly, there is no USB "Host" stack designed for the PSoC5.  I'm not aware that anyone has been successful in doing this.  The PSoC5 can be easily used as a "Client".  I've used it in this manner very regularly.

Maybe someone is reading this post to shed better light on this topic.   Maybe someone has created a custom Host stack for specific uses.

Len
"Engineering is an Art. The Art of Compromise."

Thank you Len! It's very helpful that you pointed out that I actaully need an USB host. 

I guess one way to solve the problem is to use an USB host IC as a bridge between PSoC and the medical device. Does this idea make sense?

Thanks! 

0 Likes

xixu,

Do you have an example of a "USB host IC" you were thinking of using?

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

xixu,

Here is a link to further forum discussions detailing USB host abilities of the PSoC:

USB-Host-support 

It's a little bit confusing.  To summarize:  The PSoCs with USB HW support were designed primarily for USB Client usage. 

Theoretically, all PSoCs with USB HW can support USB host operation.  The PSoC6 (according to the TRM) has additional register support for USB host mode operations.   The other PSoCs do not have this additional register support.

However, even for the PSoC6, the Host mode SW stack development was started but is on indefinite delay.   

Maybe some creative designer ha created a host stack and can share it with the forum.  I have not found any other threads with such host stack code.

I have a particular application where I can use the PSoC as a USB host.  This could be useful to me as well.

Len
"Engineering is an Art. The Art of Compromise."

I recently evaluated a couple USB Host ICs to create a PSoC5LP bootload from USB Mass Storage application.  The host IC would read a .cyacd file from the USB Mass Storage device, parse it, and then act as essentially a UART bootloader host for the connected PSoC5LP.

I had a decent time when I evaluated the Bridgetek FT90X parts.  They're basically entire MCUs in terms of feature set, and seem to work pretty well.  Toughest part will probably be actually finding the parts though.

There's also something older like the FTDI VNC2, which is similar in terms of function, but I found the custom IDE and RTOS a bit of a pain to use.  It also had some funnies with the C compiler I that threw me for a loop whereas iirc the FT90X compiler is GCC (or at least decently close).  You can see some of the fun I had porting the cybootloadutils to the VNC2 here.  From my understanding the Bridgetek parts are like a successor to the VNC2 (I believe Bridgetek is a sister-company of FTDI).

Both these options have test kits (if you can manage to find stock) which make it decently easy to get started with them.

Kyle,

In general, it should be assumed that some CPU programming is needed to configure any USB IC as a Host or Client.

In your link for the FT930Q, I found:

Len_CONSULTRON_0-1644246556215.png

On the other hand for the VNC2-48Q1C, I found:

Len_CONSULTRON_1-1644246603181.png

I'm assuming that on the VNC2-48Q1C, that they have an eval board as well as firmware example SW stack code for USB Host operation.

Len
"Engineering is an Art. The Art of Compromise."

Whoops, yes you are right the FT93X parts are not USB hosts, the FT90X parts have the Host capability (updating my post above to correct).

Yes the FT90X and VNC2 both have multiple firmware examples for USB host applications.

Kyle and xixu,

Here is a few links to "Open Source" SW for USB Host stacks:

tinyusb.org 

github - libusbhost 

usb-stack 

www.on-time.com/rtusb-32.htm 

Here's a few links to commercial host stacks:

emusb-host 

weston-embedded.com/micrium-uc-usb-host 

 

In any case, there appears not to be HW drivers for the PSoC-family of ICs.  Some SW would be needed to make this happen.

Len
"Engineering is an Art. The Art of Compromise."

Supposedly a USB Host/OTG Stack for PSoC6 has been "coming soon" for the past 3 years or so.  The hardware support is supposedly there, but it's been radio silent for quite some time  as far as I can find (mid-2020 is the most recent estimate I could find):

https://community.infineon.com/t5/PSoC-6/USB-Host-support/m-p/58778

https://community.infineon.com/t5/PSoC-6/PSoC6-USB-Host-Support/m-p/31291

https://community.infineon.com/t5/PSoC-6/USB-otg/m-p/87458

https://community.infineon.com/t5/PSoC-6/USB-Host-mass-storage-Application/m-p/188077

It's been long enough that I'm beginning to suspect there's an issue in the PSoC6 silicon or something preventing an official release.  I'd be curious if someone has actually gotten it working.  It's a shame too, I've been holding onto a PSoC6 test kit for a while waiting for support to come.  It's the whole reason I've had to look into external host ICs, our original plan was to use a PSoC6 for a new design.

 

Maybe one day...😞

xixu_3705391
Level 1
Level 1
5 likes given First reply posted First question asked

Thank you Len and KyTr for the helpful information! My options now narrowed down quite a lot. So far we would try go for the usb-host IC route. Hopefully PSoC one day supports native usb-host function. 

PS. I'm looking at this chip from maximum integrated

MAX3421E DS (maximintegrated.com)

0 Likes

xixu,

Thanks for including the link to the Maxim part.

On reveal of the datasheet, I must inform you that although the part claims "USB Host", it is only control and status registers for USB host-style communication.   IT DOES NOT PROVIDE AN OUT-OF-THE-BOX USB Host solution.  In this case, you have supply the CPU AND the Host stack.

For that matter, the PSoC6s that have USB resources provide the CPU AND the host registers.  The only thing missing is the host stack.

A a quick checklist for a complete USB host you need the following:

  • CPU.  This is the "smarts" of the USB host.  It is needed to be able to process at a higher-level any of the data coming from the Clients.   It is also used to control the USB host HW and read USB status.  (ISO level 7 - Application)
  • A crystal oscillator with at least 20 ppm accuracy.   This is used as the clocking source as may be needed by the Clients to derive certain timing information on their end.
  • USB HW preferably with host-mode control and status registers.  This is needed to operation ISO communication levels, 
    • Level 1 - Physical - Voltage or current translations.
    • Level 2 - Data Link - Bit translations.  This converts the serial data to parallel data.
    • Level 3 - Network - Packet translations.  This is where EndPoints and other lower-level data interpretation occurs.
  • USB Host stack.  This is needed to implement the higher levels of ISO communication levels 4 - Transport, 5 - Session and 6 - Presentation.     These levels of the stack are usually implemented in the CPU.

I've supplied some links to "free" host stacks.   Many of these stacks list which CPUs that already have 'working' stacks.  (Sadly, I have not seen the PSoC among this list.)    If you choose one of the listed CPUs, you should be able download the appropriate drivers.  

If you choose a CPU not listed, you can take one of the other CPU source code and you would need to modify the drivers to fit the USB control and status register operation.

Len
"Engineering is an Art. The Art of Compromise."

Many thanks Len!!

0 Likes