You are here

OUT endpoint example code for enCoRe(sitlcag) | Cypress Semiconductor

Support & Community

OUT endpoint example code for enCoRe(sitlcag)

Last Updated: December 01, 2010

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

Provide feedback on this article

Browse KB By Product

Browse KB by Type