Using GPIOs 17 to 20 on CX3

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
user_1065201
Level 1
Level 1

Hi everyone,

I am trying to bring our first hardware based on CX3 to life and I am bit struggling with GPIOs, namely pins GPIO[17] to GPIO[20]. If I enable these as simple (or complex, it does not matter actually) GPIOs CyU3PIoMatrixConfig_t and call CyU3PDeviceConfigureIOMatrix(), it will fail and fall into fatal error handler.

I have found out that I use CyU3PDeviceGpioOverride() to work around this, but I have not found any mention of this in the documentation, so I am not sure why it is actually needed. I feel that it should not be needed, from my previous experience with FX3, the override was needed only when the pin was shared between software control (using GPIO API) and GPIF state machine control. Normally there was no need to do the override, but since CX3 is way different from FX3, there is probably something I have missed.

If anyone can point me to document that explains this in detail so I can actually try to figure out if it is fine to override it or if it will cause some troubles elsewhere, I would really appreciate it.

Thanks for any help.
Ivo

CyU3PIoMatrixConfig_t

0 Likes
1 Solution

Edited for better clarity:

 

Ivo,

 

You can use CyU3PDeviceGpioOverride API to use any GPIO irrespective of whether it is shared with any other interface or it is free to use as GPIO. This avoids the extra efforts to do bitmapping in IOMatrix configuration.

 

I have reproduced your requirement over the Denebola kit observed as follows:

 

To use GPIO 17,18,19,20 you must use CyU3PDeviceGpioOverride API, other GPIOs can be used by passing to IOMatrix.

By doing this, functionality of MIPI/GPIF II block does not interfere with control of these GPIOs.

Please refer to FX3 TRM section 8.9.4.2 to understand how GPIOs can be enabled. GPIO[17] is can be used but
cannot be enabled in IO Matrix , as it is part of the GPIF II I/Os. If this I/O is not used with the GPIF II interface (as mentioned in CX3 datasheet), it can be overridden to become a GPIO by invoking the CyU3PDeviceGpioOverride call

View solution in original post

8 Replies
KandlaguntaR_36
Moderator
Moderator
Moderator
25 solutions authored 10 solutions authored 5 solutions authored

Ivo,

As you use override the GPIOs associated with GPIF II in FX3, you should do the same in CX3 too.

There is only one difference  between CX3 and FX3 is : CX3 has an additional block, MIPI CSI-2 receiver (converts serial data into and parallel data) and this parallel interface of MIPI CSI-2 receiver is connected to fixed GPIF II. i.e. GPIF II state machine can not be modified by the user.

The data bus of GPIF II can configured in 8/16/24-bit (as per output data selected in the MIPI configuraiton tool).

FX3 has parallel interface (GPIF II), this can be configured in 8/16/24/32-bit and the GPIF II state machine in FX3 can be modified by the user as per their requirements.

Hi srdr,

thank you for response, I appreciate it. However I am not sure why the override is needed. I have started with sample project cycx3_uvc_as0260 as it is closest to what we have, and just modified it a bit to setup the GPIOs to verify our hardware design.

I have no idea where I can actually figure out which pins are being used by GPIF II block as there is no way to configure it by user, as you have mentioned. I have tried to search in the documentation, but so far I have found no mention of this. I would like to confirm/disprove that we can actually use these pins as GPIOs, or if overriding them would disable/deactivate MIPI block.

Could you point me to document that describes how MIPI block works internally and shows limitation for other peripherals (GPIOs) when MIPI block is being used?

Thanks

Ivo

0 Likes
lock attach
Attachments are accessible only for community members.

Ivo,

The GPIF II state machine uses the following GPIOs.

1. GPIO 16 for clock

2. GPIO 28, 29 for LV and FV

3. GPIO 0:15 for 16-bit data bus

4. GPIO 0:15 and GPIO 33:40 for 24-bit data bus

5. CX3 has the following 12 GPIOs: GPIO 17,18,19,20,21,22,23,24,25,26,44,and 45.

    Note that except GPIO 45, other 11 GPIOs are shared between software control (using GPIO API) and GPIF state machine control.

    Therefore, we need to override these 11 GPIOs to use them as GPIOs.

Please refer section 1.2 and 1.9 of the CX3_TRM provided with the SDK in this folder: <Installed Directory>\EZ-USB FX3 SDK\1.3\doc\firmware.

This is also attached here for your quick reference.

0 Likes

Hi srdr,

5. CX3 has the following 12 GPIOs: GPIO 17,18,19,20,21,22,23,24,25,26,44,and 45.

    Note that except GPIO 45, other 11 GPIOs are shared between software control (using GPIO API) and GPIF state machine control.

    Therefore, we need to override these 11 GPIOs to use them as GPIOs.

Are you sure about that? Because we use all 12 GPIOs and just the first 4 (17 to 20) need override to get them working.

Please refer section 1.2 and 1.9 of the CX3_TRM provided with the SDK in this folder: <Installed Directory>\EZ-USB FX3 SDK\1.3\doc\firmware.

Unfortunately I can not find any mention that GPIOs are shared with GPIF II/MIPI block in the document you reference. Am I blind?

EDIT: Fixed typo - GPIO range affected by this is 17 to 20, not 17 to 21 as I have previously wrote.

Thanks

Ivo

0 Likes

Edited for better clarity:

 

Ivo,

 

You can use CyU3PDeviceGpioOverride API to use any GPIO irrespective of whether it is shared with any other interface or it is free to use as GPIO. This avoids the extra efforts to do bitmapping in IOMatrix configuration.

 

I have reproduced your requirement over the Denebola kit observed as follows:

 

To use GPIO 17,18,19,20 you must use CyU3PDeviceGpioOverride API, other GPIOs can be used by passing to IOMatrix.

By doing this, functionality of MIPI/GPIF II block does not interfere with control of these GPIOs.

Please refer to FX3 TRM section 8.9.4.2 to understand how GPIOs can be enabled. GPIO[17] is can be used but
cannot be enabled in IO Matrix , as it is part of the GPIF II I/Os. If this I/O is not used with the GPIF II interface (as mentioned in CX3 datasheet), it can be overridden to become a GPIO by invoking the CyU3PDeviceGpioOverride call

Hi srdr,

alright, so does that mean that the override is needed but there is no drawback of this? I just want to be sure that nothing (MIPI/GPIF II block) will interfere with control of these GPIOs.

Thanks

Ivo

0 Likes

Ivo,

Yes, nothing (MIPI/GPIF II block) will interfere with control of these GPIOs (17,18,19, and 20).

Hi srdr,

great, thanks a lot for your assistance.

Ivo

0 Likes