FX2LP Synchronization Issue

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

cross mob
lock attach
Attachments are accessible only for community members.
yazan_ee
Level 1
Level 1
First reply posted 10 sign-ins 5 sign-ins

Hi, I am currently working on EZ-USB FX2LP. The project that I am doing is digital oscilloscope. For which I decided to use FX2LP. I am using FX2_to_extsyncFIFO example, which is configured for bulk transfer. The issue I am facing is that when I connect the sine signal, generated from signal generator, to GPIF of FX2LP. I am using Tiva c launchpad to convert analog signal to digital signal. The tiva c has 12 bit ADC which I configured for timer triggered. In TD_Poll function, I am reading data from GPIF in for loop. If you see the example which is metioned, you get an idea how I am reading the data from GPIF. As you can see the given figures, I got one or two cycle of signal but after that the data lost and it started from middle of some cycle. I tested the program, with 50Hz, 200Hz and 500Hz frequencies. You can see the figures of these frequencies below.

50Hz

yazan_ee_0-1670211392379.png

200Hz

yazan_ee_1-1670211424768.png

500Hz

yazan_ee_2-1670211502825.png

 

And only it is important that how we send request from the host (PC) to get data. I add some functions to the code of control center of FX2LP. I added two timers to the code. One timer is to send request to get data from FX2LP after every 2ms, and second timer is used to plot the data on chart. The timer which is responsible for plotting is the microtimer, which runs very fast. And I don't think this is creating any issue. I am not sure about the First timer, that send request for the data, if it is creating that issue or not. I think this can be the synchronization issue. I have attached both codes, The code that I run on FX2LP and the code which I run on PC and also the code which is burned into the Tiva C microcontroller. Kindly help me out with this issue. If you need anything else kindly tell me.

Thanks

Regards
Yazan

 

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

Hi,

Could you please check the status of the FLAG registers?

Additionally, you may also use a USB logic analyzer and check at which stage data loss due to asynchronization is occurring.

Regards,

Mallika

View solution in original post

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

Hi,

Could you please check the status of the FLAG registers?

Additionally, you may also use a USB logic analyzer and check at which stage data loss due to asynchronization is occurring.

Regards,

Mallika

0 Likes
yazan_ee
Level 1
Level 1
First reply posted 10 sign-ins 5 sign-ins

Hi,

Thanks for the reply.
Can you please tell me how to monitor the FLAG registers? Do I have to use the debugging in Keil? If so, when I load the monitor file, the device doesn't enumerate. I also tried installing the RS232 driver as mentioned in this document "Debugging EZ-USB FX1/FX2LP Firmware Using the Keil Debugger Environment". This is the one way I think of, and the second way that I can think is, using the CyAPI. Means I get the FLAG status using some function in the API in C#. I check the CyAPI.pdf file but no function make sense to me to use for checking FLAG status. If there is one, kindly tell me.

Additionally, can you please refer the document in which FX2LP is configured for isochronous transfer?

Thanks

Regards
Yazan

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

Hi,

Regarding flag registers, kindly refer to section 10.4.4 in the FX2LP TRM 

For Keil debugging, you may refer to the following App Note .

For FX2LP in isochronous transfer, please refer to this .

Regards,

Mallika

0 Likes
Hi,

Thanks for the reply.

I have one more question. Can you kindly tell me how I know at the host
(PC) side that the endpoint buffer is filled and I read data using the
XferData function available in the CyAPI. Means there should be an
acknowledgement that the buffer is filled from the FX2LP which I access
using some function in CyAPI and I check it before using XferData function
to get the data. I think this resolves my synchronization problem.

Thanks

Regards
Yazan
0 Likes
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi Yazan,

I am sorry but we do not have such an acknowledgement feature in our USB driver. 

However, I would like to recommend you to use the asynchronous mode of IO transfers, i.e., beginDataXfer, WaitForXfer,FinishXferData usage for data transfers. This gives more control over the transfer process to the host. You could wait for the appropriate time, and then queue up the next transfer immediately when one buffer is read completely. This should help improve the performance at your host and bring in synchronization.

Best Regards,
AliAsgar

0 Likes