??? 01/22/06 16:22 Read: times |
#108042 - ZLP?? Responding to: ???'s previous message |
Tsuneo said:
What sequence did you use to issue the ZLP (Zero-Length Packet)?
Philips C example uses following sequence to send ZLP. Actually, it uses the same 'D12_WriteEndpoint' routine as usual. Is it same as yours? - 'Select Endpoint' + read an optional byte - 'Write buffer' - - 0 (reserved byte) - - 0 (length) - - (no data bytes) - 'Validate buffer' b) ZLP to Control OUT? It is unusual to write to the Control Out buffer, either ZLP or not. Can you get Control IN interrupt without writing to control OUT? c) Status of Control IN What code returns on 'Read last transaction status register' command to Control IN, when interrupt occurs? Hi Tsuneo Here is the sequence for acknowledging both endpoints As you see below ZLP is only for EP-control_in IF_SETUP_PACKET_IS_OK: CALL SELECT_CONTROL_OUT_ENDPOINT CALL SAVE_BUFFER_TO_MEMORY CALL CLEAR_BUFFER CALL IF_REQUEST_IS_VALID JNB STALL_BIT,ACKNOLEDGE_TO_CONTROL_ENDPOINT CALL SEND_STALL RET ACKNOLEDGE_TO_CONTROL_ENDPOINT: CALL ACKNOWLEDGE_SETUP CALL SELECT_CONTROL_IN_ENDPOINT CALL ACKNOWLEDGE_SETUP CALL SEND_ZERO_LENGTH_PACKET RET SAVE_BUFFER_TO_MEMORY: CALL READ_BUFFER_COMMAND CALL USB_DATA_READ CALL USB_DATA_READ ;IGNORING FIRST AND SECOND DATA READED MOV R0,#50H SAVING: CALL USB_DATA_READ MOV @R0,DYTA INC R0 CJNE R0,#58H,SAVING RET SEND_ZERO_LENGTH_PACKET: CALL SELECT_CONTROL_IN_ENDPOINT CALL WRITE_BUFFER MOV DYTA,#0 CALL USB_DATA_WRITE CALL VALIDATE_BUFFER RET READ_BUFFER: MOV ADRES,#0F0H CALL USB_COMMAND RET WRITE_BUFFER: MOV ADRES,#0F0H CALL USB_COMMAND MOV DYTA,#0 CALL USB_DATA_WRITE RET Without ZLP on control in there isn't any control in interrupt!!! 01000001B is data returned from read last transaction status of control_in_ep,DATA1 PID,DATA TRANS/REC SUCCESS Thank you very much Mehdi |