How to handle CyU3PUartTransmitBytes call where the number of bytes successfully transferred is not the same as the number of bytes to be transferred?

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

cross mob
IzMa_4105896
Level 2
Level 2
10 replies posted 5 replies posted 5 questions asked

I'm using CyU3PUartTransmitBytes function to do register-based transfers on an FX3.  CyU3PUartTransmitBytes is passed a count parameter ("number of bytes to be transferred") and returns "number of bytes that are successfully transferred".  How to handle the situation where the number of bytes successfully transferred is not the same as the number of bytes to be transferred?  Will CyU3PReturnStatus_t != CY_U3P_SUCCESS if not all the data is successfully transferred? 

0 Likes
1 Solution
YashwantK_46
Moderator
Moderator
Moderator
100 solutions authored 50 solutions authored 50 likes received

Hi,

CyU3PUartTransmitBytes() returns "the number of bytes that are successfully transferred" but the status of this API is either 'success' or 'timeout'.

So, if there is some problem and the number of bytes that are transferred successfully doesn't match the number of bytes to be transferred (count), the API will return status = timeout and the return value = number of bytes transferred successfully, which is same as (CyU3PReturnStatus_t != CY_U3P_SUCCESS).

So, in order to handle such a situation, the API has to be called again but with an updated pointer to the data and the count size according to the data that is left to be sent in the previous operation.

Regards,

Yashwant

View solution in original post

0 Likes
1 Reply
YashwantK_46
Moderator
Moderator
Moderator
100 solutions authored 50 solutions authored 50 likes received

Hi,

CyU3PUartTransmitBytes() returns "the number of bytes that are successfully transferred" but the status of this API is either 'success' or 'timeout'.

So, if there is some problem and the number of bytes that are transferred successfully doesn't match the number of bytes to be transferred (count), the API will return status = timeout and the return value = number of bytes transferred successfully, which is same as (CyU3PReturnStatus_t != CY_U3P_SUCCESS).

So, in order to handle such a situation, the API has to be called again but with an updated pointer to the data and the count size according to the data that is left to be sent in the previous operation.

Regards,

Yashwant

0 Likes