[ Infineon PSOC 62S4 PIONEER KIT Review]——USB
According to the manual, PSOC 62S4 PIONEER KIT has a USB full-speed device interface; the device can have up to 8 endpoints, one control endpoint, and 7 data endpoints; supports four data transfer protocols: control transfer (Control), interrupt transfer (Interrupt), bulk transfer (Bulk), isochronous transfer (Isochronous); provides a 512-byte SRAM buffer and supports DMA; complies with USB2.0 specifications; supports USB suspend, resume and delete wake-up; supports three logical transmission modes: CUP (non-DMA) mode (mode 1), manual DMA mode (mode 2), automatic DMA mode (mode 3); supports maximum data packet size: 512 bytes (using mode 1 and mode 2), 1023 bytes (using synchronous transmission of mode 3).
Hardware Abstraction Layer (HAL)
- General
1.USB initialization cyhal_usb_dev_init()
- USB configuration cyhal_usb_dev_set_configured()
Among them, the cyhal_usb_dev_t structure is
Among them, the cyhal_syspm_callback_data_t structure is
Among them, (1) cyhal_syspm_callback_state_t enumeration is
(2) cyhal_syspm_callback_mode_t is enumerated as
3.USB connects to the host cyhal_usb_dev_connect()
4.USB registration event callback cyhal_usb_dev_register_event_callback()
Among them, the cyhal_usb_dev_event_t enumeration is
- Endpoint Management
1. Endpoint addition cyhal_usb_dev_endpoint_add()
Among them, the cyhal_usb_dev_ep_type_t enumeration is
Note: ① When the enable parameter is false, it does not matter what the endpoint type is.
②This function cannot be used to configure endpoint 0 (control endpoint)
2. Register endpoint callback cyhal_usb_dev_register_endpoint_callback()
- Endpoint 0 (control endpoint) management
- Get the maximum packet size of endpoint 0 cyhal_usb_dev_ep0_get_max_packet()
- Read the setup package contents cyhal_usb_dev_ep0_setup_read_result()
Peripheral driver library(PDL)
- initialization
- USB initialization Cy_USBFS_Dev_Drv_Init()
Among them, the cy_stc_usbfs_dev_drv_config_t structure is
Among them, (1) cy_en_usbfs_dev_drv_ep_management_mode_t enumeration is
(2) The cy_stc_usbfs_dev_drv_dma_config_t structure is
(3) cy_en_usbfs_dev_ep_access_t is enumerated as
- USB enable Cy_USBFS_Dev_Drv_Enable()
- USB set address Cy_USBFS_Dev_Drv_SetAddress()
- USB sets device address Cy_USBFS_Dev_Drv_SetDeviceAddress()
- Interrupt
- USB interrupt handling Cy_USBFS_Dev_Drv_Interrupt()
Note: This function must be called in the user-defined interrupt service thread.
- Set the USB interrupt level Cy_USBFS_Dev_Drv_SetInterruptsLevel()
- Enable endpoint 0 interrupt Cy_USBFS_Dev_Drv_EnableEp0Interrupt()
- Endpoint 0 settings
- Write to endpoint 0 Cy_USBFS_Dev_Drv_Ep0Write()
- Terminate endpoint 0Cy_USBFS_Dev_Drv_Ep0Stall()
- Read endpoint 0 maximum packet size Cy_USBFS_Dev_Drv_GetEp0MaxPacket()
- Data endpoint
- Add endpoint Cy_USBFS_Dev_Drv_AddEndpoint()
Among them, the cy_stc_usb_dev_ep_config_t structure is
- Get endpoint status Cy_USBFS_Dev_Drv_GetEndpointState()
- Endpoint load data Cy_USBFS_Dev_Drv_LoadInEndpoint()
- Enable output endpoint Cy_USBFS_Dev_Drv_EnableOutEndpoint()
- Read output endpoint data Cy_USBFS_Dev_Drv_ReadOutEndpoint()
- Low power consumption
- USB enters deep sleep Cy_USBFS_Dev_Drv_Suspend()
Note: When the USB enters deep sleep, the data in its input and output buffers will be lost after being woken up.
- USB exits deep sleep Cy_USBFS_Dev_Drv_Resume()