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

USB superspeed peripherals Forum Discussions

BhargavGolla
Level 1
Level 1
25 sign-ins 5 questions asked 10 sign-ins

Can you provide any Queue example code in Fx3 Workspace i tried using existing functions 

CyU3PQueueCreate (): queue creation

CyU3PQueueReceive for receiving inn task 2

CyU3PQueueSend for sending onto queue in task1

But it is working as stack, Last given input is executing first followed by Last in first out manner. Really helpful if providing any example coded for implementing the queue in EZ USB suite work space for Fx3.

 

Thanks and Regards

Bhargav.

 

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

Hi Bhargav,

Please find attached firmware project with queue implemented. It works as per expected, please check the UART debug prints.

Best Regards,
AliAsgar

View solution in original post

0 Likes
3 Replies
AliAsgar
Moderator
Moderator
Moderator
250 solutions authored 750 replies posted 50 likes received

Hi Bhargav,

Please find attached firmware project with queue implemented. It works as per expected, please check the UART debug prints.

Best Regards,
AliAsgar

0 Likes
BhargavGolla
Level 1
Level 1
25 sign-ins 5 questions asked 10 sign-ins

Hi ALiAsgar,

Thanks for the reply, i have some queries regarding the implementation

What is the requirement to use "dataReady" global variable in QueueTestEntry ?

can we use something like this

apiRetStatus = CyU3PQueueReceive(&queue_p, &recvData, CYU3P_WAIT_FOREVER);
if (apiRetStatus == CY_U3P_SUCCESS)
{
CyU3PDebugPrint(4, "First Received data = %x \r\n",recvData);
}

In our implementations we are using multiple threads  and while execution we have some scenarios where we get multiple interrupts which triggers multiple events at same time in order to handle this scenario we want to include queuing which will potentially solve our problem and execute each event in order . keeping a global variable something like that is not suitable option for us.

can you suggest any other way of implementing queue which suitable for the scenario explained ?

It will be really helpful if you suggest us some suitable methods for handling this scenario !!

 

Best regards,

Bhargav

 

0 Likes

Hi Bhargav,

There is no necessity to use dataReady for QueueTestEntry. The implementation you have shown will still work perfectly. I have tested it. This implementation can be used for your application as well.

Best Regards,
AliAsgar

0 Likes