Showing results for 
Search instead for 
Did you mean: 

Knowledge Base Articles

OUT endpoint example code for enCoRe(sitlcag)

Not applicable

OUT endpoint example code for enCoRe(sitlcag)

Question: Do you have any OUT endpoint example code for the enCoRe (CY7C63723/63743) parts?



 Unfortunately, we do not have any sample code for an OUT endpoint. However, it's very straight forward. You may need to modify your Config, Interface, and Endpoint descriptors to tell the host about the new OUT endpoint, and you need to add code for the OUT ISR. Below is an example for an OUT ISR:

push A
push X

iord Ep2_Count                                ; error checking
and A, DATA_VALID                         ; Is the data valid?
jz .set_NAK_OUT_Mode                 ; If not, exit the ISR

iord Ep2_Mode                                ; Note: a NAK does cause an interrupt. Is it a NAK
and A, EP_ACK                                ;interrupt? If yes, we're not ready. Exit
jz .set_NAK_OUT_Mode

iord Ep2Count
and A,BYTE_COUNT                        ; make sure data byte
cmp A,0Bh                                          ; count is <= 10 bytes
jnc .set_NAK_OUT_Mode:

iord Ep2_Count
and A, DATA_TOGGLE                     ; Did the host send
xor A, [ep2_data_toggle]                   ; the same DataToggle?
jnz .set_NAK_OUT_Mode                 ; If yes, don?t toggle DataToggle

mov A, ACK_OUT                                ; If bad data toggle, ignore. You can jump to
iowr Ep2_Mode                                    ; set_NAK_OUT_Mode and have your main routine
jmp endpoint2_ISR_done                  ;re-arm the endpoint.

.good_data_toggle:                              ; ...Done Error checking. If you get here, the data  was received error free.

mov A, DATA_TOGGLE                       ; It's an ACK interrupt and byte
xor [ep2_data_toggle], A                     ; toggle data_toggle bit

;...anything else you need to do in the ISR.

mov A, NAK_OUT
iowr Ep2_Mode

pop X
pop A
reti                                                           ; return with interrupts enabled

Version history
Revision #:
1 of 1
Last update:
‎Dec 19, 2008 12:00 AM
Updated by: