- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Attached project shows how to config USBIO to GPIO digital input & output mode in firmware. Project is created based on Creator 4.3 and CY8CKIT-062-WIFI-BT DVK, to run this demo pin USBDP and P13_5 should be shorted by fly wire on DVK first.
In short:
Config USBIO to GPIO digital output, you should:
1) Set USBIO to GPIO mode. Write the USBIO_CR1 register (USBDEV_Regs) to 0x20.
*(uint32 *)CYREG_USBFS0_USBDEV_USBIO_CR1 |= (0x01u << CYFLD_USBFS_USBDEV_IOMODE__OFFSET);
2) Set drive mode of USBIO to Strong output.
Config USBIO to GPIO digital input mode, you should:
1) Set USBIO to GPIO mode. Write the USBIO_CR1 register (USBDEV_Regs) to 0x20.
*(uint32 *)CYREG_USBFS0_USBDEV_USBIO_CR1 |= (0x01u << CYFLD_USBFS_USBDEV_IOMODE__OFFSET);
2) Set GPIO input enable. Write the USBIO_CTL register (USBDEV_LPM_Regs) to 0x09.
*(uint32 *)CYREG_USBFS0_USBLPM_USBIO_CTL |= ((0x01u << CYFLD_USBFS_USBLPM_DM_P__OFFSET) | (0x01u << CYFLD_USBFS_USBLPM_DM_M__OFFSET));
3) Set drive mode of USBIO to Digital HighZ.
Message was edited by: Xiaowei Zhang