[CX3] How to change GPIF bus width dynamically?

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

cross mob
user_4186771
Level 1
Level 1

Hi, I'm trying to GPIF bus width according to the resolutions. (for example, 24-bit for high resolutions and 16-bit for low resolutions)

Currently, both 24-bit and 16-bit only running works fine, but can't change it at runtime.

I tried many ways with 'CyU3PGpifDisable()' and 'CyU3PMipicsiGpifLoad()' but I kept getting error code 'CY_U3P_ERROR_BAD_ARGUMENT' from 'CyU3PMipicsiGpifLoad()' function.

I want to know necessary steps or APIs to reconfigure GPIF bus width at runtime. Please, help me.

Thanks.

0 Likes
1 Solution

Hello,

Can you please let me know what is the buffer size you are using or passing to the CyU3PMipicsiGpifLoad()?

The CyU3PMipicsiGpifLoad() API takes the first parameter as busWidth and the second parameter is the bufferSize being used for the DMA channel.

The CY_U3P_ERROR_BAD_ARGUMENT comes up based on the bufferSize parameter stated above.
For 16-bit busWidth, the bufferSize should be divisible by 2 and if this is not satisfied, the BAD_ARGUMENT error is thrown.

For 24-bit busWidth, the bufferSize should be divisible by 3 and if not, the BAD_ARGUMENT error is thrown.

You can try passing the default generated by the CX3 config utility as the second parameter when changing the bus width:

#define CX3_UVC_DATA_BUF_SIZE                   (0x8FD0) 


Regards,
Yashwant

View solution in original post

0 Likes
4 Replies
YashwantK_46
Moderator
Moderator
Moderator
100 solutions authored 50 solutions authored 50 likes received

Hello,

Can you please let me know why you want to change the bus width at runtime?
Can you please elaborate on your application and requirement?

Also, can you please let me know the pixel depth you are using ?

Regards,

Yashwant

0 Likes
user_4186771
Level 1
Level 1

Dear Yashwant,

- I want to use 24-bit output only with FHD, 2K, 4K resolutions.

- It is a webcam application and expected MJPEG 60fps at FHD.

- It supports MJPEG(8) and YUV(16) preview on 16-bit GPIF bus.

Thanks for the reply.

0 Likes

Hello,

Can you please let me know what is the buffer size you are using or passing to the CyU3PMipicsiGpifLoad()?

The CyU3PMipicsiGpifLoad() API takes the first parameter as busWidth and the second parameter is the bufferSize being used for the DMA channel.

The CY_U3P_ERROR_BAD_ARGUMENT comes up based on the bufferSize parameter stated above.
For 16-bit busWidth, the bufferSize should be divisible by 2 and if this is not satisfied, the BAD_ARGUMENT error is thrown.

For 24-bit busWidth, the bufferSize should be divisible by 3 and if not, the BAD_ARGUMENT error is thrown.

You can try passing the default generated by the CX3 config utility as the second parameter when changing the bus width:

#define CX3_UVC_DATA_BUF_SIZE                   (0x8FD0) 


Regards,
Yashwant

0 Likes
user_4186771
Level 1
Level 1

Dear Yashwant,

I can now change the GPIF bus width at runtime.

I setup the buffer size for DMA and CyU3PMipicsiGpifLoad carefully before changing the resolution and it works without any problems.

Thanks for your help.

0 Likes