- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thus far I have the following DLL calls working:
CyGetListofDevices
CyGetDeviceInfo
Now I try to do a CyOpen....
Cy7C65211A_deviceNumber = c_uint8()
Cy7C65211A_interfaceNumber = c_uint8()
array_of_type_c_ubyte = (c_ubyte*CY_STRING_DESCRIPTOR_SIZE)
CY_Handle = array_of_type_c_ubyte()
Cy7C65211A_Ret_Code = CY7C65211A_CyOpen(Cy7C65211A_deviceNumber, Cy7C65211A_interfaceNumber, byref(CY_Handle))
I get a successful return as long as the deviceNumber = 0 or 1. It really doesn't matter what the interfaceNumber is as I have put in all kinds of numbers.
The handle returns are 4 bytes long. example of a return would be [104, 61, 122,3]
What is the problem? I have a successful return right?
The problem:
Cy7C65211A_Ret_Code = CY7C65211A_CyClose(CY_Handle)
Returns CY_ERROR_INVALID_PARAMETER
Since there is only 1 parameter I am assuming that the CyOpen wasn't as successful as one might think?
Could use a little help on this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
-Please provide the complete definition of the CY7C65211A_CyOpen() and CY7C65211A_CyClose() functions for us to check how the CyOpen() and CyClose() functions are called internally. The CY_ERROR_INVALID_PARAMETER error could possibly be due to data structure misalignment because the dll will return structures in C which may be different from that expected in Python.
-CY_STRING_DESCRIPTOR_SIZE is defined as 256 in the cyusbserial.h file, I am assuming you have defined the same.
-We have used cdecl calls in our APIs so CDLL should be used for loading the library.
Best Regards,
Sananya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
-Please add a snippet of the CY7C65211A_CyOpen() and CY7C65211A_CyClose functions in your application.
-What is CY_STRING_DESCRIPTOR_SIZE defined as? I would like to check if CY_HANDLE is passed as expected in CyOpen().
Best Regards,
Sananya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The code is already in the original post. Look for CyOpen and CyClose.
CY_STRING_DESCRIPTOR_SIZE is as defined by Cypress. It is a wonderful definition from the API as shown below:
2.7 CY_STRING_DESCRIPTOR_SIZE
Description
String descriptor size
You couldn't figure that out? sheesh.
Tell me please, since your function calls can be done with CDLL and WINDLL, and it seems that you have used both in your DLL, could you tell me which function were compiled which way?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
well?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
-Please provide the complete definition of the CY7C65211A_CyOpen() and CY7C65211A_CyClose() functions for us to check how the CyOpen() and CyClose() functions are called internally. The CY_ERROR_INVALID_PARAMETER error could possibly be due to data structure misalignment because the dll will return structures in C which may be different from that expected in Python.
-CY_STRING_DESCRIPTOR_SIZE is defined as 256 in the cyusbserial.h file, I am assuming you have defined the same.
-We have used cdecl calls in our APIs so CDLL should be used for loading the library.
Best Regards,
Sananya