Reply
Posts: 3
Registered: ‎02-21-2017

Using CP2103 SDK

Hi All

 

Now I migration CP2130 Demo_Application source code porting to Qt Application.

Of Course, I using the Silab provided dll(SLAB_USB_SPI.dll) and API(SLAB_USB_SPI.h)

But, when I using the this API; "SLAB_USB_SPI.CP213x_GetGuid(ref guid)" 

How Can I type converting guid for Qt ? 

 

Qt also has guid.h type structure like this : 

 

typedef struct _GUID
{
ulong Data1;
ushort Data2;
ushort Data3;
uchar Data4[8];
} GUID, *REFGUID, *LPGUID;

 

But, After Qt GUID create and use it directly to "SLAB_USB_SPI.CP213x_GetGuid(ref guid)" 

It occurred compile error.

 

Please help me.

 

Thank you.

 

Posts: 194
Registered: ‎07-12-2016

Re: Using CP2103 SDK

hi Shnomad,

 

There is no keyword "ref" in QT, and you shoud pass the argument of guid by reference your QT application.

My views are my own and do not necessarily represent the views of Silicon Labs

 

Thanks

Posts: 3
Registered: ‎02-21-2017

Re: Using CP2103 SDK

Hi yucheng

 

Thank you for your reply.

I'll using or ingnore ref keyword and solve it.

But, I have another question.

When I use build & run application with CP2130 Library, SLAB_USB_SPI.lib, always occured this message.

 

The program has unexpectedly finished.

 

I think silab provid the CP2130 Library and Qt has some incompatability.

Because, before We're using CP2110 Library  used at Qt application and works well.

Compare with CP2130 and CP2110 API, CP2130 has addtional keywords like _Out_writes_bytes_opt_ or other things.

 

Thanks

Posts: 194
Registered: ‎07-12-2016

Re: Using CP2103 SDK

hi Shnomad,

 

Can you help to locate which function calling caused the message ?

 

Thanks

Posts: 3
Registered: ‎02-21-2017

Re: Using CP2103 SDK

Hi yucheng

 

At Main funtion I calling the  relative funtion like CP213x_GetNumDevices  or CP213x_IsOpened.

 

For example :

{

 

 CP213x_DEVICE hDevices;

 

 CP213x_IsOpened(hDevice);

 

}

 

compile & building is OK, But, When excute it, occured The program has unexpectedly finished. message.

 

When I calling any CP213x relative function, I met the this error message.

 

Thank you.

Posts: 194
Registered: ‎07-12-2016

Re: Using CP2103 SDK

hi Shnomad,

 

CP213x_IsOpened used to returns the USB device opened state. And the hDevices should be the return value of CP213x_OpenByIndex() or CP213x_OpenByDevicePath().

 

Thanks

 

Posts: 3,153
Registered: ‎02-07-2002

Re: Using CP2103 SDK


shnomad wrote:

 CP213x_DEVICE hDevices;

 

 CP213x_IsOpened(hDevice);

 


hDevices and hDevice are two different things.

Posts: 3,153
Registered: ‎02-07-2002

Re: Using CP2103 SDK


yucheng wrote:

CP213x_IsOpened used to returns the USB device opened state. And the hDevices should be the return value of CP213x_OpenByIndex() or CP213x_OpenByDevicePath().

 


That seems like a weird function. You first need to open a device to get a handle and then you can ask CP213x_IsOpened if this handle was opened?