Using Python to Interface to CY7C65211A UART with HID DLL

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

cross mob
jocac_4016601
Level 3
Level 3
10 replies posted 10 likes given 5 replies posted

Using Python to Interface to CY7C65211A UART with HID DLL

I need to use Python to program the Cy7C65211A USB Bridge

I will be using UART mode and SPI mode and want to use the HID interface and not the CDC Interface.

In other words: No Virtual Com Port Implementation

Are their any examples of this available?

Do I use this DLL?

C:/Program Files (x86)/Cypress/USB-Serial SDK/library/cyusbserial/x86/cyusbserial.dll

There are sooo many .dll files I need to get this confirmed.

Also, in the API Documentation section 3.2:

3.2 CY_RETURN_STATUS

CY_SUCCESS = 0                       API returned successfully without any errors.

CY_ERROR_ACCESS_DENIED               Access of the API is denied for the application

CY_ERROR_DRIVER_INIT_FAILED          Driver initialisation failed

CY_ERROR_DEVICE_INFO_FETCH_FAILED    Device information fetch failed

CY_ERROR_DRIVER_OPEN_FAILED          Failed to open a device in the library

......

So we know the value if successful but what are the return values for all of the error conditions?

0 Likes
1 Solution

Hi John,

1) CyGetListofDevices returns the number of Devices connected to the vendor driver. In your case its 2 i.e. Vendor 1 and Vendor MFG comes up as two separate devices with 1 interface each, which are bound to the same vendor driver.

About the enums may I know which return values are you referring to?

2) Everything that works on 211 also works on 211A, in addition to certain firmware enhancements in 211A.

You may change the silicon at any point of time since they both have that same functionality.

3) All the 3 data structures mentioned are enums.

     a)  CY_DEVICE_TYPE is an enum which returns the type of the device.

typedef enum _CY_DEVICE_TYPE {

    CY_TYPE_DISABLED = 0,               /*Invalid device type or interface is not CY_CLASS_VENDOR*/

    CY_TYPE_UART,                       /*Interface of device is of type UART*/

    CY_TYPE_SPI,                        /*Interface of device is of type SPI */

    CY_TYPE_I2C,                        /*Interface of device is of type I2C */

    CY_TYPE_JTAG,                       /*Interface of device is of type JTAG*/

    CY_TYPE_MFG                         /*Interface of device is in Manufacturing mode*/

} CY_DEVICE_TYPE;

In case of Vendor mode, the Vendor 1(in device manager)  which is configured as UART returns a device type1(CY_TYPE_UART)  and the vendor MFG returns device type 5. (see Fig 1.)

In case of CDC mode there is only one device type i.e. vendor MFG. that returns device type 5. (see Fig. 2) and the Other interface comes as a serial Adapter and as a COM port.

    b) CY_DEVICE_CLASS is an enum which returns class of a particular device interface.

typedef enum _CY_DEVICE_CLASS{

    CY_CLASS_DISABLED = 0,              /*None or the interface is disabled */

    CY_CLASS_CDC = 0x02,                /*CDC ACM class*/

    CY_CLASS_PHDC = 0x0F,               /*PHDC class */

    CY_CLASS_VENDOR = 0xFF              /*VENDOR specific class*/

} CY_DEVICE_CLASS;

In vendor mode both the device classes are Vendor class. so it returns with 255 (0xFF h)

          c)   CY_DEVICE_SERIAL_BLOCK is an enum which  returns the Serial Block number of a particular device bound to Vendor driver.

typedef enum _CY_DEVICE_SERIAL_BLOCK

{

    SerialBlock_SCB0 = 0,               /*Serial Block Number 0*/

    SerialBlock_SCB1,                   /*Serial Block Number 1*/

    SerialBlock_MFG                     /*Serial Block Manufacturing Interface.*/

} CY_DEVICE_SERIAL_BLOCK;

CY_MAX_DEVICE_INTERFACE

this is the maximum value of configurable interfaces possible.

As in case of CY_DEVICE_TYPE the maximum value that can be returned is 5 i.e. for the Manufacturing mode.

4) the device block is also an enum. It represents the present driver interface instance that is associated with a serial block.

5) Your information is correct. When the device is configured for CDC interface there will be only one vendor interface bounded to the vendor driver  i.e. vendor MFG which returns device type as 5 (from the enum CY_DEVICE_TYPE) and the serial block is 2 (from the enum CY_DEVICE_SERIAL_BLOCK) the other interface comes under the COM port and as a Serial Adapter.( refer Fig 1 and Fig 2)

pastedImage_3.png

                                                          Fig 1.(Vendor protocol)

pastedImage_0.png

                                                  Fig 2.(CDC protocol)

Best Regards

Yatheesh

View solution in original post

0 Likes
11 Replies