FX3 UART Abnormal Byte Sequence

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

cross mob
MaPo_1297961
Level 1
Level 1
First like given

Hello!

I work on Slave FIFO + UART firmware based on Cypress examples.

I ran into very strange bug - I get CyFxUSBUARTDmaCallback() (which is callback for DMA_MANUAL channel between uart producer socket and usb consumer socket) call every time on device start, but the input->buffer_p.count value is 0.

However, every time those callbacks have the same byte sequence (I inspected only the first byte in the buffer):

B8 9F D5 53 4B 08 F5 C5

Sometimes that callback sequence appear once, sometimes there is endlessloop. UART RX pin could be connected to some device or not - I always get that sequence and there is no valid transfer (I see some level changes on FX3 UART Rx pin, but no CyFxUSBUARTDmaCallback() calls and no data transfer to PC, of course).

Please explain the described situation. May be, I do something wrong.

Many thanks for help.

With regards,

Maksim

0 Likes
1 Solution

Hello Maksim,

I tried implementing the project in this thread Re: Slave FIFO + UART Driver Setup​ on SuperSpeed Explorer Kit. I found that i was getting the DMA Callback at the start. But no data was committed to the host. This is because in the infinite for loop, we check whether the RX is receiving any data in 50ms. If no data is received in RX, then it means that we have a partially filled DMA buffer. In this case, we disable the receiver and Call the API CyU3PDMAChannelSetWrapUp. This API calls the DMA call back function and hence commit the buffer. This part of the code is shown below;

pastedImage_3.png

This is the reason why you get DMA Callbacks at the start.

input->buffer_p.count indicates the byte count of valid data in the buffer. You wont have meaningful data in the buffer unless the external device send some data to the UART RX pin. That is the reason why this parameter stays with value 0.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

View solution in original post

0 Likes
6 Replies
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

Can you please share the example project and UART debug log so that we can understand the problem more clearly.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Hello, Jayakrishna!

I use the project from message here (it has no debug log output, sorry):

Re: Slave FIFO + UART Driver Setup

with small changes - some incoming data analysis was added to CyFxUSBUARTDmaCallback() function, which cannot be a reason of my problem.

Please check the screenshot (no device is connected to UART Rx pin):

pastedImage_6.png

Many thanks!

With regards,

Maksim

0 Likes

Hello Maksim,

Can you please let me know the following things:

1. Are you getting the DMA Callbacks?

2. What is the purpose of using the statement "switch(input->buffer_p.buffer[0] && input->buffer_p.count > 0);"?

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Hello Maksim,

I tried implementing the project in this thread Re: Slave FIFO + UART Driver Setup​ on SuperSpeed Explorer Kit. I found that i was getting the DMA Callback at the start. But no data was committed to the host. This is because in the infinite for loop, we check whether the RX is receiving any data in 50ms. If no data is received in RX, then it means that we have a partially filled DMA buffer. In this case, we disable the receiver and Call the API CyU3PDMAChannelSetWrapUp. This API calls the DMA call back function and hence commit the buffer. This part of the code is shown below;

pastedImage_3.png

This is the reason why you get DMA Callbacks at the start.

input->buffer_p.count indicates the byte count of valid data in the buffer. You wont have meaningful data in the buffer unless the external device send some data to the UART RX pin. That is the reason why this parameter stays with value 0.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Hello, Jayakrishna!

1. Are you getting the DMA Callbacks?

Yes, I do

2. What is the purpose of using the statement "switch(input->buffer_p.buffer[0] && input->buffer_p.count > 0);"?

Never mind, it's a mistake of course, but it is not connected to the topic

Many thanks for the detailed answer.

Now it's clear. The better way to place breakpoint is somewhere under

if (input->buffer_p.count > 0) 

condition, otherwise it's not available to see "real" callbacks, but only empty ones, those you've described.

Thanks again.

With regards,

Maksim

0 Likes

Hello Maksim,

Thank you for the update.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes