FX2LP: How to realize virtual serial port(AN58764) and GPIF (gpifburst8a.c) at the same time?

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

cross mob
zheng
Level 2
Level 2
25 sign-ins 10 replies posted 10 sign-ins

hi, How to realize the following functions? virtual serial port(AN58764) and GPIF (gpifburst8a.c) at the same time。

Would you give me some suggestions or design information? Thank you.

zheng_0-1628044851996.png

 

0 Likes
1 Solution
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

Hi,

Please provide more information about the GPIF interface in FX2LP. It is possible to implement  virtual COM port device using FX2LP. Kindly check out the following app note: https://www.cypress.com/documentation/application-notes/an58764-implementing-virtual-com-port-using-... 

Regards,

Mallika

View solution in original post

0 Likes
13 Replies
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

Hi,

Please provide more information about the GPIF interface in FX2LP. It is possible to implement  virtual COM port device using FX2LP. Kindly check out the following app note: https://www.cypress.com/documentation/application-notes/an58764-implementing-virtual-com-port-using-... 

Regards,

Mallika

0 Likes
zheng
Level 2
Level 2
25 sign-ins 10 replies posted 10 sign-ins

Thank you for your reply. My hardware is the same as the figure below. My plan is to implement the virtual serial port (AN58764 based) and add the function of  GPIF to communicate with the MCU. How do I modify the source code of the AN58764 ?

zheng_0-1628140523131.png

 

Regards,

Zheng

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

Hi Zheng,

Please refer to this App Note to get started with GPIF. It also included a sample source code.

https://www.cypress.com/documentation/application-notes/an66806-getting-started-ez-usb-fx2lp-gpif 

You can accordingly modify the source code from AN58764 to include GPIF interface.

Regards,

Mallika

0 Likes
zheng
Level 2
Level 2
25 sign-ins 10 replies posted 10 sign-ins

Hi  Mallika,

Thank you for your reply. I have referred to the sample of AN66806, but this sample seems to start working by setting the vendor command from the PC.Is there a way to get the vendor command to work without setting it from the PC? If not, do I have to modify the PC driver (AN58764: usbser.sys) or is there another way?

Regards,

Zheng

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

Hi Zheng,

Yes correct, in AN66808 a host application i.e USB Control Center is used which uses vendor commands to start data transfers. However since you want to enumerate FX2LP as  COM Port device you will be using COM port terminals on the PC. For such applications, SBUF registers are used in FX2LP. These are the serial port transmit/receive buffers. Kindly refer to Chapter 14: Timers/Counter and Serial Interface in the FX2LP TRM: https://www.cypress.com/file/126446/download

From AN66806, you can get a basic understanding on how to use GPIF Designer.

Regards,

Mallika

zheng
Level 2
Level 2
25 sign-ins 10 replies posted 10 sign-ins

Hi Mallika,

Thank you very much. There is no need to modify the PC driver (AN58764: usbser.sys) , and use the SBUF register to replace the vendor command to realize the GPIF function. Is my understanding right? If so, do you have an instance of using SBUF register to implement GPIF function? Or give me some tips, because I still don't understand the article in the link.

Regards,

Zheng

 

 

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

Hi Zheng,

Apologies for miscommunication in my response. SBUF should be used when you intend to use serial ports in the CY3684 DVK i.e connect over UART with an external peripheral. 

As you might be aware, FX2LP has 2 domains- USB and peripheral. USB domain manages USB requests from HOST while the peripheral domain consists of hardware required to interface with external peripherals. Configuration of these two are independent of each other. Thus you can configure USB domain to implement a virtual com port and the peripheral domain for GPIF interface.

The driver installation procedure is explained in AN58764. Once bound to usbuser.sys, you may use serial port application to read/write data. To implement GPIF on peripheral domain, please refer to App Note and Chapter 10 in FX2LP TRM.

For sending data from host to FX2LP while FX2LP is enumerated as a COM Port, you can follow the logic as explained in AN58764. AN58764 uses both the USB domain and serial ports of FX2LP, by stripping out FX2LP UART code (SBUF logic), you can take advantage of the communication channel with the PC to bring in/send out data between FX2LP and host.

Regarding the GPIF interface, you don't need the vendor commands as implemented in AN66808 because you will already have the data in FX2LP endpoint buffers. You simply need to design GPIF firmware and descriptors which will be very similar to what is explained in App Note, i.e. you can use the same logic for TD_Init() and TD_Poll() omitting the switch case for vendor command.

Kindly refer to Chapter 10: GPIF in FX2LP TRM: https://www.cypress.com/file/126446/download

Regards,

Mallika

 

zheng
Level 2
Level 2
25 sign-ins 10 replies posted 10 sign-ins

Hi Mallika,

Thank you for your detailed explanation. In the example of an58764, EP1 and EP8 are used. If their size is modified or changed to the same endpoint as an66808, such as EP2 and EP6, will the PC driver be affected?

Regards,

zheng

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

Hi Zheng,

No the driver used is the default Windows COM port driver. The endpoints are communicated to the host via the descriptors, The driver functionality will not be affected.

Regards,

Mallika

0 Likes
zheng
Level 2
Level 2
25 sign-ins 10 replies posted 10 sign-ins

Hi Mallika,

Thank you very much.

After downloading the firmware to the circuit board, because the Tera term communication is not successful, I hope to determine which part has a problem by confirming whether the variable value inside the program running on the circuit board is consistent with keil's simulation results, and what tools can realize this function?

Regards,

Zheng

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

Hi Zheng,

Please provide details on the issues seen.

Also, provide your firmware if not confidential.

Regards,

Mallika

 

0 Likes
zheng
Level 2
Level 2
25 sign-ins 10 replies posted 10 sign-ins

Hi  Mallika,

Thank you for your reply.

According to your previous reply, I designed the firmware as shown in the figure below. The PC can also be correctly recognized as a com device, but it still cannot communicate normally. I hope to judge the error by monitoring  the variables on the firmware. Would you tell me how to monitor the variables on the firmware?

zheng_1-1630463431720.jpeg

Regards,

Zheng

 

 

0 Likes
zheng
Level 2
Level 2
25 sign-ins 10 replies posted 10 sign-ins

Hi Mallika,

Sorry to bother you again and again. The following part of the gpifinit code enables the GPIF address. If  call the gpifinit function, then can enable the GPIF address. Am I right?

// Configure GPIF Address pins, output initial value,
PORTCCFG = 0xFF; // [7:0] as alt. func. GPIFADR[7:0]
OEC = 0xFF; // and as outputs
PORTECFG |= 0x80; // [8] as alt. func. GPIFADR[8]
OEE |= 0x80; // and as output

 

Regards,

Zheng

 

 

0 Likes