Problems receiving data at ep0 out

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problems receiving data at ep0 out

1,151 Views
sebastians_
Contributor I

Hi,

I have problems receiving data at ep0 out. I'm using the TWR-K21D50M board as usb device.

The CDC-example works fine and i managed it to customize it for my needs.

I have a programm which sends data on ep0 out to the device and i can receive it, but if the data is 0xFFFFFFFF or 0xF5F5F5F5, there is a timeout error and i dont get the data.

I dont know why i can't get this data.

The SIE could have problems to receive many "ones" in the data section.

I hope anyone can help me to manage this problem.

Labels (2)
Tags (2)
0 Kudos
5 Replies

713 Views
sebastians_
Contributor I

Ok, I solved the problem.

There is a problem in the timing for the USB clock. The system clock is used for the USB clock, but the system clock is 50 MHz and USB needs 48 MHz.

So if you change the value of  “PLL0_VDIV” to 24, which is defined in the tower.h file the system clock is 48 MHz and the USB works fine.


Best regards

Sebastian Schraml

0 Kudos

713 Views
CarlosCasillas
NXP Employee
NXP Employee

Hi Sebastian,


Have you ensured that the BDT is correctly aligned to 512 bytes on your modified project? Are you adjusting the Maximum Packet Size of your EP0 OUT buffer?

According with USB Specification, Control Endpoint maximum packet size could be configured up to 64 bytes on Full Speed devices.

In order to do so, it is required to set the macro “CONTROL_MAX_PACKET_SIZE” to the value of 64, and also the variable ext_req_to_host[64] (declared on “usb_framework.c” file); otherwise, the endpoint 0 transactions will be incomplete.

Hope this will be useful for you.

Best regards!

/Carlos

713 Views
sebastians_
Contributor I

Hi Carlos,

Thanks for your answer.

My Maximum Packet Size of EP0 OUT is 8 bytes and I changed it up to 64 bytes to check if this is the problem. I can receive data with a size of 8 bytes, 16 bytes, 32 bytes or 64 bytes and the message arrived correctly. But if the message includes 0xFFFF or something like that, there occurred a timeout error and I don’t know why. 

0 Kudos

713 Views
CarlosCasillas
NXP Employee
NXP Employee

Hi Sebastian,

 

You could try the solution given on the following thread:

https://community.freescale.com/thread/311036

Hope this will be useful for you.

Best regards!

/Carlos

0 Kudos

713 Views
sebastians_
Contributor I

Hi Carlos,

Thanks for the info I have already found these thread by my own. The solution in this thread is for another problem.

I’m not sure if you understand my problem. The communication is alright and I can send and receive messages at EP0 OUT. The only thing is, when the data in the Message, which is send from the PC to the device, includes too many 0xF’s there occur a timeout error. I test the communication on EP1 OUT and there I can send data including many 0xF’s. I think this is a problem of the controller that the SIE cannot work with too many 0xF’s at EP0. 

My problem is that I have to use an existing program, which sends data at EP0 OUT.


Here is a screenshot of the usb transfer:

CATC TimeoutError.JPG.jpg

0 Kudos