cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

New Contributor II

One of the first things I do in my program (after calling CyU3PDeviceInit() and CyU3PDeviceCacheControl()) is call CyU3PDeviceConfigureIOMatrix().

I'm passing it a struct with the following contents:

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;

io_cfg->gpioSimpleEn[0]  =

(1 << GPIO_IS_PS) |

(1 << GPIO_READY) |

(1 << GPIO_SEND_INTERRUPT) |

(1 << GPIO_ADDRESS_0) |

(1 << GPIO_ADDRESS_1);

io_cfg->gpioSimpleEn[1] =

(1 << (GPIO_BOARD_VERSION_0 - 32)) |

(1 << (GPIO_BOARD_VERSION_1 - 32)) |

(1 << (GPIO_BOARD_VERSION_2 - 32));

io_cfg->gpioComplexEn[0] = 0;

io_cfg->gpioComplexEn[1] = 0;

The constants are defined as follows:

GPIO_IS_PS 25

GPIO_READY 26

GPIO_SEND_INTERRUPT 27

GPIO_ADDRESS_0 8

GPIO_ADDRESS_1 9

GPIO_BOARD_VERSION_0 33

GPIO_BOARD_VERSION_1 34

GPIO_BOARD_VERSION_2 35

It returns an error "CY_U3P_ERROR_BAD_ARGUMENT". From my experimentation, I've found that it returns no error when GPIO_ADDRESS_0 and GPIO_ADDRESS_1 are not included, but I don't understand why they're causing a problem. I know my GPIF state machine is configured to use those pins for the address, but at this point in the program, I haven't done anything with GPIF yet, so I don't see why that would conflict. I've reproduced this on both the board I'm trying to test and the superspeed explorer board.

If anyone can tell me what I've done wrong or how I might go about debugging this further, I'd appreciate it. Thank you, and have a Happy Halloween!

PS, here's some context that may or may not be helpful:

The reason I'm trying to read these pins is because one of my coworkers modified the board I'm using and I'm seeing some unexpected behavior, so I'm checking his work. Specifically, he meant to connected some pins on the other microcontroller to pins 8 and 9 on the FX3. With an 8 bit data bus using GPIF, I understand pins 8 and 9 will be used to communicate the address, and I have flag A configured to indicate that the current thread is ready. The unexpected behavior is that I'm not seeing a change on flag A when I select the address corresponding to the endpoint to which I've sent data, and I would expect to see it change to indicate that there's data available to read. I've verified that whether GPIF is configured for the flag to be default high or low, I see the correct default value from the other microcontroller, so that connection looks fine. My current hypothesis is that there's something wrong with the connection to the address pins that's preventing me from changing the selected address.

0 Likes
Reply
1 Solution
Moderator
Moderator

Hello,

In the default configuration, GPIO[8] and GPIO[9] are configured as a part of GPIF. Refer to Table 7 in FX3 Datasheet.

Only the I/O mentioned as GPIO in Table 7 of datasheet and under respective configuration can be configured  as simple/complex GPIO using the CyU3PDeviceConfigureIOMatrix().

If GPIF in FX3 is used, GPIO[8] and GPIO[9] is already configured and the functionality is defined by the GPIF II designer and the .h file generates by it. 

If you are not using the GPIF interface of FX3 or the respective pins are not used by the GPIF designer, you can configure it as GPIO using the CyU3PDeviceGpioOverride() API.

For an example: Please refer to the GpioApp project in the FX3 firmware project (in FX3 SDK) where GPIO[55] is configured as a GPIO.

Thanks,

Yatheesh

View solution in original post

0 Likes
Reply
2 Replies
Moderator
Moderator

Hello,

In the default configuration, GPIO[8] and GPIO[9] are configured as a part of GPIF. Refer to Table 7 in FX3 Datasheet.

Only the I/O mentioned as GPIO in Table 7 of datasheet and under respective configuration can be configured  as simple/complex GPIO using the CyU3PDeviceConfigureIOMatrix().

If GPIF in FX3 is used, GPIO[8] and GPIO[9] is already configured and the functionality is defined by the GPIF II designer and the .h file generates by it. 

If you are not using the GPIF interface of FX3 or the respective pins are not used by the GPIF designer, you can configure it as GPIO using the CyU3PDeviceGpioOverride() API.

For an example: Please refer to the GpioApp project in the FX3 firmware project (in FX3 SDK) where GPIO[55] is configured as a GPIO.

Thanks,

Yatheesh

View solution in original post

0 Likes
Reply
New Contributor II

Ok, I didn't realize that the pins were configured that way even before I called any of the GPIF functions. Thanks for your help!

0 Likes
Reply