DMA issue

The driver configures DMA to write 2 frames/fields into one buffer before switching to next buffer. Under some condition (e.g. the field being received is out of order, top1—bottom1—bottom2—top3-bottom3…), we don’t’ want DMA to continue writing top3 into the same buffer (buf1) which contains bottom2. What I did: disable the corresponding CSI2 context after bottom2 has been saved in buf_1, provide a new physical address (buf_2) to CSI2 context, and reenable CSi2 context.  By doing this, I hope CSI2 DMA will store top3 into buf_2. However,  in my test, CSI DMA would continue write the next field (top3) into buf_1, most of the time. What we expected:

———-     ———–    ———

|   t1   |        |           |     |   t3   |

———      ———–   ———-

|  b1   |        |   b2    |     |   b3   |

———      ———-    ———-

buf_0      buf_1         buf3

What really happens:

———-     ———–    ———

|   t1     |    |     t3     |   |   t4   |

———      ———–   ———-

|  b1     |    |   b2     |   |   b3   |

———      ———-    ———-

buf_0      buf_1         buf3

The solution is to disable the corresponding interface, to force DMA write to the new buffer after the interface being enabled.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s