Hi Scott,You need not to configure the endpoint to respond it differently to a bulk read request, based on EP condition and received data it will automatically issue a STALL, NAK or data, this is a USB2.0 specisfication requirement.When the host is ready to receive bulk data, it issues an IN token(Bulk Read). The function endpoint responds by returning either a data packet or, should it be unable to return data, a NAK or STALL handshake.NAK- indicates that the function is temporarily unable to return data,STALL- indicates that the endpoint is permanently halted and requires USB System Software intervention.ACK- If the host receives a valid data packet, it responds with an ACK handshake.If the host detects an error while receiving data, it returns no handshake packet to the function.
When the host is ready to transmit bulk data(Bulk Write), it first issues an OUT token packet followed by a data packet . If the data is received without error by the function, it will return one of three (or four including NYET, for a device operating at high-speed) handshakes:• ACK indicates that the data packet was received without errors and informs the host that it may send the next packet in the sequence.• NAK indicates that the data was received without error but that the host should resend the data because the function was in a temporary condition preventing it from accepting the data (e.g., buffer full).• If the endpoint was halted, STALL is returned to indicate that the host should not retry the transmission because there is an error condition on the function.If the data packet was received with a CRC or bit stuff error, no handshake is returned.RegardsPrajith
Thanks for your response.
Just so I understand better...
If we assume I'm using AutoIn=0 for an IN ENDPOINT. I'm arming the endpoint from within the firmware by setting the byte count register. In that context, what actions in firmware lead to a STALL vs a NAK?
In other words, when you say "NAK- indicates that the function is temporarily unable to return data" does that mean a NAK response is given when the endpoint is not yet "armed"? And then what programmatic state in the Cypress firmware would cause the device to respond with a STALL packet instead?
Thanks for any more info you can provide!
This notifies the host that something unexpected has happened.
STALL means that something unforeseen went wrong (probably as a result of miscommunication or lack of cooperation between the host and device software). A device sends the STALL handshake to indicate that it does not understand a device request, that something went wrong on the peripheral end, or that the host tried to access a resource that was not there. It is like HALT, but better, because USB provides a way to recover from a stall.