I am working with a K60 and using CW 10.2 and PE on a target board with no RTOS. I am trying to get communication over a bulk USB endpoint (Endpoint 1) working with my target board being a device.
Enumeration proceeds with no problem over endpoint 0. I was expecting to receive a token done interrupt for endpoint 1 when an IN or OUT packet is received from the host but I do not get one.
I have modified the PE USB interrupt routine to look for this interrupt. With a USB analyzer I see that the host does send the IN packet to the correct device address and endpoint. Is this not what I should expect? If not, how is an IN or OUT packet supposed to be detected other than with constant polling.
Thanks,
Elizabeth
Solved! Go to Solution.
Yes, You should be getting a Token Done interrupt if a packet was successfully transferred during an out or an in transaction.
You don't have everything correctly configured if your not getting the interrupt.
Some things to look for:
1. Make sure your BDT table is on a 512k boundary in memory. Make sure you have the BDT structure correctly defined.
2. Have you set the correct state of the DATA1/0 toggle flag? It must toggle on transactions sent through that endpoint and must be reset after certain sequences through the control endpoints.
3. Are you receiving/transmitting through the correct odd or even buffer?
4. Make sure you only clear one interrupt flag at a time. Do not use bit structures to modify the interrupt flags. The compiler turns them into a read modify write sequences, this sequence clears more flags than you intend. It can cause missed interrupt conditions.
Are you seeing an ACK during the in or Out transactions with the USB analyzer. If your not seeing an ACK, the registers aren't set up correctly and You won't get the interrupt. You may see an ACK without a token done interrupt if the USB controller thinks the last packet was a retransmit.
I spent almost 6 weeks porting over a USB driver from one of our other products onto the kinetis platform. I spent a great deal of time getting it to generate the Token done interrupts reliably.
Yes, You should be getting a Token Done interrupt if a packet was successfully transferred during an out or an in transaction.
You don't have everything correctly configured if your not getting the interrupt.
Some things to look for:
1. Make sure your BDT table is on a 512k boundary in memory. Make sure you have the BDT structure correctly defined.
2. Have you set the correct state of the DATA1/0 toggle flag? It must toggle on transactions sent through that endpoint and must be reset after certain sequences through the control endpoints.
3. Are you receiving/transmitting through the correct odd or even buffer?
4. Make sure you only clear one interrupt flag at a time. Do not use bit structures to modify the interrupt flags. The compiler turns them into a read modify write sequences, this sequence clears more flags than you intend. It can cause missed interrupt conditions.
Are you seeing an ACK during the in or Out transactions with the USB analyzer. If your not seeing an ACK, the registers aren't set up correctly and You won't get the interrupt. You may see an ACK without a token done interrupt if the USB controller thinks the last packet was a retransmit.
I spent almost 6 weeks porting over a USB driver from one of our other products onto the kinetis platform. I spent a great deal of time getting it to generate the Token done interrupts reliably.
I have gotten it working. It was a missing ACK during the IN transaction. Thank you so much for your help!
Pls give me a sample code for Bulk USB Transfers - No RTOS
Tkanks