I need codes for FX3S GPIF II port(P port ) to access SD/MMC (S port)devices through the GPIF II port.....i wanted to connect extenal processor to fx3s gpif ii .please help

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

cross mob
Anonymous
Not applicable

i have this code(attached to below doc)...but it is for 16 bit asyn.admux interface..but i need gpif II interface.can anyone help

0 Likes
1 Solution
ManaskantD_51
Employee
Employee
Welcome! 25 solutions authored 10 solutions authored

We do not have any such example. What you can do is merge the gpiftostorage example with the SlaveFIFO example. The data coming from the GPIF-II interface can then be written to the S port.

View solution in original post

0 Likes
19 Replies
ManaskantD_51
Employee
Employee
Welcome! 25 solutions authored 10 solutions authored

We do not have any such example. What you can do is merge the gpiftostorage example with the SlaveFIFO example. The data coming from the GPIF-II interface can then be written to the S port.

0 Likes
Anonymous
Not applicable

is it gpiftostorage example  has full code to write and read the data to sdcard through s0 port ??is it sufficient???

0 Likes

GpifToStorage example has Read and Write sample code snippets which you can use or modify a bit based on your requirements.

Anonymous
Not applicable

i need to interface an image sensor to p port of fx3s and storing values from p port to s0 port of the fx3s....i am using gpif 2 interface in the p port attached to this case.and for storing valus to the s0 port i am using cygpiftostorage example (attached to this case).i am confused about outgoing mailbox register and incoming mailbox register ????how they are related to p port and s port in this example??i have gone through cypress fx3 api but still not clarified..please help me regarding this?i wanted to know how these mailbox works with respect to p port and s0 port???CyU3PMboxRead and CyU3PMboxwrite??can i use these register without using p port??can i use only one register to take the values from p port??which register i need to use to get the values from p port??please help me...thank you..

0 Likes

If you are interfacing image sensor using GPIF, then you do not need to use the mailbox registers. Once the buffer is filled  and received by FX3 through GPIF. you can write the whole buffer to the SD card. You can check the mass storage example on how to write the whole buffer to the SD card.

Anonymous
Not applicable

is that two api supports to (Once the buffer is filled  and received by FX3 through GPIF. you can write the whole buffer to the SD card.)

recieve from gpif port???but they are using these two for usb related application???can you help me regarding this???please

0 Likes

No, you cannot use these APIs. Instead you can do the following.

1) Create a MANUAL DMA channel with P-port as producer and S-port as consumer.

2) On the DMA Callback event, call CyU3PSibReadWriteRequest() API to initiate the SD Write transaction

3) Then call DmaCommitBuffer() API

Make sure to initialize the s-port and the SD card in the beginning.

CyU3PSibReadWriteRequestcall

0 Likes
Anonymous
Not applicable

1) Create a MANUAL DMA channel with P-port as producer and S-port as consumer.

>>

i created as follows........

CyFxGpifAppCreateDmaChannels (

        void)

{

    CyU3PDmaChannelConfig_t dmaConfig;

    CyU3PReturnStatus_t status;

    /* Create DMA channels for the read and write data paths. */

    dmaConfig.size           = CYFXSTORAPP_DMA_BUFSIZE;

    dmaConfig.count          = CYFXSTORAPP_DMA_BUFCOUNT;

    dmaConfig.prodSckId      = (CyU3PDmaSocketId_t)(CY_U3P_PIB_SOCKET_0 | CYFXSTORAPP_GPIF_WRSOCK);

    dmaConfig.consSckId      = (CyU3PDmaSocketId_t)(CY_U3P_SIB_SOCKET_0 | CYFXSTORAPP_SIB_WRSOCK);

    dmaConfig.dmaMode        = CY_U3P_DMA_MODE_BYTE;

    dmaConfig.notification   = 0;

    dmaConfig.cb             = 0;

    dmaConfig.prodHeader     = 0;

    dmaConfig.prodFooter     = 0;

    dmaConfig.consHeader     = 0;

    dmaConfig.prodAvailCount = 0;

    status = CyU3PDmaChannelCreate (&fxAppWriteChannel, CY_U3P_DMA_TYPE_AUTO, &dmaConfig);

    if (status != CY_U3P_SUCCESS)

        return status;

}

2) On the DMA Callback event, call CyU3PSibReadWriteRequest() API to initiate the SD Write transaction

>>

i am using this function also....but this containing some mailbox register.....how to modify this???

status = CyU3PSibReadWriteRequest (CyTrue, params[0], params[1], params[2],

                        fxAppMbox.w1, CYFXSTORAPP_SIB_RDSOCK);

3) Then call DmaCommitBuffer() API

>>

i dint get....its not there in the api guide

............................................

Make sure to initialize the s-port and the SD card in the beginning.>>i used these api

CyU3PSibStart ();

CyU3PSibRegisterCbk (CyFxGpifAppSibCallback);

yU3PSibSetIntfParams (params[0], &intfCfg);

..........................................................................

CyU3PSibReadWriteRequestcall>>>>

its not there in the api guide

0 Likes

You have created AUTO Dma Channel. You need to create a MANUAL DMA channel. You need to give the function name to dmaConfig.cb and  dmaConfig.notification as the PROD event. Please refer the example codes.

SiBReadWriteRequest API is used in the mass storage example.

Anonymous
Not applicable

You have created AUTO Dma Channel. You need to create a MANUAL DMA channel.

>got it

dmaConfig.notification as the PROD event>>OK

You need to give the function name to dmaConfig.cb>

WHAT FUNCTION???CALLBACK FUNCTION??WHICH CALL BACK FUNCTION??

if i call callback function ..do i need to set the event after calling??

is it ??your saying??CyFxMscApplnDmaCb()....thank you

0 Likes

You dont need to set any event. You need to register the callback function which will be called once a full buffer is received.

Anonymous
Not applicable

1)I AM USING THIS CALL BACK FUNCTION.....THEY ARE USING EVENTSET IN THE CALLBACK FUNCTION IN MASS STOARGE EXAMPLE???WHY THEY ARE USING???HOW TO TAKE PRODUCER BUFFER TO CONSUMER BUFFER(I NEED TO TAKE PIB PRODUCER BUFFER TO SIB CONSUMER BUFFER)

2)IN GPIFSTORAGE EXAMPLE ALSO THEY ARE USING EVENTSET ....I AM CONFUSED ABOUT EVENTSET AND EVENTGET API.....PLEASE HELP ME

void

CyFxMscApplnDmaCb (

        CyU3PDmaChannel   *handle,

        CyU3PDmaCbType_t   evtype,

        CyU3PDmaCBInput_t *input)

{

    CyU3PDmaBuffer_t dmaBuf = input->buffer_p;

    switch (evtype)

    {

        case CY_U3P_DMA_CB_RECV_CPLT:

            {

                if ((glMscState == CY_FX_MSC_STATE_CBW) || (glMscState == CY_FX_MSC_STATE_WAITING))

                {

                    if ((dmaBuf.count != 31) || (dmaBuf.buffer[0] != 'U') || (dmaBuf.buffer[1] != 'S') ||

                            (dmaBuf.buffer[2] != 'B') || (dmaBuf.buffer[3] != 'C'))

                        glInPhaseError = CyTrue;

                    else

                        glInPhaseError = CyFalse;

                    CyU3PEventSet (&glMscAppEvent, CY_FX_MSC_CBW_EVENT_FLAG, CYU3P_EVENT_OR);

                }

                else

                {

                    CyU3PEventSet (&glMscAppEvent, CY_FX_MSC_DATA_RECV_EVENT_FLAG, CYU3P_EVENT_OR);

                }

            }

            break;

        case CY_U3P_DMA_CB_SEND_CPLT:

            CyU3PEventSet (&glMscAppEvent, CY_FX_MSC_DATASENT_EVENT_FLAG, CYU3P_EVENT_OR);

            break;

        default:

            break;

    }

}

3)HOW TO MODIFY THIS CALL BACK FUNCTION

THANK YOU

0 Likes
Anonymous
Not applicable

I MODIFIED AS FOLLOWS(MANUAL DMA )

CyFxGpifAppCreateDmaChannels (

        void)

{

    CyU3PDmaChannelConfig_t dmaConfig;

    CyU3PReturnStatus_t status;

    /* Create DMA channels for the read and write data paths. */

    dmaConfig.size           = CYFXSTORAPP_DMA_BUFSIZE;

    dmaConfig.count          = CYFXSTORAPP_DMA_BUFCOUNT;

    dmaConfig.prodSckId      = (CyU3PDmaSocketId_t)(CY_U3P_PIB_SOCKET_0 | CYFXSTORAPP_GPIF_WRSOCK);

    dmaConfig.consSckId      = (CyU3PDmaSocketId_t)(CY_U3P_SIB_SOCKET_0 | CYFXSTORAPP_SIB_WRSOCK);

    dmaConfig.dmaMode        = CY_U3P_DMA_MODE_BYTE;

    dmaConfig.notification   = CY_U3P_DMA_CB_RECV_CPLT;

    dmaConfig.cb             = CyFxMscApplnDmaCb;

    dmaConfig.prodHeader     = 0;

    dmaConfig.prodFooter     = 0;

    dmaConfig.consHeader     = 0;

    dmaConfig.prodAvailCount = 0;

    status = CyU3PDmaChannelCreate (&fxAppWriteChannel, CY_U3P_DMA_TYPE_AUTO, &dmaConfig);

    if (status != CY_U3P_SUCCESS)

        return status;

   dmaConfig.prodSckId      = (CyU3PDmaSocketId_t)(CY_U3P_SIB_SOCKET_0 | CYFXSTORAPP_SIB_RDSOCK);

    dmaConfig.consSckId      = (CyU3PDmaSocketId_t)(CY_U3P_PIB_SOCKET_0 | CYFXSTORAPP_GPIF_RDSOCK);

status = CyU3PDmaChannelCreate (&fxAppReadChannel, CY_U3P_DMA_TYPE_AUTO, &dmaConfig);

   if (status != CY_U3P_SUCCESS)

     CyU3PDmaChannelDestroy (&fxAppWriteChannel);

    return status;

}

0 Likes

Use this:

CyFxGpifAppCreateDmaChannels (

        void)

{

    CyU3PDmaChannelConfig_t dmaConfig;

    CyU3PReturnStatus_t status;

    /* Create DMA channels for the read and write data paths. */

    dmaConfig.size           = CYFXSTORAPP_DMA_BUFSIZE;

    dmaConfig.count          = CYFXSTORAPP_DMA_BUFCOUNT;

    dmaConfig.prodSckId      = (CyU3PDmaSocketId_t)(CY_U3P_PIB_SOCKET_0 | CYFXSTORAPP_GPIF_WRSOCK);

    dmaConfig.consSckId      = (CyU3PDmaSocketId_t)(CY_U3P_SIB_SOCKET_0 | CYFXSTORAPP_SIB_WRSOCK);

    dmaConfig.dmaMode        = CY_U3P_DMA_MODE_BYTE;

    dmaConfig.notification   = CY_U3P_DMA_CB_PROD_EVENT;

    dmaConfig.cb             = CyFxMscApplnDmaCb;

    dmaConfig.prodHeader     = 0;

    dmaConfig.prodFooter     = 0;

    dmaConfig.consHeader     = 0;

    dmaConfig.prodAvailCount = 0;

    status = CyU3PDmaChannelCreate (&fxAppWriteChannel, CY_U3P_DMA_TYPE_M, &dmaConfig);

    if (status != CY_U3P_SUCCESS)

        return status;

   dmaConfig.prodSckId      = (CyU3PDmaSocketId_t)(CY_U3P_SIB_SOCKET_0 | CYFXSTORAPP_SIB_RDSOCK);

    dmaConfig.consSckId      = (CyU3PDmaSocketId_t)(CY_U3P_PIB_SOCKET_0 | CYFXSTORAPP_GPIF_RDSOCK);

dmaConfig.notification   = CY_U3P_DMA_CB_RECV_CPLT;

status = CyU3PDmaChannelCreate (&fxAppReadChannel, CY_U3P_DMA_TYPE_MANUAL, &dmaConfig);

   if (status != CY_U3P_SUCCESS)

     CyU3PDmaChannelDestroy (&fxAppWriteChannel);

    return status;

}

void

CyFxMscApplnDmaCb (

CyU3PDmaChannel   *handle,

        CyU3PDmaCbType_t evtype,

        CyU3PDmaCBInput_t *input)

{

    CyU3PDmaBuffer_t dmaBuf = input->buffer_p;

    switch (evtype)

    {

        case CY_U3P_DMA_CB_RECV_CPLT:

{

          CyU3PDmaChannelCommitBuffer(handle, count);

}

break;

        case CY_U3P_DMA_CB_PROD_EVENT:

          SetReadWrite();

          CyU3PDmaChannelCommitBuffer(handle, count);

break;

        default:

break;

    }

}

Anonymous
Not applicable

did you means this >>>> SetReadWrite(); ...if i call this function??will be pib data is storing in the sdcard??what buffer i need to store???means what should i used for params[0], params[1], params[2]

/*Initiates a read/write data request*/

                status = CyU3PSibReadWriteRequest (CyTrue, params[0], params[1], params[2],

                         fxAppMbox.w1, CYFXSTORAPP_SIB_RDSOCK);

......................................................................................................................................................

CyU3PDmaChannelCommitBuffer(handle, count);......>>>

CyU3PReturnStatus_t CyU3PDmaChannelCommitBuffer ( CyU3PDmaChannel   handle, uint16 t count,

uint16 t bufStatus )

Commit a data buffer to be sent to the consumer.

Description

This function is generally used with manual DMA channels, and allows the user to commit a data buffer which is to

be sent out to the consumer. This operation is not valid for channels of type MANUAL_IN.

The count provided is the exact size of the data that is to be sent out of the consumer socket.

this API can be used with AUTO DMA channels in the special case where the consumer socket is suspended. This

allows the user to modify the data content of a partial data buffer, and then commit it for sending out of the device.

...................................................................1)what is that MANUAL_IN

2)this API can be used with AUTO DMA channels in the special case where the consumer socket is suspended>>>what is this???

thank you

0 Likes
Anonymous
Not applicable

how to copy CyU3PDmaBuffer_t dmaBuf = input->buffer_p this to numBlks???i am getting error

startAddr.......>>>>>what is the starting address??

any sd card data is compatible to cypress fx3s ??data sheet??what is the speed to read and write the data to sd card??

thank you

after writing data to sdcard i need to read the data from the sd card through usb??is it posiible??.that is s port to u port??

please guide me

0 Likes
Anonymous
Not applicable

1)i am interfacing image sensor to p port

*i used gpif 2 designer n obtain .c file and included to my ezusb project.

2)loading this as follows using api

status = CyU3PGpifLoad ((CyU3PGpifConfig_t *)&CyFxGpifConfig);

3)how to store sensor values to sd card....i am confused

0 Likes