STM32F7 17 Digital camera interface (DCMI)

Started by tha, December 02, 2022, 09:11:38 AM

Previous topic - Next topic

tha

โหมดนี้สามารถถูกรองรับโดยการโปรแกรม the following codes:
•   FS ≤ 0xFF
•   FE ≤ 0xFF
•   LS ≤ SAV (active)
•   LE ≤ EAV (active)

tha

An embedded unmask code ถูกจัดให้มีใช้สำหรับ frame/line start และ frame/line end codes ด้วย. การใช้มัน, สามารถเป็นไปได้ที่จะเปรียบเทียบเฉพาะ the selected unmasked bits กับ the programmed code. คุณดังนั้นสามารถเลือก a bit ที่จะเปรียบเทียบใน the embedded code และตรวจจับ a frame/line start or frame/line end. ซึ่งหมายความว่าสามารถมีโค้ดที่แตกต่างกันสำหรับ the frame/line start และ frame/line end ที่มี the unmasked bit position ยังคงเหมือนเดิม.

tha

Example

FS = 0xA5

Unmask code สำหรับ FS = 0x10

ในกรณีนี้ the frame start code ถูกฝังอยู่ใน the bit 4 ของ the frame start code.


tha

17.4.5 Capture modes

อินเทอร์เฟซนี้รองรับ two types of capture: snapshot (single frame) และ continuous grab.

Snapshot mode (single frame)

ในโหมดนี้, a single frame ถูกตรวจจับ (CM = '1' ใน the DCMI_CR register). หลังจาก the CAPTURE bit ถูกเซ็ตใน DCMI_CR, the interface รอสำหรับการตรวจพบของ a start of frame ก่อนการสุ่ม the data. The camera interface จะถูกปิดใช้งานโดยอัตโนมัติ (CAPTURE bit ถูกเคลียร์ใน DCMI_CR) หลังจากการรับ the first complete frame. An interrupt จะถูกสร้าง (IT_FRAME) ถ้ามันถูกเปิดใช้งาน.

ในกรณีของ an overrun, the frame จะสูญหายและ the CAPTURE bit จะถูกเคลียร์.


tha

Continuous grab mode

ในโหมดนี้ (CM bit = '0' ใน DCMI_CR), ทันทีที่ the CAPTURE bit ถูกเซ็ตแล้วใน DCMI_CR, the grabbing process จะสตาร์ทบน the next DCMI_VSYNC หรือ embedded frame จะสตาร์ทขึ้นอยู่กับ the mode. The process ต่อเนื่องจนกระทั่ง the CAPTURE bit ถูกเคลียร์ใน DCMI_CR. ทันทีที่ the CAPTURE bit ถูกเคลียร์แล้ว, the grabbing process ต่อเนื่องจนกระทั่ง the end of the current frame.



ใน continuous grab mode, คุณสามารถกำหนดค่า the FCRC bits ใน DCMI_CR เพื่อจับภาพทั้งหมด, ทุกๆภาพที่สองหรือหนึ่งในสี่ภาพเพื่อลด the frame capture rate.

Note: ใน the hardware synchronization mode (ESS = '0' in DCMI_CR), the IT_VSYNC interrupt จะถูกสร้าง (ถ้าถูกเปิด
          ใช้งาน) แม้ว่า CAPTURE = '0' ใน DCMI_CR ดังนั้น, เพื่อลด the frame capture rate ยิ่งไปกว่านั้น, the IT_VSYNC
          interrupt สามารถถูกใช้เพื่อนับ the number of frames ระหว่าง 2 captures ร่วมกับ the Snapshot mode. สิ่งนี้ไม่ถูก
          อนุญาตให้โดย embedded data synchronization mode.

tha

17.4.6 Crop feature

ด้วย the crop feature, the camera interface สามารถเลือก a rectangular window จาก the received image. พิกัดเริ่มต้น (มุมซ้ายบน) และขนาด (มิติแนวนอนในจำนวนของ pixel clocks และขนาดแนวตั้งเป็นจำนวนของ lines) ถูกระบุโดยใช้ two 32-bit registers (DCMI_CWSTRT and DCMI_CWSIZE). The size of the window ถูกระบุในจำนวนของ pixel clocks (horizontal dimension) และในจำนวนของ lines (vertical dimension).



รีจีสเตอร์เหล่านี้ระบุพิกัดของ the starting point ของ the capture window เป็น a line number (ใน the frame, สตาร์ทจาก 0) และจำนวนของ pixel clocks (บน the line, สตาร์ทจาก 0), และขนาดของ the window เป็น a line number และ a number of pixel clocks. The CAPCNT value สามารถเป็นผลคูณของ 4 เท่านั้น (two least significant bits ถูกบังคับเป็น 0) เพื่ออนุญาตให้การส่งถ่ายที่ถูกต้องของ data ผ่านทาง the DMA.

ถ้า the DCMI_VSYNC signal ไปเป็น active ก่อน the number of lines ถูกระบุใน the DCMI_CWSIZE register, ดังนั้น the capture จะหยุดและ an IT_FRAME interrupt จะถูกสร้างเมื่อถูกเปิดใช้งาน.


tha

17.4.7 JPEG format

เพื่ออนุญาตให้ JPEG image reception, จำเป็นต้องเซ็ต the JPEG bit ใน the DCMI_CR register. JPEG images ไม่ได้ถูกเก็บเป็น lines and frames, ดังนั้น the DCMI_VSYNC signal จะถูกใช้เพื่อสตาร์ท the capture ในขณะที่ DCMI_HSYNC บริการเป็น a data enable signal. The number of bytes ใน a line อาจไม่เป็นทวีคูณของ 4, ดังนั้นคุณควรระมัดระวังเมื่อจัดการกรณีนี้เนื่องจาก a DMA request ถูกสร้างแต่ละครั้งที่ a complete 32-bit word ถูกสร้างแล้วจาก the captured data. เมื่อ an end of frame ถูกตรวจพบและ the 32-bit word ที่จะถูกส่งถ่ายไม่ได้ถูกรับอย่างสมบูรณ์, the remaining data จะถูกเติมด้วย '0s' และ a DMA request จะถูกสร้าง.

The crop feature และ embedded synchronization codes ไม่สามารถถูกใช้ใน the JPEG format.

tha

17.4.8 FIFO

Input mode

A four-word FIFO ถูกจัดให้มีใช้เพื่อจัดการ data rate transfers บน the AHB. The DCMI มีคุณลักษณะ a simple FIFO controller ที่มี a read pointer ที่เพิ่มขึ้นแต่ละครั้งที่ the camera interface อ่านจาก the AHB, and a write pointer ที่เพิ่มขึ้นแต่ละครั้งที่ the camera interface เขียนไปยัง the FIFO. ไม่มี overrun protection เพื่อป้องกัน the data จากการถูกเขียนทับถ้า the AHB interface ไม่ค้ำจุน the data transfer rate.

ในกรณีของ overrun หรือ errors ใน the synchronization signals, the FIFO จะถูกรีเซ็ตและ the DCMI interface จะรอสำหรับ a new start of frame.