cancel
Showing results for 
Search instead for 
Did you mean: 

USB Low-Full-High Speed Peripherals

KyTr_1955226
Valued Contributor

Hi all,

I'm working on a project to use a CY7C65211/CY7C65211A as a USB-I2C interface in order to bootload several PSoC5 devices that are all on a single I2C bus.

To this end I picked up the CYUSBS234 kit to try and bear this out, but I've run into a few snags.

The description on the CYUSBS234 page (http://www.cypress.com/documentation/development-kitsboards/cyusbs234-usb-serial-single-channel-deve... ) says it includes:

"Software drivers, Design documents for DVK (Schematics, Gerbers, and BOM), Configuration Utility, DVK User Guide, DVK Quick Start Guide, terminal application Tera Term, Application examples, and .NET framework files."

Of course what I found that this actually meant is that it includes the .NET Framework installer, not actual .NET libraries.  They appear to be unmanaged C++ libraries, which seems a little funny, as it appears the cypress provided config utility is in written in .NET.

The idea was to build a bootloader host application in .NET as I have done with USB HID and UART bootload interfaces in the past.  There are examples from Cypress, written in .NET that I was able to follow to get them going.  The problem is for this USB-Serial API, there are no such examples.

Now, I'm a firmware guy and PC application development isn't my strong suit, so I have no idea how to get this API going in a .NET application.  Getting the bootload host API going in .NET was as simple as following the instructions in chapter 5 of this guide: http://www.cypress.com/file/45376/download

The problem is, now I'm at the step where I have to talk to the USB-Serial bridge in order to write the OpenConnection/CloseConnection/ReadData/WriteData functions.  The USB-Serial API is much larger, more complex, and there isn't a guide like the above link.

Does anyone maybe have some insight they could share into how I can get this working?  It would be greatly appreciated.

Would I maybe be better off just writing a C++ console application so I can just call all this stuff native rather than having to worry about managed vs. unmanaged?

0 Likes
1 Solution
SrinathS_16
Moderator
Moderator

Hello,

The thread is unmarked as 'Assumed Answered'.

Please find the attached project for the implementation of I2C Read/Write in C# using the cyusbserial.dll file and let me know if this method can be used along with the boot-loader host APIs.

Best regards,

Srinath S

View solution in original post

0 Likes
15 Replies
SrinathS_16
Moderator
Moderator

Hello,

I am trying to understand your exact situation. Please correct me if I am wrong.

- You have been using bootloader host application/ bootload host API over either UART/ HID class to communicate with the device.

- Now, you have a USB-Serial device to interact with the PSoC5 over the I2C interface and you ought to use the USB-Serial APIs to interact with the CY7C65211.

- You are using the CY7C65211 I2C in the CDC mode to interact with the PSoC5.

Please note that we have examples for using the VCP library for CDC class device but these are console application examples. Kindly, let me know if you those would suit your application or what issue do you face in using those library APIs.

Best regards,

Srinath S

0 Likes
KyTr_1955226
Valued Contributor

Srinath,

- Yes, I have used the bootload host API for UART (AN68272) and HID (AN73503).  Both of these interfaces have examples written in WinForms (C# .NET) with bootload_utils.dll already built that I made use of to construct a PC Bootloader application for those interfaces.

- Yes, I have a CYUSBS234 kit (w/CY7C65211 onboard currently) as well as several CY7C65211A ICs.  I plan to evaluate both and determine which one I will use on my design.  From what I can tell it's basically a choice between using a Vendor Device driver or a CDC Driver.

- That is the plan, yes.  If I use the CY7C65211A I will be operating it in CDC I2C Mode.  According to the datasheet, the CY7C65211 operates in I2C Mode only with a vendor device driver, The CY7C65211A uses a CDC driver.

Like you said, the VCP API (and the Vendor Device API as well) are for use in C++ applications.  I'm looking for something usable in C# .NET to work alongside the already provided bootloader host library, OR I need to know how to create a .h file for bootloader_utils.dll/.lib so I can use the bootloader utilities in a C++ environment.  A C# .NET version of the VCP/Vendor Device API would be preferred.

Thanks for the help!

0 Likes
KyTr_1955226
Valued Contributor

I noticed this has been marked as "Assumed Answered".  This is not the case.  How do I mark as not answered?

0 Likes
SrinathS_16
Moderator
Moderator

Hello,

The thread is unmarked as 'Assumed Answered'.

Please find the attached project for the implementation of I2C Read/Write in C# using the cyusbserial.dll file and let me know if this method can be used along with the boot-loader host APIs.

Best regards,

Srinath S

View solution in original post

0 Likes
KyTr_1955226
Valued Contributor

srnt,

Thanks for this, I'm having a bit of a time getting it to run though.  The solution is complaining about a missing cyusbserial.vcxproj file on open:

C:\Desktop\cyusbserial\cyusbserial\cyusbserial\cyusbserial.vcxproj : error  : The project file could not be loaded. Could not find a part of the path 'C:\Desktop\cyusbserial\cyusbserial\cyusbserial\cyusbserial.vcxproj'.  C:\Desktop\cyusbserial\cyusbserial\cyusbserial\cyusbserial.vcxproj

It's also complaining about cyusbserial.dll being missing when I try to debug, which is weird since it's located in the debug directory /bin/x86/debug.  The pre-build command line event should be putting it in there too.

0 Likes
SrinathS_16
Moderator
Moderator

Hello,

I am able to build the solution without errors. Please let me know if you have made any modifications to the project.

Also, cyusbserial.vcxproj is not part of the project since this is a C# based application. Kindly, share the screenshot of the Visual Studio showing the errors.

Best regards,
Srinath S

0 Likes
KyTr_1955226
Valued Contributor

Building is not the problem.  I can build the project fine, it's getting it to run that is an issue.

I get this on loading the solution but it does not seem to affect the build:

pastedImage_0.png

I get an exception thrown when attempting to debug that it can't find cyusbserial.dll

pastedImage_1.png

Which is strange considering the dll is right there alongside the executable:

pastedImage_2.png

0 Likes
SrinathS_16
Moderator
Moderator

Hello,

This error can be caused if the DLL file dependencies are not present. For the CYUSBSERIAL.DLL, kindly, check if the below files are present in your PC under the C:\Windows\System32 directory.

SETUPAPI.DLL

USER32.DLL

KERNEL32.DLL

MSVCR90.DLL at C:\windows\winsxs\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.9317_none_08e0939fa840d57b\

Best regards,

Srinath S

0 Likes
KyTr_1955226
Valued Contributor

All DLL files in system34 are present and accounted for.

I'm pretty sure I'd have much larger problems to worry about if system32.dll was missing.

I don't have that specific directory in \winsxs\.  I have these, each one with their own copy of MSVCR90.DLL:

pastedImage_0.png

0 Likes
SrinathS_16
Moderator
Moderator

Hello,

Can you please check if you are able to run the executable from the target directory and let me know if these errors occur or not?

Best regards,

Srinath S

0 Likes
KyTr_1955226
Valued Contributor

Running the exe right from the target build directory just crashes with a generic message:

pastedImage_0.png

Windows Event Log shows dll not found exception despite dll being present in the directory:

pastedImage_1.png

0 Likes
SrinathS_16
Moderator
Moderator

Hello,

Please use ProcMon.exe tool to identify the dependencies of the DLL file. This tool can be downloaded from the below link.

Process Monitor - Windows Sysinternals | Microsoft Docs

Run the above EXE file and then the USB-Serial application. The ProcMon displays the DLL files that were tried to be accessed by the application and will display the ones that it failed finding.

Best regards,

Srinath S

0 Likes
KyTr_1955226
Valued Contributor

It looks like it's looking for MSVCR110D.dll since it looks to be searching every directory in PATH and not finding it.

MSVCR110D denotes debug (Visual C++ v11, VS2012 it looks like?).  Leads me to believe the cyusbserial.dll included with the project was a debug build.  Replacing the included cyusbserial.dll with my local copy from the from the SDK looks to have cleared up the exception.  I'll have to do some testing to see if it's all working but at the very least it's not booting me out with an exception any more.

KyTr_1955226
Valued Contributor

Srinath,

First off I want to thank you for the example project.  Once I finally got it going (had to replace cyusbserial.dll) and figured out how to handle the structs and pointers in C#.

I think the libraries are working okay in my winforms based version, but I'm still having issues getting the I2C bootloader to work properly.  It keeps erroring out with a 0x4019 error code (Bootloader returned an error).

The libraries themselves seem to be working though, and I'll make a different thread regarding the issues with the bootloader itself.  The question I asked here has been resolved.  At some point I may need the VCP to I2C API, but I think I might be able to handle that myself after seeing how it's done with the vendor driver version.

Thanks again,

-Kyle

0 Likes
SrinathS_16
Moderator
Moderator

Hello Kyle,

Thanks for the update!

Best regards,

Srinath S

0 Likes