Hi All
I'm using the USB Stack provided by Freescale at AN3564.
I want to send a Class-specific comand to my HCS08JM60 Evaluation Board. This command is "Host to Device", I pretend to ACK the SETUP stage, and when I receive the Data from Host, I would like to analyze the data, and depending on the value received, I can accept the data or reject them. I pretend to STALL the EP0 if the data are not valid, but I don't know how to do it!!
This is the code I'm using:
void USB_CtrlTrf_RxData(void){
...
...
if(data not valid){
Bdtmap.ep0Bo.Cnt = EP0_BUFF_SIZE;
Bdtmap.ep0Bo.Addr = 0x0C;
EPCTL0_EPSTALL = 1;
Bdtmap.ep0Bo.Stat._byte = _SIE|_BDTSTALL;
Bdtmap.ep0Bi.Stat._byte = _SIE|_BDTSTALL;
}
I'm using a hardware USB sniffer, and I can see that both the DATA and STATUS Transfers are Ackowledged, so it seems that this is not working (I can see also that the data sent is not valid, so I expected the EP0 to STALL). I supposed that the DATA stage would be Acknowledged, but I expected the STATUS stage ("In" Transaction with no data) to be Stalled, and I don't see that. Could it be possible that, due to the time to process data, when I set the stall bit, the Status Stage has already finished? If so, how could I avoid that? Can I pause after data stage?
Thanks in advance!
David