IO Config Matrix API Failure

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

cross mob
lock attach
Attachments are accessible only for community members.
GiSa_4520796
Level 4
Level 4
First like received

Hi,

I am transferring data from P-Port of FX3 to S0-Port of FX3 and then to SD Card.For that i am using the below attached firmware.Initially,the device is enumerating as Bootloader device but after programming with below firmware endpoints are not detecting.IO Matrix API is failing what is wrong in IO Configuration Matrix?Can anyone please help me.

when i am adding this to check API success,the device is reseting after programming.

status = CyU3PDeviceConfigureIOMatrix (&io_cfg);

    if (status != CY_U3P_SUCCESS)

    {  

            CyU3PDeviceReset(CyFalse);

             goto handle_fatal_error;

    }

13.PNG

When i am checking this API after debugging

STATUS.PNG

Regards,

Srujana.

0 Likes
1 Solution

Hi,

Is the below Configuration correct in terms of GPIO Pins?

    io_cfg.s0Mode = CY_U3P_SPORT_4BIT;

    io_cfg.s1Mode = CY_U3P_SPORT_INACTIVE;

    io_cfg.useUart   = CyTrue;

    io_cfg.useI2C    = CyFalse;

    io_cfg.useI2S    = CyFalse;

    io_cfg.useSpi    = CyFalse;

#if (CY_FX_SLFIFO_GPIF_16_32BIT_CONF_SELECT == 0)

    io_cfg.isDQ32Bit = CyFalse;

    io_cfg.lppMode   = CY_U3P_IO_MATRIX_LPP_DEFAULT;

#else

    io_cfg.isDQ32Bit = CyTrue;

    io_cfg.lppMode   = CY_U3P_IO_MATRIX_LPP_DEFAULT;

#endif

    /* No GPIOs are enabled. */

    io_cfg.gpioSimpleEn[0]  = 0;

    io_cfg.gpioSimpleEn[1]  = 0x00000000; //for spi

    io_cfg.gpioComplexEn[0] = 0;

    io_cfg.gpioComplexEn[1] = 0;

    status = CyU3PDeviceConfigureIOMatrix (&io_cfg);

    if (status != CY_U3P_SUCCESS)

    {

        CyU3PDeviceReset(CyFalse);

        goto handle_fatal_error;

    }

Regards,

Srujana.

View solution in original post

0 Likes
13 Replies
KandlaguntaR_36
Moderator
Moderator
Moderator
25 solutions authored 10 solutions authored 5 solutions authored

Srujana,

It looks like this thread is duplicate of EndPoints are not Enumerating

Please do the following modifications:

As per the above IOMatrix configuration, you are not supposed to use GPIO 53 to 56 pins as GPIOs.

These pins are mapped to UART block when we set LPP MODE to CY_U3P_IO_MATRIX_LPP_UART_ONLY.

I can see that you are using GPIO 53 to 56 for SPI (as per comment). Hence, the IOMatrix is failing.

Since you are not using Storage port #1, you can enabled SPI and UART (I2S too if needed) and set the LPP MODE to CY_U3P_IO_MATRIX_LPP_DEFAULT.

With the following settings, the UART and SPI block are mapped to UART - Pins 49:46 and SPI  - Pins 56:53.

    io_cfg.isDQ32Bit        = CyFalse;

    io_cfg.s0Mode           = CY_U3P_SPORT_8BIT;

    /* If the UART is used for logging, we can only configure the S1 port as 4 bits wide. */

    io_cfg.s1Mode           = CY_U3P_SPORT_INACTIVE; //CY_U3P_SPORT_4BIT;

    io_cfg.lppMode          = CY_U3P_IO_MATRIX_LPP_DEFAULT;//CY_U3P_IO_MATRIX_LPP_UART_ONLY;

    io_cfg.useUart          = CyTrue;

    io_cfg.gpioSimpleEn[0]  = 0;

    io_cfg.gpioSimpleEn[1]  = 0x00000000;

    io_cfg.gpioComplexEn[0] = 0;

    io_cfg.gpioComplexEn[1] = 0;

    io_cfg.useI2C           = CyTrue;

    io_cfg.useI2S           = CyFalse;

    io_cfg.useSpi           = CyTrue;

    status = CyU3PDeviceConfigureIOMatrix (&io_cfg);

    if (status != CY_U3P_SUCCESS)

    {

    CyU3PDeviceReset(CyFalse);

        goto handle_fatal_error;

    }

0 Likes

Hi,

I made the changes as u said but i am still getting the same issue.

io_cfg.s0Mode = CY_U3P_SPORT_8BIT;

    io_cfg.s1Mode = CY_U3P_SPORT_INACTIVE;

    io_cfg.useUart   = CyTrue;

    io_cfg.useI2C    = CyTrue;

    io_cfg.useI2S    = CyFalse;

    io_cfg.useSpi    = CyTrue;

#if (CY_FX_SLFIFO_GPIF_16_32BIT_CONF_SELECT == 0)

    io_cfg.isDQ32Bit = CyFalse;

    io_cfg.lppMode   = CY_U3P_IO_MATRIX_LPP_DEFAULT;

#else

    io_cfg.isDQ32Bit = CyTrue;

    io_cfg.lppMode   = CY_U3P_IO_MATRIX_LPP_DEFAULT;

#endif

    /* No GPIOs are enabled. */

    io_cfg.gpioSimpleEn[0]  = 0;

    io_cfg.gpioSimpleEn[1]  = 0x00000000; //for spi

    io_cfg.gpioComplexEn[0] = 0;

    io_cfg.gpioComplexEn[1] = 0;

    status = CyU3PDeviceConfigureIOMatrix (&io_cfg);

    if (status != CY_U3P_SUCCESS)

    {

        CyU3PDeviceReset(CyFalse);

        goto handle_fatal_error;

    }

Regards,

Srujana.

0 Likes

Srujana,

Is the device coming up as Bootloader after loading the slavefifosync firmware?

Regards,

Sridhar

0 Likes

Hi,

Before the device is coming up as Bootloader after loading the slavefifosync firmware.

Now after making the above changes,it is not coming as Bootloader after loading the slavefifosync firmware.

After Programming:

Capture.PNG

Regards,

Srujana.

0 Likes

Hello Sruna,

It means the IOMatrix API returning sucess and there are some other errors coming up later in your code.

Earlier you have configured GPIO for SPI and in latest code you have configured to use SPI hardware block.

Please check whether you are still configuring the GPIO 53 to 56 in your code.

If you have feasibility for UART prints, you can findout where it is failing. Otherwise, you can use JTAG debugging and findout the same.

Regards,

Sridhar

0 Likes

Hi,

Is the below Configuration correct in terms of GPIO Pins?

    io_cfg.s0Mode = CY_U3P_SPORT_4BIT;

    io_cfg.s1Mode = CY_U3P_SPORT_INACTIVE;

    io_cfg.useUart   = CyTrue;

    io_cfg.useI2C    = CyFalse;

    io_cfg.useI2S    = CyFalse;

    io_cfg.useSpi    = CyFalse;

#if (CY_FX_SLFIFO_GPIF_16_32BIT_CONF_SELECT == 0)

    io_cfg.isDQ32Bit = CyFalse;

    io_cfg.lppMode   = CY_U3P_IO_MATRIX_LPP_DEFAULT;

#else

    io_cfg.isDQ32Bit = CyTrue;

    io_cfg.lppMode   = CY_U3P_IO_MATRIX_LPP_DEFAULT;

#endif

    /* No GPIOs are enabled. */

    io_cfg.gpioSimpleEn[0]  = 0;

    io_cfg.gpioSimpleEn[1]  = 0x00000000; //for spi

    io_cfg.gpioComplexEn[0] = 0;

    io_cfg.gpioComplexEn[1] = 0;

    status = CyU3PDeviceConfigureIOMatrix (&io_cfg);

    if (status != CY_U3P_SUCCESS)

    {

        CyU3PDeviceReset(CyFalse);

        goto handle_fatal_error;

    }

Regards,

Srujana.

0 Likes

Srujana,

It is correct.

Note that the UART block is mapped to Pins 49:46.

Since you are using FX3S, you do not need CY_FX_SLFIFO_GPIF_16_32BIT_CONF_SELECT macro in your code. You can delete this macro and use only GPIF 16 code.

Regards,

Sridhar

0 Likes

Hi,

Apologize me for asking minor doubts.

As i posted screenshot in above replies, i am getting IO Matrix Status as

STATUS.PNG

what do you mean by GPIF 16 code?

Regards,

Srujana

0 Likes

Hello Srujana,

Please do one more STEP IN and get the status variable value. You will come to know whether it is entering the If condition.

GPIF 16 code means,

In the slave fifo, there is a macro CY_FX_SLFIFO_GPIF_16_32BIT_CONF_SELECT. This is needed if you are using FX3.

In case of FX3S, you have only 16-bit GPIF. Hence, you don't need this macro in your code.

Since there is no requirement of the macro, you can remove it from the code to avoid the confusion.

For example:

    io_cfg.s0Mode = CY_U3P_SPORT_4BIT;

    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.isDQ32Bit = CyFalse;

    io_cfg.lppMode   = CY_U3P_IO_MATRIX_LPP_DEFAULT;

    /* No GPIOs are enabled. */

    io_cfg.gpioSimpleEn[0]  = 0;

    io_cfg.gpioSimpleEn[1]  = 0x00000000; //for spi

    io_cfg.gpioComplexEn[0] = 0;

    io_cfg.gpioComplexEn[1] = 0;

    status = CyU3PDeviceConfigureIOMatrix (&io_cfg);

    if (status != CY_U3P_SUCCESS)

    {

        CyU3PDeviceReset(CyFalse);

        goto handle_fatal_error;

    }

0 Likes

Hi,

Thank you for giving clear explanation.

Please do one more STEP IN and get the status variable value. You will come to know whether it is entering the If condition.

     Yes,I did and it is entering the If condition

15.PNG

Please tell me which part of firmware may be the issue for not enumerating endpoints?

Regards,

Srujana

0 Likes

Srujana,

Please do JTAG debugging further to know what else is failing.

You may refer this thread

FX3 JTAG SEGGER

Regards,

Sridhar

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

Hi,

I did JTAG Debugging also and i am not able to find which part of the firmware is going wrong.

Can you please check the below firmware at your end and let me know where the issue is?

Regards,

Srujana

0 Likes

Hi Srujana,

I can see there are two threads in your application.

It looks like it entering into CyFxAppErrorHandler during run time.

You can quickly confirm this by placing CyU3PDeviceReset(CyFalse) in CyFxAppErrorHandler funtion.

Once it is confirmed, you need to find out where the application entering into CyFxAppErrorHandler.

You can also use JTAG debugging to find where it is entering to CyFxAppErrorHandler

Regards,

Sridhar

0 Likes