2018년 5월 21일 월요일

pclk

pclk: Pixel CLocK

Camera interface

The CAMIF, also the Camera Interface block is the hardware block that interfaces with different image sensor interfaces and provides a standard output that can be used for subsequent image processing.

A typical Camera Interface would support at least a parallel interface although these days many camera interfaces are beginning to support the MIPI CSI interface.

The camera interface's parallel interface consists of the following lines :-

8 to 12 bits parallel data line

These are parallel data lines that carry pixel data. The data transmitted on these lines change with every Pixel Clock (PCLK).
Horizontal Sync (HSYNC)

This is a special signal that goes from the camera sensor or ISP to the camera interface. An HSYNC indicates that one line of the frame is transmitted.
Vertical Sync (VSYNC)

This signal is transmitted after the entire frame is transferred. This signal is often a way to indicate that one entire frame is transmitted.
Pixel Clock (PCLK)

This is the pixel clock and it would change on every pixel.
NOTE: The above lines are all treated as input lines to the Camera Interface hardware.

Example
Let us suppose that a sensor is transmitting a VGA frame 640x480. The video frame is of a format RGB888. Let's assume that we have a camera sensor transmitting 8 bits per pixel clock (PCLK). This means to transfer one pixel of data, 3 PCLKs would be required. The HSYNC would be fired by the sensor after every 640 x 3, 1920 PCLKs. A VSYNC would be fired by the sensor after the entire frame is transmitted i.e. after 1920x480, 921600 PCLKs.
센서가 VGA 프레임 640x480을 전송한다고 가정 해 봅시다. 비디오 프레임은 RGB888 형식입니다. 우리가 픽셀 클록 (PCLK) 당 8 비트를 전송하는 카메라 센서를 가지고 있다고 가정 해 봅시다. 이것은 한 픽셀의 데이터를 전송하는 것을 의미하며, 3 개의 PCLK가 필요합니다. HSYNC는 640 x 3, 1920 PCLK마다 센서에 의해 발사됩니다. VSYNC는 전체 프레임이 전송 된 후 즉 1920x480, 921600 PCLK 이후에 센서에 의해 시작됩니다.

The camera interface's hardware block (that could be a part of any SOC) would constantly monitor the above lines to see if the sensor has transmitted anything. A typical camera interface would come with some internal buffering and would also have an associated DMA to transfer the image to the destination memory. The buffer would capture the incoming pixels to temporarily buffer them, and using the DMA the pixels would be transferred (probably line by line) through multiple burst DMA transfers to a destination address in the memory (pre programmed by the camera interface driver programmer). The camera interface's programmer interface might also give a facility of issuing hardware interrupts upon the receipt of the HSYNC, VSYNC signals to the host micro-controller. This could serve as a useful trigger for DMA reprogramming if required.
카메라 인터페이스의 하드웨어 블록 (SOC의 일부일 수 있음)은 센서가 아무 것도 전송하지 않았는지 확인하기 위해 위의 라인을 지속적으로 모니터링합니다. 전형적인 카메라 인터페이스는 약간의 내부 버퍼링을 가지며 이미지를 대상 메모리로 전송하는 관련 DMA를 갖습니다. 버퍼는 들어오는 픽셀을 캡처하여 일시적으로 버퍼에 저장하고, DMA를 사용하면 메모리의 대상 주소 (카메라 인터페이스 드라이버 프로그래머가 사전 프로그래밍 한)로 다중 버스트 DMA 전송을 통해 픽셀이 전송됩니다. 카메라 인터페이스의 프로그래머 인터페이스는 호스트 마이크로 컨트롤러에 대한 HSYNC, VSYNC 신호 수신시 하드웨어 인터럽트를 발행하는 기능을 제공 할 수도 있습니다. 필요할 경우 DMA 재 프로그래밍을위한 유용한 트리거 역할을 할 수 있습니다.




2018년 5월 20일 일요일

실장 방법에 따른 Chip 종류

목적: Chip의 Datasheet를 볼 때 PIN Map을 참조해야 하는데 하나의 Chip이라도 다른 형태의 PIN이 존재하기 때문에 어떤 핀을 참조해야 하는지 모르는 경우가 있다. 그 이유가 QSOP, QFN 등의 단어들과 함께 나오는데 이를 이해하기 위함이다.


내용: Chip은 Board에 실항하는 방법에 따라 모양이 달라지는데 Lead 가 있는 타입과 없는 타입이 나눠지는 경우, 그리고 더 자세하게 나눠지는 경우 들이 있다.
QSOP: Quarter-size small-outline package
QFN: quad-flat no-leads







2018년 5월 18일 금요일

I2C 통신 속도 분석

목적: Chip 의 Register에 적혀있는 I2C 의 속도 설명을 이해한다.

Datasheet 내용
I2C Master SCL High Time This field configures the high pulse width of the SCL output when the Serializer is the Master on the local I2C bus.
Units are 40 ns for the nominal oscillator clock frequency. The default value is set to provide a minimum 5us SCL high time with the reference clock at 25 MHz + 100ppm.
The delay includes 5 additional oscillator clock periods. Min_delay = 39.996ns * (SCL_HIGH_TIME + 5

분석
1. SCL High Time 이 8bit, SCL Low Time 이 8bit 로 Register에 적혀 있다.
    - I2C 통신에 사용되는 Clock의 신호가 High 로 유지되는 시간과 Low로 유지되는 시간을 설명해주는 내용이다.
2. 두 Register의 기본값은 0x79, 0x79로 동일하다.
3. Units are 40ns for the norminal oscillator clock frequency.
    - 하나의 단위는(여기서 SCL의 High 가 한번 유지되는 시간이나 Low가 유지되는 시간) 40ns 이다. 기본값(여기서는 0x79)는 SCL High나 Low 유지되는 시간의 최소값인 5us 를 만족하기 위해서 입력되어 있다.
    - 여기서는 reference clock이 25MHz 라고 되어 있는데 이 clock은 PCLK 과 동일한 것인지
    - clock 이 25MHz 라면 frequency 는 40ns
    - 계산 식으로는 Min-delay = 39.996ns * (SCL_HIGH_TIME + 5) 일때 'SCL_HIGH_TIME' 를 0x79(121) 로 변환하면 39.996ns * (121 + 5) = 5039.496ns 가 된다. 이는 약 5um 으로서 최소값 5um 를 만족 한다.
    - SCL High Time이 5.039496um 이고 SCL Low Time이 5.039496um 라는 것은 하나의 cycle이 10.07899um 라는 것으로 99,216.27083 이라는 숫자가 나오며 99.2162783 KHz로 계산된다.
    - 최종적으로 reference clock 이 25MHz 의 clock 이라면 0x79 를 기본 값으로 하는 I2C SCL High, I2C SCL Low 값은 약 100KHz 의 I2C Clock Frequency 를 의미한다.
4. 그러면 여기서 100ppm 은 무엇인가
5. remote delay



2018년 5월 12일 토요일

Excel VBA 기본

목적: 간단한 VBA 코드가 필요할 경우(Macro 작성) 기본 문법도 모두 검색해서 찾아보기 때문에 효율성이 떨어지고 내가 제대로 알고 있는지 의구심이 들 때가 있기 때문에

프로그램 설명: 1번 Row 부터 800번 Row 까지 이동하면서 1번 Column 에 특정 문자열이 들어 있으면 특정 명령을 수행한다.

1) 코드에는 아래와 같이 쓴다. Sub 와 함수 이름을 작성하고 괄호를 열고 닫은 후 엔터를 치면 End Sub 가 자동으로 나타난다. 이 말은 문법이 아직까지 틀린적이 없다는 것이다.
Sub MakeIndent()
End Sub

2) 사용할 변수 선언
Sub MakeUndext()
    Dim i, j, K As Integer
End Sub

3) For 구문 작성
Sub Makeindent()
    Dim i, j, K As Integer
    For i=1 To 800 
    Next
End Sub

4)  특정 문자열이 있는지 확인
Sub Makeindent()
    Dim i, j, K As Integer
    For i=1 To 800
        if ( inStr(Cells(i, 1), "Heading") ) Then
        Endif
    Next
End Sub

5) 특정 행동을 실행
Sub Makeindent()
    Dim i, j, K As Integer
    For i=1 To 800
        if ( inStr(Cells(i, 1), "Heading") ) Then
            j = MID(Cells(i, 1), 9, inStr(Cells(i, 1), "&") - 9)
            For k To j
                ' 오른쪽으로 Shift 하는 코드를 넣는데 이런 부분은 Macro 기록으로 실행한 뒤 복사해서 사용하면 된다.
            Next
        Endif
    Next