How to update GPIF II state machine logic file for new image sensor(SC130GS)

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.
xixu_4093676
Level 3
Level 3
25 replies posted 10 replies posted 10 questions asked

Hello,

   I'm working on a project on send raw image data from an image sensor(SMARTSENS SC130GS) to the PC by USB3.0.

   I start the project based on the an75779 application-notes(how-implement-image-sensor-interface-using-ez-usb-fx3-usb).

   Now I found that there are some FSYNC timing difference between Aptina MT9M114 and SMARTSENS SC130GS,

   For detail please refer to the attached(SC130GS_Datasheet_V2.3.pdf).

   It seem that we need to modify the fx3_uvc.cyfx.

   Unfortunately, It is not easy to understand the state machine logic.

   Can you please provide us one updated fx3_uvc.cyfx based on an75779?

   Also, we still use the DVP interface with our project .

Thanks,

Martin

0 Likes
1 Solution

Hello Martin,

- The DMA buffer size should be a multiple of 16 bytes. Also, to make use of the BURST transfers on the BULK endpoint and the maximum endpoint size, the size of the buffer has been defined as 16384 (16 [BURST Size] * 1024 [Maximum BULK endpoint size]). For complying to the UVC class, UVC specific headers need to be added to the incoming data. Hence, 12 bytes of buffer space is allotted for the UVC header and 4 bytes of buffer space is allotted for footer to compensate for the header and make the buffer size a multiple of 16 bytes.

- The LD_DATA_COUNT needs to be loaded with a value that sets the count value after which the buffer space will be full. In the UVC case, the effective buffer space is 16368 bytes (12 bytes of header and 4 bytes of footer are filled by the CPU). In case of 8-bit GPIF II interface, number of clock cycles required to fill the buffer space = 16368. In case of 16-bit GPIF II interface, number of clock cycles required to fill the buffer space = 16368/2 = 8184. Also, loading the data counter with this value takes one clock cycle. Hence, the LD_DATA_COUNT is loaded with 16367 for 8-bit transfers and 8183 for 16-bit transfers.

- The value used in the AN75779 has been an optimized value for SuperSpeed operation since it matches with the BURST and the maximum size of the BULK endpoint. But, the buffer size can be modified in the firmware by changing the CyU3PDmaMultiChannelConfig_t structure. Also, the LD_DATA_COUNT value has to be modified accordingly.

Best regards,

Srinath S

View solution in original post

0 Likes
4 Replies
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello Martin,

- Are you facing issues when using the AN75779 application note state machine. If yes, please mention the error/ issue.

- You have mentioned that you are sending raw image data from the image sensor. Does it mean that you are using a vendor interface and a custom host application to view the streamed image?

Best regards,

Srinath S

0 Likes

Hello Srinath,

     The issues is the Dma Callback not been called, when use the new sensor device SC130GS.

     I have fixed it by update timing of SC130GS.

     I have another question about AN75779 about change gpif mode to 16bit

      Got to 3.6.5 Edi t ing GPIF I I Inter face Detai ls say:

       ...

     8. In the state machine canvas, double-click the LD_DATA_COUNT action inside the WAIT_FOR_FRAME_START

         state. Change the counter limit value to 8183.

         Can you explain how to calculate value "8183" for 16bit gpif mode and "16367" for 8bit?

         Now I notice when CyFxUvcAppinDmaCallback been called, dmaBuffer.count equal CY_FX_UVC_BUF_FULL_SIZE(16384-16)

        To improve transmission performance,we want to change  CY_FX_UVC_BUF_FULL_SIZE to another value(E.g 2560), we need to update the gpif config file?

Thanks,

Martin

0 Likes

Hello Martin,

- The DMA buffer size should be a multiple of 16 bytes. Also, to make use of the BURST transfers on the BULK endpoint and the maximum endpoint size, the size of the buffer has been defined as 16384 (16 [BURST Size] * 1024 [Maximum BULK endpoint size]). For complying to the UVC class, UVC specific headers need to be added to the incoming data. Hence, 12 bytes of buffer space is allotted for the UVC header and 4 bytes of buffer space is allotted for footer to compensate for the header and make the buffer size a multiple of 16 bytes.

- The LD_DATA_COUNT needs to be loaded with a value that sets the count value after which the buffer space will be full. In the UVC case, the effective buffer space is 16368 bytes (12 bytes of header and 4 bytes of footer are filled by the CPU). In case of 8-bit GPIF II interface, number of clock cycles required to fill the buffer space = 16368. In case of 16-bit GPIF II interface, number of clock cycles required to fill the buffer space = 16368/2 = 8184. Also, loading the data counter with this value takes one clock cycle. Hence, the LD_DATA_COUNT is loaded with 16367 for 8-bit transfers and 8183 for 16-bit transfers.

- The value used in the AN75779 has been an optimized value for SuperSpeed operation since it matches with the BURST and the maximum size of the BULK endpoint. But, the buffer size can be modified in the firmware by changing the CyU3PDmaMultiChannelConfig_t structure. Also, the LD_DATA_COUNT value has to be modified accordingly.

Best regards,

Srinath S

0 Likes

Hello Srinath,

     I see, Thank you for your information.

Thanks,

Martin

0 Likes