Sample codes for enCore's OUT endpoint?

Version 1
    Question: Are there any sample codes for enCore's OUT endpoint?



    No. Currently, the enCore's reference designs only use IN endpoint. There're a couple things you need to do.

    1.  You need to add the ep2 info into your ep descriptor table and specify that ep2 is an OUT ep.

    2.  You need to add code to handle ep2 ISR. Below are some suggestions for EP2_ISR's error checking: EP2_ISR:

    push A

    push X

    iord Ep2_Count ; error checking

    and A, DATA_VALID ; Is the data valid?

    jz endpoint2_ISR_done ; do something about it. In this example, just simply 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 endpoint2_ISR_done

    iord Ep2Count

    and A,BYTE_COUNT ; make sure data byte count is <= 10 bytes

    cmp A,0Bh

    jnc endpoint2_ISR_done

    iord Ep2_Count

    and A, DATA_TOGGLE ; Did the host send the same DataToggle?

    xor A, [ep2_data_toggle]

    jz .good_data_toggle ;If not, continue

    mov A, ACK_OUT ; If bad data toggle, re-arm the ep (or set a flag to process the event in the main loop)

    iowr Ep2_Mode

    jmp endpoint2_ISR_done .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 count < ep length, toggle data_toggle bit

    xor [ep2_data_toggle], A ;... ;... endpoint2_ISR_done:

    pop X

    pop A

    reti ; return with interrupts enabled