공부/HW

211105 Cypress EZ USB GPIO 1

강경국 2021. 11. 5. 13:05
반응형

 

 

 

 

 

Cypress EZ USB kit GPIO 설정.

Superspeed explorer kit

 

CyU3PIoMatrixConfig_t io_cfg;

/* Configure the IO matrix for the device. On the FX3 DVK board,
 * the COM port is connected to the IO(53:56). This means that
 * either DQ32 mode should be selected or lppMode should be set
 * to UART_ONLY. Here we are choosing UART_ONLY configuration. */
CyU3PMemSet ((uint8_t *)&io_cfg, 0, sizeof(io_cfg));
io_cfg.isDQ32Bit = CyFalse;
io_cfg.s0Mode = CY_U3P_SPORT_INACTIVE;
io_cfg.s1Mode = CY_U3P_SPORT_INACTIVE;
io_cfg.useUart   = CyTrue;
io_cfg.useI2C    = CyFalse;
io_cfg.useI2S    = CyFalse;
io_cfg.useSpi    = CyFalse;
io_cfg.lppMode   = CY_U3P_IO_MATRIX_LPP_UART_ONLY;

/* GPIO 45 is used as input pin. GPIO 21 is also used but cannot
 * be selected here as it is part of the GPIF IOs (CTL4). Since
 * this IO is not used, it can be overridden to become a GPIO by
 * invoking the CyU3PDeviceGpioOverride call. */
io_cfg.gpioSimpleEn[0]  = 0;
io_cfg.gpioSimpleEn[1]  = 0x00001000; /* GPIO 44 */
//io_cfg.gpioSimpleEn[1]  = 0x00002000; /* GPIO 45 */
//io_cfg.gpioSimpleEn[1]  = 0x00003000; /* GPIO 44 & 45 */
io_cfg.gpioComplexEn[0] = 0;
io_cfg.gpioComplexEn[1] = 0;
status = CyU3PDeviceConfigureIOMatrix (&io_cfg);
if (status != CY_U3P_SUCCESS)
{
    goto handle_fatal_error;
}

 

io_cfg.gpioSimpleEn[0], [1] 으로 Gpio로 사용할 포트 설정.

 

위 레지스터 내용은 io_cfg.gpioSimpleEn[1] 의 하위 부분이다.

 

0x00001000 중 0x1000 => 0b0001/0000/0000/0000 이므로 위 표에서 b44 만 GPIO 로 설정한다.

 

Reference) Technicsl reference manual

 

 

 

 

 

728x90
반응형