And I found the following description about the SET_ADDRESS request in the pico-sdk.
Code: Select all
From pico-sdk, dev_lowlevel.c
/**
* @brief Handles a SET_ADDR request from the host. The actual setting of the device address in
* hardware is done in ep0_in_handler. This is because we have to acknowledge the request first
* as a device with address zero.
*
* @param pkt, the setup packet from the host.
*/
void usb_set_device_address(volatile struct usb_setup_packet *pkt) {
It looks I could choose set of USB_SET_ADDRESS_ACK_SW and USB_LATE_SET_ADDRESS.
But I have trouble on the IN transfer after the SET_ADDRESS request. It would not finished, so set_address callback would not called.