cancel
Showing results for 
Search instead for 
Did you mean: 

USB Low-Full-High Speed Peripherals

DoLe_3354741
New Contributor II

Hi,

I've  already completed "2592x1944x1(Y8) or 2 bytes(Y16 to Y)" CMOS sensor(MT9P031, 12 bit gray color) in Super Speed(USB 3.0).

And, I also want to use "2592x1944x1 byte(Y8)" in High speed with FX3.

I tried the following DMA buffer size and "1280x720x1byte in High speed" is working well.   But 2592x1944x1byte is not working.

---------------------------- <ref.: https://community.cypress.com/thread/35193?start=0&tstart=0 >

...

2. Increase the DMA buffer size to 48*1024 bytes and DMA buffer count to 2 while creating the DMA channel using CyU3PDmaMultiChannelCreate API

   a. Change the 0x00, 0xC0, 0x00, 0x00, /* No. of bytes device can rx in single payload = 48 KB */ in probe control structures

   b. Change the GPIF LD_DATA_COUNT and LD_ADDR_COUNT as per Configuring Buffer Sizes in AN75779 UVC Firmware – KBA90744

   c. i.e. LD_DATA_COUNT = LD_ADDR_COUNT = ((48*1024 -12-4)/2) -1 = 24567  ->  I changed this to ((48*1024 -12-4)/1) -1 = 49135

...

------------------------------

  I also tried 64*1024 DMA size but there was a error message like...

------------------------------ Error message on Serial debugging

DMA Channel Creation Failed, Error Code = 64

Error handler...

Error handler...

...

-----------------------------------

How to change DMA buffer size or anything else ?

Thanks a lot!

Don

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator

Hello Don,

In the previous post, I asked to increase the horizontal blanking period and not the vertical blanking period.

>>So, to reduce the rate at which the data is streaming you need to increase the Horizontal blanking period.

If you increase the vertical blanking period the error will not be solved. No data is written during vertical blanking (FV low).

We need to increase the period during which the data is written to the buffer by increasing the horizontal blanking period.

By increasing the horizontal blanking the FV high time will increase.

Can you share the .pcapng file? (USB traces)

Regards,

Rashi

Regards,
Rashi

View solution in original post

27 Replies
Rashi_Vatsa
Moderator
Moderator

Hello Don,

USB 2.0  can support maximum bandwidth of 60 MBps. What is the fps that you are using?

The video bandwidth 2592 X 1944 x 1 x fps <= 60 MBps for streaming.

The changes you did for buffer size seems fine.(48KB)

The maximum buffer size that FX3 architecture supports is 0xFFF0 i.e. 65520 bytes.

By changing the buffer size to 64 KB = 65536, it exceeds the max value supported.

Regards,

Rashi

Regards,
Rashi
DoLe_3354741
New Contributor II

Hi Rashi,

Thanks for your answer.

Then, I want you to check my 64KB settings whether they are correct.

// GPIF II Designer

((64*1024 - 12-4)/1byte)-1 = 65519   -> LD_ADDR_COUNT, LD_DATA_COUNT = 65519

-----------------

// uvc.h

#define CY_FX_EP_BULK_VIDEO_PKTS_COUNT  (0x40) //.-> 64

#define CY_FX_UVC_STREAM_BUF_COUNT      (?)    // Which value?

-----------------

// uvc.c    64 * 1024 = 65536

uint8_t glProbeCtrl20[CY_FX_UVC_MAX_PROBE_SETTING] = {

...

0x00, 0x00, 0x01, 0x00,          /* Max video frame size in bytes */

...

}

Are those correct?   And which value is  CY_FX_UVC_STREAM_BUF_COUNT   ?

Thanks,

Don

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Don,

It seems you have kept the buffer size of 64 KB, which will give the error= 64, as per your previous post. You cannot use buffer size of 64 KB

You have to reduce the DMA buffer size. You can use 48 KB. The maximum buffer size can be 65,520 bytes.

For changing the buffer size you can make changes here

#define CY_FX_EP_BULK_VIDEO_PKT_SIZE    (0x400)        // Packet size  (1024)

#define CY_FX_EP_BULK_VIDEO_PKTS_COUNT  (0x10)     //  Packet count (16)  >> You can increase this value to 48

#define CY_FX_UVC_STREAM_BUF_SIZE       (CY_FX_EP_BULK_VIDEO_PKTS_COUNT * CY_FX_EP_BULK_VIDEO_PKT_SIZE)  /* 16 KB */ >> This gives you the buffer size

#define CY_FX_UVC_STREAM_BUF_COUNT      (4)     >> This will give the buffer count. By default it is set to 4. You can set it as per your requirement. (memory size would be the limitation)

Similarly, you need to make changes to LD_ADDR_COUNT, LD_DATA_COUNT.

Please confirm that this condition is fulfilled  >>The video bandwidth 2592 X 1944 x 1 x fps <= 60 MBps for streaming in High Speed.

Regards,

Rashi

Regards,
Rashi
0 Likes
DoLe_3354741
New Contributor II

  Hi Rashi,

Thanks for your answer.

By the way, I don't know why I cannot use the buffer size of 64KB.   I use CYUSB3014, 512 KB SRAM size.

Anyway, I tried your settings you mentioned( I have already used the buffer size of 48 KB because the next larger size, 64 KB is not working with error message)  .   The result is that Super speed is working but High speed repeatedly shows this error message.

...

DMA Reset Event: Commit buffer failure

Application Stopped

Application Started

DMA Reset Event: Commit buffer failure

...

Please check my source code as follows.

Thanks,

Don

P.S.: As you know, in my source code, sonsor.c is from MT9P031 NOT from Cypress.   By the way, When I set Binning & Skipping registers(MT9P031_ROW_ADDRESS_MODE, MT9P031_COLUMN_ADDRESS_MODE)   by 0x11,   even though the maximum resolution limit is until 1296x972 but it is working on High speed USB.   But when I don't use the Binning & Skipping in the same 1296x972 resolution for test, it's NOT working.  Maybe without binning & skipping, any resolution doesn't work.   I know you are not OnSemi's persion but do you know any reason ?

----------------- uvc.h

/* UVC Video Streaming Endpoint Packet Size */

#define CY_FX_EP_BULK_VIDEO_PKT_SIZE    (0x400)       /* 1024 Bytes */

/* UVC Video Streaming Endpoint Packet Count */

#define CY_FX_EP_BULK_VIDEO_PKTS_COUNT  (0x30)   // This is 48 KB

/* DMA buffer size used for video streaming. */

#define CY_FX_UVC_STREAM_BUF_SIZE       (CY_FX_EP_BULK_VIDEO_PKTS_COUNT * CY_FX_EP_BULK_VIDEO_PKT_SIZE)  /* default: 16 KB */

/* Number of DMA buffers per GPIF DMA thread. */

#define CY_FX_UVC_STREAM_BUF_COUNT      (2)   // -> In my case, more than (2) makes error as follows.   So, I use (2).

DMA Channel Creation Failed, Error Code = 16

                                            Error handler...

Error handler...

Error handler...

...

------------------- GPIF II Designer

LD_ADDR_COUNT, LD_DATA_COUNT =>    ((48*1024 -12-4)/1) -1 = 49135

------------------- uvc.c

uint8_t glProbeCtrl20[CY_FX_UVC_MAX_PROBE_SETTING] = {

...

0x00, 0xC0, 0x00, 0x00,     // 48KB     /* No. of bytes device can rx in single payload = ... */

...

------------------ sensor.c

...

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_ROW_START, MT9P031_ROW_START_DEF); // 0x01

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_COLUMN_START, MT9P031_COLUMN_START_DEF); // 0x02

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_HEIGHT, 1943); // 0x03=1944-1

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_WIDTH, 2591); // 0x04=2592-1

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_HORIZONTAL_BLANK, 0x0000); // 0x05=0

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_VERTICAL_BLANK, 0x0000); // 0x06=0

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_LOWER, 0x0400); // 0x09 INTEG_TIME_REG=1024

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_ROW_ADDRESS_MODE, 0x0000); // 0x22 ROW_MODE, ROW_SKIP=1. ROW_BIN=1

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_COLUMN_ADDRESS_MODE, 0x0000); // 0x23 COL_MODE, COL_SKIP=1. COL_BIN=1

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_READ_MODE_2, 0x0060); // 0x20 READ_MODE_2, COL_SUM

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_UPPER, 0x0000); // 0x08 (1) SHUTTER_WIDTH_HI

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_LOWER, 0x05AF); // 0x09 (1) INTEG_TIME_REG

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_DELAY, 0x0000); // 0x0C (1) SHUTTER_DELAY_REG

...

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Don,

- You can refer to this KBA for the understanding of  buffer count DMA Buffer Count - KBA218339

- The DMA commit buffer failure error may occur if the UVC host application does not issue IN tokens fast enough to clear the DMA buffers.It seems it is due to "high speed" bandwidth limitation. You have not mentioned the frames per second (fps) here. High speed will work better for < 30MBps (It seems 60 MBps is theoretical)

-  Please reduce the frames per second (fps) to match this bandwidth. For 2592 X 1944 X 1 frame size you can try with 5 fps for high speed.

- If reducing the fps doesn't work also try reducing buffer size back to 16 KB.

It will take time to check with the sensor problem you mentioned in the post. Will get back on it.

Please let me know the results after testing both.

Regards,

Rashi

Regards,
Rashi
0 Likes
DoLe_3354741
New Contributor II

Hello Rashi,

Thanks for the help.

1)  I already reduced the fps to just 1 fps as follows...

---------------------- uvc.c

uint8_t glProbeCtrl20[CY_FX_UVC_MAX_PROBE_SETTING] = {

...

0x80, 0x96, 0x98, 0x00, // 1 fps,  /* Desired frame interval in the unit of 100ns: 1 fps */

...

0x00, 0xE3, 0x4C, 0x00, // 2592x1944x1=     5,038,848   /* Max video frame size in bytes */

...

--------------------- cyfxuvcdscr.c

/* Standard High Speed Configuration Descriptor */

const uint8_t CyFxUSBHSConfigDscr[] = {

...

0x00, 0x18, 0x67, 0x02,  // 2592x1944x1x 1x8=    40,310,784   wid x ht x bytes/pixel x fps x 8 bits  /* Min bit rate bits/s. Not specified, taken from MJPEG */

0x00, 0x18, 0x67, 0x02,  // same above                                     /* Max bit rate bits/s. Not specified, taken from MJPEG */

...

0x80, 0x96, 0x98, 0x00, // 10,000,000-> 1 fps   /* Default Frame Interval */

0x01,

0x80, 0x96, 0x98, 0x00,

...

2) I already tested the buffer size back to 16 KB with CY_FX_UVC_STREAM_BUF_COUNT  = (4) or (6).   The result was almost the same that 48 KB.

By the way, I already mentioned in the previous reply, my guess is that... 

  A: whenever I set the binning & skiiping  of MT9P031 CMOS image sensor to 0x00(No binning & skipping), High speed USB2 doesn't work. 

  B: in relation to A, CMOS sensor register settings don't seem to match FX3 in High speed mode.

Do you have any idea ?

I'll do my best.

Thanks,

Don

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Don,

- Let us work for the case where binning and skipping are not enabled or set to 0x00. Please probe the FV, LV, and clock lines and share the traces.

- The changes that you have made in the descriptor and the firmware seems fine.

Regards,

Rashi

Regards,
Rashi
0 Likes
DoLe_3354741
New Contributor II

Hi Rashi,

Thanks for your reply.

Yes, I just checked 1296x972(5 fps, 48K DMA buffer size, Y8) both with skipping & binning(working) and without them(not working).

Please refer to the following register settings and oscilloscope pictures for both mode.

Thanks,

Don

------------ with Skipping & binning (Working)

...

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_ROW_START, MT9P031_ROW_START_DEF); // 0x01 <- 54

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_COLUMN_START, MT9P031_COLUMN_START_DEF); // 0x02 <- 16

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_HEIGHT, 1943); // 0x03

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_WIDTH, 2591); // 0x04

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_HORIZONTAL_BLANK, 0x0000); // 0x05=0

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_VERTICAL_BLANK, 0x0000); // 0x06=0

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_LOWER, 0x0400); // 0x09 INTEG_TIME_REG=1024

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_ROW_ADDRESS_MODE, 0x0011); // 0x22 ROW_MODE, ROW_SKIP=1. ROW_BIN=1

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_COLUMN_ADDRESS_MODE, 0x0011); // 0x23 COL_MODE, COL_SKIP=1. COL_BIN=1

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_READ_MODE_2, 0x0060); // 0x20 READ_MODE_2, COL_SUM

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_UPPER, 0x0000); // 0x08 (1) SHUTTER_WIDTH_HI

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_LOWER, 0x05AF); // 0x09 (1) INTEG_TIME_REG

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_DELAY, 0x0000); // 0x0C (1) SHUTTER_DELAY_REG

...

------------- without Skipping & binning (Not working)

...

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_ROW_START, 485); // 0x01

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_COLUMN_START, 647); // 0x02

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_HEIGHT, 971); // 0x03

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_WIDTH, 1295); // 0x04

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_HORIZONTAL_BLANK, 0x0000); // 0x05=0

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_VERTICAL_BLANK, 0x0000); // 0x06=0

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_UPPER, 0x0000); // 0x09 INTEG_TIME_REG=1024

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_LOWER, 0x01AC); // 0x09 (1) INTEG_TIME_REG

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_DELAY, 0x0000); // 0x0C (1) SHUTTER_DELAY_REG

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_ROW_ADDRESS_MODE, 0x0000); // 0x22 ROW_MODE, ROW_SKIP=0. ROW_BIN=0

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_COLUMN_ADDRESS_MODE, 0x0000); // 0x23 COL_MODE, COL_SKIP=0. COL_BIN=0

...

========= with skipping & binning (Working)

Top: FV

Bottom: LV

With_SkippingBinning.jpg

============= without skipping & binning (Not working)

Without_SkippingBinning.jpg

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Don,

Trace with binning and skipping: As per the settings you made, the fps is set to 5. But from the traces (with binning and skipping) the fps seems to be near to 20 fps (near to the frequency of FV i.e. 23 Hz) which means the sensor settings are not proper.

Please check the sensor settings.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Trace without binning and skipping: From the trace, I cannot see the low and high time. Please send the snapshot which shows this clearly as in the previous trace or calculate the fps. This trace also shows that frequency of FV is doubled to 44 Hz which is contradicting to the setting you have done i.e. 5 fps.

Please calculate the FPS for this trace. As in previous case, if the fps is nearly equivalent to the frequency of FV (44 Hz), it would exceed the bandwidth of USB high speed hence can be a reason of error (not working).

Regards,

Rashi

Regards,
Rashi
0 Likes
DoLe_3354741
New Contributor II

Hello Rashi,

Thanks for your reply.

  Looks like OnSemi's MT9P031 doesn't have any frequency setting and the frequency difference between two pictures is from changing the MT9P031_SHUTTER_WIDTH_LOWER value.    I already changed the value(frequency) but the result was always the same(the setting with skipping&binning is OK and the other setting without skipping&binning is not working).

Thanks,

Don

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Don,

You can tune the parameters to get the desired frames per second (refer attachment). I got this from datasheet of MT9P031 https://www.onsemi.com/pub/Collateral/MT9P031-D.PDF . The datasheet also says that the fps is programmable upto 14 for full resolution. So changing the fps seems possible.

>> I already changed the value(frequency) but the result was always the same(the setting with skipping&binning is OK and the other setting without skipping&binning is not working).

According to my understanding on binning and skipping, if we enable the binning and skipping it would just reduce the resolution. So when you disable it i.e. the resolution remains same(no reduction) and if the fps settings are not proper as we saw in the traces you provided, it exceeds the bandwidth supported by USB high speed.

For example: (from the trace without binning and skipping)

Bandwidth: 1296 X 972 X 1 X 44(fps)  = 55 MBps > 30/35 MBps (practically supported by USB high speed or works better)

So in your case, if you don't want to use binning and skipping (i.e without resolution reduction) either you set the fps low enough to match the bandwidth requirement or you can go for lower resolutions.

Regards,

Rashi

Regards,
Rashi
0 Likes
DoLe_3354741
New Contributor II

Hi Rashi,

According to MT9P031: Developer Guide (Rev. A-2013),   the fps can be tuned as follows.

Thanks,

Don

P.S.: Here, INTEG_TIME_REG = MT9P031_SHUTTER_WIDTH_LOWER.

         Maybe BLANK_REG is related to fps.

        For the following settings, the examples with skipping&binning only work in my USB 2.0 case.

=================================

Frame Rate and Resolution Register Settings

In order to run the MT9P031 in the following resolutions and frame rates, select the

matching presets in Devware or change the registers according to the following tables.

[1080P 30FPS INCREASED VERTICAL BLANKING]

//SETTINGS FOR 1080P WITH 30 FPS. ROLLING SHUTTER ARTIFACT REDUCED BY 12%.

LOAD = Reset

LOAD = 96MHz + Devware Bayer Offset

REG=0, 0x01, 431//ROW WINDOW START

REG=0, 0x02, 335// COL WINDOW START

REG=0, 0x03, 1079// ROW_WINDOW_SIZE_REG

REG=0, 0x04, 1919// COL_WINDOW_SIZE_REG

REG=0, 0x05, 0x0000// HORZ BLANK 0

REG=0, 0x06, 0x0091// VERT_BLANK_REG=145

REG=0, 0x08, 0x0000// SHUTTER_WIDTH_HI

REG=0, 0x09, 0x01AC// INTEG_TIME_REG

REG=0, 0x0C, 0x0000// SHUTTER_DELAY_REG

REG=0, 0x22, 0x0000// ROW_MODE

REG=0, 0x23, 0x0000// COL_MODE

LOAD = Rolling Artifact Optimization

[1080P 30FPS INCREASED FOV BY 12%]

//SETTINGS FOR 1080P WITH SHORTER ROW TIME BUT INCREASED FIELD OF VIEW.

ROLLING SHUTTER ARTIFACT REDUCED BY 6%

LOAD = Reset

LOAD = 96MHz + Devware Bayer Offset

REG=0, 0x01, 401//ROW WINDOW START

REG=0, 0x02, 281// COL WINDOW START

REG=0, 0x03, 1141// ROW_WINDOW_SIZE_REG

REG=0, 0x04, 2029// COL_WINDOW_SIZE_REG

REG=0, 0x05, 0x0000// HORZ BLANK 0

REG=0, 0x06, 0x0000// VERT BLANK 0

REG=0, 0x08, 0x0000// SHUTTER_WIDTH_HI

REG=0, 0x09, 0x01AC// INTEG_TIME_REG

REG=0, 0x0C, 0x0000// SHUTTER_DELAY_REG

REG=0, 0x22, 0x0000// ROW_MODE

REG=0, 0x23, 0x0000// COL_MODE

LOAD = Rolling Artifact Optimization

[1080P 34FPS]

//SETTINGS FOR 1080P WITH SHORTER ROW TIME AND FASTER FRAME RATE

//ROLLING SHUTTER ARTIFACT REDUCED BY 12%.

LOAD = Reset

LOAD = 96MHz + Devware Bayer Offset

REG=0, 0x01, 431//ROW WINDOW START

REG=0, 0x02, 335// COL WINDOW START

REG=0, 0x03, 1079// ROW_WINDOW_SIZE_REG

REG=0, 0x04, 1919// COL_WINDOW_SIZE_REG

REG=0, 0x05, 0x0000// HORZ BLANK 0

REG=0, 0x06, 0x0000// VERT BLANK 0

REG=0, 0x08, 0x0000// SHUTTER_WIDTH_HI

REG=0, 0x09, 0x01AC// INTEG_TIME_REG

REG=0, 0x0C, 0x0000// SHUTTER_DELAY_REG

REG=0, 0x22, 0x0000// ROW_MODE

REG=0, 0x23, 0x0000// COL_MODE

LOAD = Rolling Artifact Optimization

[1080P 30FPS]

//DEFAULT SETTINGS FOR 1080P

LOAD = Reset

LOAD = 96MHz + Devware Bayer Offset

REG=0, 0x01, 431//ROW WINDOW START

REG=0, 0x02, 335// COL WINDOW START

REG=0, 0x03, 1079// ROW_WINDOW_SIZE_REG

REG=0, 0x04, 1919// COL_WINDOW_SIZE_REG

REG=0, 0x05, 0x0000// HORZ BLANK 0

REG=0, 0x06, 0x0000// VERT BLANK 0

REG=0, 0x08, 0x0000// SHUTTER_WIDTH_HI

REG=0, 0x09, 0x01AC// INTEG_TIME_REG

REG=0, 0x0C, 0x0000// SHUTTER_DELAY_REG

REG=0, 0x22, 0x0000// ROW_MODE

REG=0, 0x23, 0x0000// COL_MODE

REG=0, 0x06, 0x0037// VERT_BLANK_REG has been adjusted to give precisely 30fps

REG=0, 0x05, 0x0000// HORZ_BLANK_REG

[720P 30FPS LONG VERTICAL BLANKING]

//RUNS AT HALF THE NORMAL SPEED BUT ROLLING ARTIFACT IS SAME AS DEFAULT 60FPS

LOAD = Reset

LOAD = 96MHz + Devware Bayer Offset

REG=0, 0x01, 0x0040// ROW_WINDOW_START_REG

REG=0, 0x02, 0x0018// COL_WINDOW_START_REG

REG=0, 0x03, 0x059F // ROW_WINDOW_SIZE_REG=1439

REG=0, 0x04, 0x09FF // COL_WINDOW_SIZE_REG=2559

REG=0, 0x05, 0x0000// HORZ BLANK 0

REG=0, 0x06, 0x02D0 // VERT_BLANK_REG=720

REG=0, 0x09, 0x0400 // INTEG_TIME_REG=1024

REG=0, 0x22, 0x0011 // ROW_MODE, ROW_SKIP=1. ROW_BIN=1

REG=0, 0x23, 0x0011 // COL_MODE, COL_SKIP=1, COL_BIN=1

REG=0, 0x20, 0x0060 // READ_MODE_2, COL_SUM

REG=0, 0x08, 0x0000//(1) SHUTTER_WIDTH_HI

REG=0, 0x09, 0x0296//(1) INTEG_TIME_REG

REG=0, 0x0C, 0x0000//(1) SHUTTER_DELAY_REG

LOAD = Subsample Optimization

[720P 30FPS]

//RUNS 30FPS 720P WITH LONGER INTEGRATION TIME AND SETTINGS WHICH ARE ALREADY BEST-CASE SCENARIO FOR ROLLING SHUTTER ARTIFACT

LOAD = Reset

LOAD = 96MHz + Devware Bayer Offset

REG=0, 0x01, 0x0040// ROW_WINDOW_START_REG

REG=0, 0x02, 0x0018// COL_WINDOW_START_REG

REG=0, 0x03, 0x059F // ROW_WINDOW_SIZE_REG=1439

REG=0, 0x04, 0x09FF // COL_WINDOW_SIZE_REG=2559

REG=0, 0x05, 0x0000// HORZ BLANK 0

REG=0, 0x06, 0x0000// VERT BLANK 0

REG=0, 0x09, 0x0400 // INTEG_TIME_REG=1024

REG=0, 0x22, 0x0011 // ROW_MODE, ROW_SKIP=1. ROW_BIN=1

REG=0, 0x23, 0x0011 // COL_MODE, COL_SKIP=1, COL_BIN=1

REG=0, 0x20, 0x0060 // READ_MODE_2, COL_SUM

REG=0, 0x08, 0x0000//(1) SHUTTER_WIDTH_HI

REG=0, 0x09, 0x05AF//(1) INTEG_TIME_REG

REG=0, 0x0C, 0x0000//(1) SHUTTER_DELAY_REG

LOAD = Subsample Optimization

[720P 60FPS]

//RUNS THE DEFAULT 60FPS 720P SETTINGS WHICH ARE ALREADY BEST-CASE SCENARIO FOR ROLLING SHUTTER ARTIFACT

LOAD = Reset

LOAD = 96MHz + Devware Bayer Offset

REG=0, 0x01, 0x0040// ROW_WINDOW_START_REG

REG=0, 0x02, 0x0018// COL_WINDOW_START_REG

REG=0, 0x03, 0x059F // ROW_WINDOW_SIZE_REG=1439

REG=0, 0x04, 0x09FF // COL_WINDOW_SIZE_REG=2559

REG=0, 0x05, 0x0000// HORZ BLANK 0

REG=0, 0x06, 0x0000// VERT BLANK 0

REG=0, 0x09, 0x0400 // INTEG_TIME_REG=1024

REG=0, 0x22, 0x0011 // ROW_MODE, ROW_SKIP=1. ROW_BIN=1

REG=0, 0x23, 0x0011 // COL_MODE, COL_SKIP=1, COL_BIN=1

REG=0, 0x20, 0x0060 // READ_MODE_2, COL_SUM

REG=0, 0x08, 0x0000//(1) SHUTTER_WIDTH_HI

REG=0, 0x09, 0x0296//(1) INTEG_TIME_REG

REG=0, 0x0C, 0x0000//(1) SHUTTER_DELAY_REG

LOAD = Subsample Optimization

[640x480 resolution,bin4x]

REG=0, 0x03, 0x0778//(10) ROW_WINDOW_SIZE_REG

REG=0, 0x04, 0x09F8//(7) COL_WINDOW_SIZE_REG

REG=0, 0x08, 0x0000//(6) SHUTTER_WIDTH_HI

REG=0, 0x09, 0x01AC//(6) INTEG_TIME_REG

REG=0, 0x0C, 0x0000//(6) SHUTTER_DELAY_REG

REG=0, 0x22, 0x0033//(2) ROW_MODE - SKip Bin registers (00->1xbin, 11->2xbin, 33->4xbin)

REG=0, 0x23, 0x0033//(3) COL_MODE - SKip Bin registers (00->1xbin, 11->2xbin, 33->4xbin)

REG=0, 0x08, 0x0000//(1) SHUTTER_WIDTH_HI

REG=0, 0x09, 0x0296//(1) INTEG_TIME_REG

REG=0, 0x0C, 0x0000//(1) SHUTTER_DELAY_REG

LOAD = Subsample Optimization

0 Likes
DoLe_3354741
New Contributor II

Hi Rashi,

I tried another one.   I captured I2C settings from Imaging Source's DMM 72BUC02-ML module which includes MT9P031 and also supports Y8 with 2592x1944 resolution in USB 2.0. (4, 5, 7, 7.5 fps each).

I used the captured register settings exactly in my module but the settings are not working.

Do I have to re-consider DMA buffer size back ?

Thanks,

Don

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Don,

Are you getting the expected fps from the sensor after the settings are done? Can you prove FV and LV lines and confirm?

Once we get expected FPS (which match the bandwidth limitation) , it should work with the buffer size (48KB ). If you are getting the expected fps what is the error you are facing?

Regards,

Rashi

Regards,
Rashi
0 Likes
DoLe_3354741
New Contributor II

Hi Rashi,

I changed the MT9P031_SHUTTER_WIDTH_LOWER value(and 1 or 5 fps) in 1296x972 but there was no different result.

Currently, I set 5 fps, Y8, 2592x1944 with captured register settings from the  ImagingSource module.  

I got the following error message without any streaming.

...

Application Stopped

Application Started

DMA Reset Event: Commit buffer failure

Application Stopped

Application Started

DMA Reset Event: Commit buffer failure

Application Stopped

Application Started

Clear feature request detected...

Application Stopped

Application Started

DMA Reset Event: Commit buffer failure

Application Stopped

Application Started

DMA Reset Event: Commit buffer failure

Application Stopped

Application Started

DMA Reset Event: Commit buffer failure

Application Stopped

Application Started

DMA Reset Event: Commit buffer failure

Application Stopped

Application Started

DMA Reset Event: Commit buffer failure

Application Stopped

Application Started

DMA Reset Event: Commit buffer failure

Application Stopped

Application Started

...

And refer to the Imaging Source's settings that I got.

Thanks,

Don

-----------------------------------

// DMx72BUC02 I2C

//Start

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x07, 0x1F82); // MT9P031_OUTPUT_CONTROL

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_WIDTH, 0x0A1F); // 2592-1

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_LOWER, 0x007D); //  125 or 0x0066. maybe variable

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_UPPER, 0x0000); //    0

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_HEIGHT, 0x0798); // 1944

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_WIDTH, 0x0A20); // 2592

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_HEIGHT, 0x0798); // 1944

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_ROW_ADDRESS_MODE, 0x0000); // 0

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_COLUMN_ADDRESS_MODE, 0x0000); // 0

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_READ_MODE_2, 0x0040); //

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x11, 0x3E03); // MT9P031_PLL_CONFIG_1

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x12, 0x0105); // MT9P031_PLL_CONFIG_2

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x12, 0x0105); // same above

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x07, 0x1F86); // MT9P031_OUTPUT_CONTROL

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x10, MT9P031_PLL_CONTROL_PWRON | MT9P031_PLL_CONTROL_USEPLL); // MT9P031_PLL_CONTROL

// More than 220us waited here

CyU3PThreadSleep (500);

//Repeated again. Why ?

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x07, 0x1F82); // MT9P031_OUTPUT_CONTROL

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_WIDTH, 0x0A1F); // 2592-1

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_LOWER, 0x007D); //  125 or 0x0066. maybe variable

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_UPPER, 0x0000); //    0

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_HEIGHT, 0x0798); // 1944

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_WIDTH, 0x0A20); // 2592

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_HEIGHT, 0x0798); // 1944

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_ROW_ADDRESS_MODE, 0x0000); // 0

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_COLUMN_ADDRESS_MODE, 0x0000); // 0

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_READ_MODE_2, 0x0040); //

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x11, 0x3E03); // MT9P031_PLL_CONFIG_1

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x12, 0x0105); // MT9P031_PLL_CONFIG_2

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x12, 0x0105); // same above

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x07, 0x1F86); // MT9P031_OUTPUT_CONTROL

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x10, MT9P031_PLL_CONTROL_PWRON | MT9P031_PLL_CONTROL_USEPLL); // MT9P031_PLL_CONTROL

// More than 220us waited here

CyU3PThreadSleep (500);

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_READ_MODE_2, 0x0020); //

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_WIDTH, 0x0A20); // 2592

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_HEIGHT, 0x0798); // 1944

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_ROW_ADDRESS_MODE, 0x0000); // 0

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_COLUMN_ADDRESS_MODE, 0x0000); // 0

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_COLUMN_START, MT9P031_COLUMN_START_DEF); // 16

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_ROW_START, MT9P031_ROW_START_DEF); // 54

0 Likes
Rashi_Vatsa
Moderator
Moderator

Don,

Can you probe PCLK, FV and LV lines for these settings and share the traces. From this we will get to know whether the problem is with sensor settings or FX3 side.

Regards,

Rashi

Regards,
Rashi
0 Likes
DoLe_3354741
New Contributor II

Hi Rashi,

Thanks for your reply.

Here is the picture from Oscilloscope.

ImagingSourceModule.JPG

Sorry for no PCLK, because this old oscilloscope just has 2 channels(My new oscilloscope had just been broken a few days ago).   PCLK was about 48 MHz displayed here.   I used 96 MHz clock but ImagingSource looks like use 48 MHz setting in their source.

Thanks,

Don

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Don,

This is the trace after you made changes to the sensor? I couldn't see the high time and low time from this trace.

If this trace are proper then the fps is around 9 which is not according to your setting i.e 5 fps.

For this case: You are getting the errors because still the the input data is exceeding the high speed bandwidth

bandwidth: 2592 X 1944 X 9 = 45 MBps > 30 MBps

Please make sure that the fps you get from the sensor <=5 fps for 2592 X 1944 resolution. After making the changes to sensor, please check whether the output is coming as expected.

The error you are getting it due to the slower host (USB high speed bandwidth). To solve this problem you need to check the output from the sensor matches the bandwidth.

I am not sure that the changes you are doing to sensor are not proper or there is a problem in the sensor. Please check.

Regards,

Rashi

Regards,
Rashi
0 Likes
DoLe_3354741
New Contributor II

Hi Rashi,

I already tried 1 fps but it was not working, too.

Thanks,

Don

0 Likes
Rashi_Vatsa
Moderator
Moderator

Don,

In the the previous trace you shared, you had set fps to 5 but from the sensor you are getting the fps as 9.

There can be a possibility that output from the sensor is not 1 fps when you set the sensor to 1 fps.

You can reduce the fps by increasing the horizontal blanking. You need to first check the output of sensor (by probing FV and LV lines). Then calculate the fps from the traces. If the fps that you see in the trace is <= 5 fps for 2592 X 1944.

Or can you share the trace where you set the camera for 1 fps?

Regards,

Rashi

Regards,
Rashi
0 Likes
DoLe_3354741
New Contributor II

Hi Rashi,

Yes, I changed the MT9P031 fps as follows.   But it's not working.   The error message is for 1 fps but almost same message for 5 fps in cyfxuvcdscr.c settings.

Thanks,

Don

---------------------- In "void SensorScaling_2592x1944_DMx (void)" from sensor.c

...

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_LOWER, 0x257D);        // 0x007D); //  125 or 0x0066. maybe variable

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_UPPER, 0x0000);                        //    0

ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_DELAY, 0x0000);                //&&&&& 0x0C (1) SHUTTER_DELAY_REG

...

--------------------- Oscilloscope

IMG_1462.JPG

------------------------------------- Error messages at 1 fps

Application Stopped

Application Started

DMA Reset Event: Commit buffer failure

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Commit buffer failure

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

DMA Reset Event: Frame timer overflow, time period = 400

Application Stopped

Application Started

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Don,

You need to update the frame timer value. By default it is set to 200 ms for super speed and 400 ms for high speed (refer attachment)

* Note: The value should always be greater than the frame blanking period */

uint16_t glFrameTimerPeriod = CY_FX_UVC_FRAME_TIMER_VAL_200MS;

As per you trace (1 fps) , the frame blanking period is nearly 420 ms. Please set this variable to a value more than 420 ms. Try with 1000 ms.

Let me know the results.

If you still get commit buffer failure, please probe the USB lines. You can use wireshark for probing. Please let me know the OS you are working on.

Also confirm that buffer size settings are correct.

Below mentioned are settings for 48 KB buffer size and 8 bit bus width. Check for the settings in you application

Set the CY_FX_UVC_STREAM_BUF_SIZE  = 48K and CY_FX_UVC_STREAM_BUF_COUNT  = 2.

Also modify the ADDR_COUNT_LIMITER and DATA_COUNT_LIMITER to (((48K-16) /1) -1 )

Then modify No. of bytes device can rx in single payload in probe control structure to 0xC000 as follows:

"0x00, 0xC0, 0x00, 0x00,      /* No. of bytes device can rx in single payload = 48 KB */"

Regards,

Rashi

Regards,
Rashi
0 Likes
DoLe_3354741
New Contributor II

Hi Rashi,

Here are my answers...

================================

You need to update the frame timer value. By default it is set to 200 ms for super speed and 400 ms for high speed (refer attachment)

* Note: The value should always be greater than the frame blanking period */

uint16_t glFrameTimerPeriod = CY_FX_UVC_FRAME_TIMER_VAL_200MS;

As per you trace (1 fps) , the frame blanking period is nearly 420 ms. Please set this variable to a value more than 420 ms. Try with 1000 ms.

Let me know the results.

---------------------------------------------------

-> I changed it like this...

glFrameTimerPeriod = 1000; // CY_FX_UVC_FRAME_TIMER_VAL_400MS;

--------------------- But still not working and the debug messages are...

Application Started

Backflow detected...

DMA Reset Event: Commit buffer failure

Application Stopped

Application Started

DMA Reset Event: Commit buffer failure

Application Stopped

Application Started

DMA Reset Event: Commit buffer failure

Application Stopped

Application Started

...

----------------------------------------------------------

If you still get commit buffer failure, please probe the USB lines. You can use wireshark for probing. Please let me know the OS you are working on.

-------------------------------------

-> I installed wireshark and additional usb module,   But I was not able to probe the USB lines because there was no usb list on wireshark screen(drvinstaller.exe only finds my DMM 72 BUC02 driver).   I have no idea about using wireshark.   Anyway, I changed my USB cable with a new one which is USB 3.1 Type C cable(LS-U31-CM3AM-1M).   But it is still not working.   My OS is Windows 10 Home, version: 1903, OS build: 18362.295

----------------------------------------

Also confirm that buffer size settings are correct.

Below mentioned are settings for 48 KB buffer size and 8 bit bus width. Check for the settings in you application

Set the CY_FX_UVC_STREAM_BUF_SIZE  = 48K and CY_FX_UVC_STREAM_BUF_COUNT  = 2.

Also modify the ADDR_COUNT_LIMITER and DATA_COUNT_LIMITER to (((48K-16) /1) -1 )

Then modify No. of bytes device can rx in single payload in probe control structure to 0xC000 as follows:

"0x00, 0xC0, 0x00, 0x00,      /* No. of bytes device can rx in single payload = 48 KB */"

---------------------------------

-> I've already used your settings so I don't have to change anything, I think.

o My uvc.h

...

/* UVC Video Streaming Endpoint Packet Size */

#define CY_FX_EP_BULK_VIDEO_PKT_SIZE    (0x400)       /* 1024 Bytes */

/* UVC Video Streaming Endpoint Packet Count */

#define CY_FX_EP_BULK_VIDEO_PKTS_COUNT  (0x30)

/* DMA buffer size used for video streaming. */

#define CY_FX_UVC_STREAM_BUF_SIZE       (CY_FX_EP_BULK_VIDEO_PKTS_COUNT * CY_FX_EP_BULK_VIDEO_PKT_SIZE)  /* default: 16 KB */

...

/* Number of DMA buffers per GPIF DMA thread. */

#define CY_FX_UVC_STREAM_BUF_COUNT      (2)

...

o My GPIF II Designer ADDR_COUNT_LIMITER and DATA_COUNT_LIMITER => ((48*1024 -12-4)/1) -1 = 49135

o My uvc.c

/* UVC Probe Control Setting for a USB 2.0 connection. */

uint8_t glProbeCtrl20[CY_FX_UVC_MAX_PROBE_SETTING] = {

    0x00, 0x00,                 /* bmHint : no hit */

    0x01,                       /* Use 1st Video format index */

    0x01,                       /* Use 1st Video frame index */

    0x80, 0x96, 0x98, 0x00, // 1 fps,

    0x00, 0x00,                 /* Key frame rate in key frame/video frame units: only applicable

                                   to video streaming with adjustable compression parameters */

    0x00, 0x00,                 /* PFrame rate in PFrame / key frame units: only applicable to

                                   video streaming with adjustable compression parameters */

    0x00, 0x00,                 /* Compression quality control: only applicable to video streaming

                                   with adjustable compression parameters */

    0x00, 0x00,                 /* Window size for average bit rate: only applicable to video

                                   streaming with adjustable compression parameters */

    0x00, 0x00,                 /* Internal video streaming i/f latency in ms */


    0x00, 0xE3, 0x4C, 0x00, //LDH 2592x1944x1=     5,038,848

    0x00, 0xC0, 0x00, 0x00,

...

------------------------------------------

  Still not working...   and the same debug message.

  Thanks,

  Don

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Don,

Wireshark has plugin USBpcap(for Windows) for USB device captures. Please install that.

The Back flow error occurs when the host is slow. In this case the GPIF II blocks writes to the buffer faster than what USB side can consume.

So, to reduce the rate at which the data is streaming you need to increase the Horizontal blanking period.

When FV low (vertical blanking) there is no data written to buffer. The GPIF writes data to buffer when FV is high. So to reduce the rate at which data is written to buffer you need to increase the horizontal blanking (LV is low).

Also, let me know the host application that you are using to view the output.

Regards,

Rashi

Regards,
Rashi
0 Likes
DoLe_3354741
New Contributor II

Hi Rashi,

Still I just see the following error message...

-------------------------------

...

DMA Reset Event: Commit buffer failure

...

-----------------------------

  No "Backflow detected..."  message but it was actually just sometimes or starting time.

My Wireshark and USBpcap plugin installation were something wrong.   I re-installed them and now I can capture the "URB_BULK in" and the other info.   But I don't know why I cannot see any camera view(black screen) while capturing from USBPcap3 like this...

2019-08-29.png

I used the following setting source which has very increased vertical blank, shutter time values(1 fps, 1920x1080, Refer to "MT9P031: Developer Guide (Rev. A-2013)").

-----------------

void

SensorScaling_1080P_MT9P031_Increased_VerticalBlanking ( void)

{

CyU3PReturnStatus_t ret;

//SETTINGS FOR 1080P WITH 30 FPS. ROLLING SHUTTER ARTIFACT REDUCED BY 12%.

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_ROW_START, 431); // 0x01

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_COLUMN_START, 335); // 0x02

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_HEIGHT, 1079); // 0x03

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_WINDOW_WIDTH, 1919); // 0x04

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_HORIZONTAL_BLANK, 100); // 0); // 0x05=0

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_VERTICAL_BLANK, 3145); // 145); // 0x06=0

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_UPPER, 0x0000); // 0x08 (1) SHUTTER_WIDTH_HI

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_WIDTH_LOWER, 0x41AC); // 0x01AC); // 0x09 (1) INTEG_TIME_REG

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_SHUTTER_DELAY, 0x0000); // 0x0C (1) SHUTTER_DELAY_REG

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_ROW_ADDRESS_MODE, 0x0000); // 0x22 ROW_MODE, ROW_SKIP=0. ROW_BIN=0

    ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, MT9P031_COLUMN_ADDRESS_MODE, 0x0000); // 0x23 COL_MODE, COL_SKIP=0. COL_BIN=0

...

----------------

And the oscilloscope shows that...

Increased_vertical_blank_shutter_value.JPG

   The host application that I'm using to view the output is "GraphEdit" or eCAM or Windows 10 internal camera application.

Thanks,

Don

P.S.: How about trying to change various DMA buffer size combination?  

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Don,

In the previous post, I asked to increase the horizontal blanking period and not the vertical blanking period.

>>So, to reduce the rate at which the data is streaming you need to increase the Horizontal blanking period.

If you increase the vertical blanking period the error will not be solved. No data is written during vertical blanking (FV low).

We need to increase the period during which the data is written to the buffer by increasing the horizontal blanking period.

By increasing the horizontal blanking the FV high time will increase.

Can you share the .pcapng file? (USB traces)

Regards,

Rashi

Regards,
Rashi

View solution in original post

DoLe_3354741
New Contributor II

Hi Rashi,

Thank you VERY much.   It works !!!

As you mentioned above, to increase the Horizontal blanking value was the right solution.

The Horizontal blanking value have to be more than one or two thousands to make around 6~7 fps or less once I check the oscilloscope frequency value.

Thanks.

By the way, I don't know why the MT9P031 datasheet doesn't show that kind of examples to increase the value?  I just saw the increase of the Vertical blanking value but  the Horizontal blanking value.

Thanks,

Don

0 Likes