2017년 5월 14일 일요일

(E, K)Practical Skills You'll Want to Acquire (당신이 얻고싶은 실질적인 기술들) - So, You Wanna Be an Embedded Engineer[Book]


Embedded Engineer 가 되기 위해서 좋은 책들을 검색해 보았는데, 가장 실질적인 조언을 준다고 생각되는 책(So, You Wanna Be an Embedded Engineer)을 찾았고 그 중 마음에 드는 부분을 번역 해 보았습니다.

한국에서 출간되지 않아 영문책을 구매했기 때문에 전체 내용을 제대로 봤다고 생각되지 않지만.. 아래 내용 Practical Skills You'll Want to Acquire (당신이 얻고싶은 실질적인 기술들) 은 심플하면서 이해가 잘 됩니다.


---

Regardless of how far you eventually intend to specialize, there is a small core of baseline skills that will benefit you greatly in any sector of embedded engineering. Some of these skills are taught explicitly in college, some of them are mentioned peripherally but not examined in any great detail, and the remainder are acquired and honed exclusively through practical experience. 
당신이 전문가가 될지 고민하는것과 상관 없이, 임베디드 엔지니어링의 어느 분야를 공부할 것인지에 상관없이 기본이면서도 가장 중요한 부분이 있습니다. 일부분은 대학교에서 명시적으로 알려주기도 하고, 다른 일부분은 대략 주제는 알게되지만 자세하게 이야기 되지 않습니다, 그리고 나머지는 실질적인 경험으로만 단련될 수 있습니다.

I hope the fact that you're reading this book — and presumably somebody paid to buy it — helps to demonstrate that one of the most important skills you can acquire is to learn the lost art of effective reading and writing in the apparently dead language known as English. Most engineers will probably not author full-length books, but any good engineer will write many thousands of words of technical documents in their careers, including the following: 
저는 당신이 이 책을 읽음으로서 — 아마 돈을 내고 샀을 텐데 — 영어로 배우고 쓴다는 것이 중요하다는 것을 배울 수 있었으면 합니다.(의역) 많은 엔지니어들이 책을 쓰지는 않지만 실질적으로 많은 기술에 대한 문서를 작성합니다. 아래 내용들을 포함하여,

• Product specifications, explaining to marketing and the people who write your product manuals exactly what the product will do 
• 제품 설명서, 제품을 쓸 사람에게 이 제품이 어떻게 동작할 것이라는 것을 명확하게 설명

• Protocol specifications, explaining to other engineers how to talk to your product 
• 통신 규약  설명서, 다른 엔지니어에게 제품과 이야기를 나눌 수 있는지 설명

• White papers, describing to other engineers what you've been working on and useful discoveries you've made 
• 논문, 다른 엔지니어들에게 당신이 무엇을 했고 어떠한 유용한 발견을을 했는지 자세하게 설명

• Patent disclosures 
• 특허 공유

• Instructions to subordinates 
• 같이 일하는 사람들(특히 경험이 없는)에게 지시

• Articles for technical journals (Being published in this way can substantially improve your visibility within an organization — think raises and promotions.) 
• 기술 저널에 글 쓰기(이런곳에 글이 실린다는 건 소속된 회사에서 상당한 존재감을 나타낼 수 있음 — 유명해지거나 승진 등)

• Debugging information, communicating with vendors, quality assurance 
technicians and engineering colleagues to solve complex problems 
• 디버깅 정보, 협력사와 논의 하거나, QA부서 인원 그리고 같은 일을 하는 엔지니어들과 복잡한 문제를 푸는 것)

• Justifications (dare I say it) for taking a specific course of action (When things get out of control and the recriminations start to fly, the one with the best paper trail usually wins.)
• 어떤 일을 해야함을 타당한 이유를 들며 설명할 수 있는 것


Most engineering students — in fact, I can generalize wildly and say most science students — regard language skills as a mere waste of time, required by an idiotic college bureaucracy. Unfortunately for these students, it has been my experience — very rarely contradicted — that engineers who can write intelligible and concise documents are precisely the same engineers whose specifications are complete and easy to understand, whose code is well-structured and simple to read, and who have little difficulty communicating effectively with co-workers. 
엔지니어 공부를 하는 학생들은 — 일반적으로 이야기해서 과학을 하는 학생들은 — 언어 공부는 시간낭비라고 생각한다, 관료적인 것이라고 생각합니다. 불행하게도 그런 학생들에게 이야기 하고 싶은 것은, 내 경험을 미루어 보아 — 대부분은 — 이해하기 쉽고, 간결하게 문서를 작성하고 코드가 잘 구조화된 사람들은 동료들과 소통하는데 덜 어려움을 겪습니다.


You'll note that the BSEE breakdown I gave in Section 2.1 only shows six credits of English. This is more or less representative of the average BSEE degree; you can add a little more writing and speaking experience in the liberal arts electives, but no matter how you wiggle your course schedule, a bachelor's degree in engineering is only going to give you the barest possible taste of formally taught language skills.
제 2.1 절에서 언급 한 BSEE 내역은 영어관련 6 학점 만 보여줍니다. 이것은 BSEE의 평균적인 정도를 나타내는 것입니다. 당신은 교양 선택 과목에서 약간의 쓰기와 말하기의 경험을 추가 할 수 있지만 코스의 일정을 어떻게 바꾸어도 공학 학사는 정식적인 언어 능력의 일부만을 경험할 수 있습니다.

You need to practice this. Voracious reading — not just technical books, but fiction and nonfiction by good authors — is essential; reserve time for it in your week (hints: the bath is a great place to relax and read, and Project Gutenberg has numerous free electronic texts you can download to your PDA and read anywhere) . Practice writing wherever you can; before I was ever published, I honed my skills largely in banter — technical and otherwise — on Usenet and, previously, Fidonet. Good language skills can float a competent engineer significantly above their colleagues.
 당신은 더욱 열심히 책을 읽어야 합니다. — 단순히 기술 책이 아니라 좋은 작가의 소설과 논픽션 — 필수적입니다. 한 주마다 그것을 위한 시간을 마련 하십시오 (힌트 : 목욕시간은 읽을 수있는 완벽한 시간입니다 그리고, Project Gutenberg는 많은 책을 PDA에 다운로드할 수 있게 해 주었습니다. ). 시간 있을 때마다 쓰세요. 내가 첫 책을 출판하기 전에, 기술적으로도 그렇지 않아도 Usenet 및 이전 Fidonet에서 나의 능력을 크게 손질했습니다. 뛰어난 언어 능력은 유능한 엔지니어를 동료들과 선명하게 구별지을 수 있게 해줍니다.

Another essential skill set on which you will not touch significantly in formal education is PCB layout and an understanding of DFM (design for manufacturing) concepts. Both of these are specialties in their own right, but from the perspective of the embedded engineer, they're closely related and can be learned at the same time. Although a design engineer in a company of even modest size probably won't spend any significant time working on layouts, there's a great deal of practical value in understanding at least the basics of what is involved in the processes of designing, laying out, and populating (stuffing) PCBs.
정규 교육에서 배우기 힘든 또 하나의 필수 기술은 PCB 레이아웃 및 DFM (제조를위한 설계) 개념의 이해입니다. 모두 임베디드 엔지니어의 전문 분야이며, 임베디드 엔지니어의 관점에서 보면, 그들은 밀접하게 관련되어 있으며, 동시에 배울 수 있습니다. 아마 적당한 크기의 회사의 설계 엔지니어는 아마 레이아웃 작업에 많은 시간을 할애하지 않지만, 적어도, 디자인, 레이아웃 및 프로세스의 프로세스에 관련되는 기초를 이해하는 데에서 PCB를 채우기 (포장 포함)

I'm not counting people for whom English is a second language in this statement. Wherever I write "English" in this section, you can substitute "the engineer's native language." It's language skill, not specifically English skill, that I'm talking about. However, if only because the majority of scientific and technical publications are in English, it would be prudent to study this language if you don't speak it natively.
저는 영어가 제 2 언어 인 사람을 말하고 싶은것은 아니지만, 이 섹션에서는 '영어'라고 쓴 경우, "엔지니어 모국어 '를 의미한다고 할 수 있습니다. 내가 말하고있는 영어 실력이 아니라 언어 능력입니다. 그러나 과학 기술 잡지의 대부분이 영어로 쓰여져 있는 사실을 생각해 보면 영어를 공부해야 하는것이 당연합니다.

A pre-Internet worldwide network of bulletin board systems; my system was ZWSBBS, 3:634/396. 
Fidonet still exists (though greatly shrunken since my days there) and is connected to the Internet at various points — see <http://www.fidonet.org/> for more information.
인터넷 전의 세계적인 네트워크는 BBS(bulletin board systems) 이었습니다. 저의 경우 ZWSBBS, 3:634/396를 사용 했습니다.
Fidonet은 여전히 존재하며 (많이 그 크기가 줄었지만) 다양한 경로로 인터넷과도 연결되어 있습니다. . 자세한 내용은 <http://www.fidonet.org/>를 참조하십시오.

If you work at a large company, you'll have opportunities to talk to the manufacturing engineers and PCB layout artists and glean a lot of useful wisdom; you should seize these opportunities when available. You don't necessarily need to annoy people with incessant questions; merely listening carefully at design reviews will greatly improve your understanding of the issues. There's a very large body of succulent information tidbits that seem intuitively obvious once you hear them, but which you might never think of yourself;
대기업에서 일하는 경우, 제조 엔지니어와 PCB 레이아웃 아티스트와 이야기를하고 많은 유익한 지혜를 모으는 기회가 있습니다. 이 기회를 잘 활용해야 합니다. 끊임없이 질문하면서 괴롭히라는 것은 아닙니다. 설계 검토 회의 시에 신중하게 듣는 것만으로 중요한 부분에 대한 이해가 크게 향상됩니다. 듣기만 해도 직관적으로 이해되는 다량의 정보들이지만 혼자 일했다면 절대 얻지 못할 것입니다.

for example, the need to keep ceramic surface-mount capacitors away from the edges of PCBs to avoid cracking them during depanelization; ensuring that you leave sufficient clearance around a surface-mounted microcontroller to allow use of a test clip; understanding how components drift or self- align on their pads when they go through the infrared reflow oven; and so on.
예를 들어, PCB를 자를 때(depanelization) 세라믹 표면 실장 커패시터를 PCB의 가장자리에서 멀리 떨어지게 유지해야 커패시터가 부서지는(cracking) 되는 것을 막을 수 있습니다. 테스트 클립을 사용(연결)할 수 있도록 표면 장착형 마이크로 컨트롤러 주변에 충분한 여유 공간을 확보하십시오. 적외선 reflow 오븐을 통과 할 때 패드에서 부품이 어떻게 이동 및  자체 정렬되는지 이해 등등

You'll also need a lot of practical software debugging experience. A good starting point for this is simply your college courses — if you work at the computer science and other programming-related course work with sufficient assiduity, you'll have a reasonable start on the methodology of software debugging by the time you graduate. However, one issue for which school will leave you almost completely unprepared is how to jump in at the deep end and start maintaining someone else's large code project.
실용적인 소프트웨어 디버깅 경험이 많이 필요할 것입니다. 이 과정을 시작하기에 좋은 출발점은 단순히 대학 과정입니다. 컴퓨터 과학 및 기타 프로그래밍 관련 과정을 충분히 조화롭게 공부하면 졸업 할 때까지 소프트웨어 디버깅 방법론을 합리적으로 시작할 수 있습니다. 그러나 학교에서 거의 준비가 안되는 문제 중 하나는 다른 사람의 대규모 코드 프로젝트의 심층적 인 상황에 뛰어 들어 유지보수를 해보는 것입니다.

It is practically guaranteed that your first job (and every subsequent job, for that matter) is going to involve maintaining some legacy code. You can be very lucky and find code that is accurately documented and well-commented, or you can encounter code (as I have) that contains no comments at all and is structured in such a complex and bizarre fashion that adding or removing a single comment line can cause the compiler to abort with an internal error. The most useful learning technique I have found for this is to take an open-source project and add specific simple functionality to it. For instance, you might set yourself the goal of modifying the IDE driver in the Linux kernel so that it turns on a
첫 번째 직업 (및 모든 후속 직업)에는 기존 코드를 유지 관리하는 것이 사실상 확률적으로 당연할 것입니다. 정확하게 문서화되고 잘 주석 처리 된 코드를 보는 것은 운이 정말 좋은 것이며, 개인적인 나의 경험처럼 주석이 전혀없는 거나 하나의 주석을 추가하거나 제거하하면 예상하지 못한 컴파일 에러가 생기거나 내부 에러가 생기는 코드를 보게 될 수도 있습니다. 내가 찾은 가장 유용한 학습 기술은 오픈 소스 프로젝트를 가져 와 간단한 기능을 추가해 보는 것입니다. 예를 들어 리눅스 커널의 IDE driver를 수정하는 것을 목표로 할 수도 있습니다.

A general disadvantage of learning in the school context is that you know that the problem you've been assigned has a solution, you know that you have been given the skills and the time to find that solution, and you can make inferences (from where your class is up to in the curriculum) as to which specific skills are likely to be relevant to the problem. Real-world problems don't have any of these guarantees or hints; you're on your own with a clock (and budget) steadily ticking away and management breathing down your neck. Enjoy your time at school; these are the easiest problems you will ever be asked to solve.
학교 학습의 일반적인 단점은 당신이 할당 된 문제에 해결책이 있다는 것을 알고, 기술과 그 해결책을 찾을 수 있는 시간을 얻었고, 추론을 할 수 있다는 것을 알고 있다는 것입니다.(당신의 수업은 커리큘럼이 짜져 있으니..) 어떤 특정 기술이 문제와 관련이 있을지 결정합니다. 현실 세계에서는 이러한 보장이나 힌트가 없습니다. 시간은 가지만 (그리고 돈도 없어지고) 경영진이 당신 바로 뒤에 지켜보고 있습니다.. 학교에서 즐거운 시간 보내십시오. 학교에서의 과제들은 당신이 풀어야 할 가장 쉬운 것들입니다.

red LED whenever a write operation is requested from the application layer, or a green LED for read operations. A more challenging project might be to take an open-source operating system, such as NetBSD or eCos, and port it to a new board. In any case, the goal is to understand enough of the existing code to know where to insert your changes and modify the code as nonintrusively as possible to avoid creating bugs.
쓰기 작업이 응용 프로그램 계층에서 요청 될 때마다 빨간색 LED 또는 읽기 작업에 녹색 LED가 표시됩니다. 더 어려운 프로젝트는 NetBSD 또는 eCos와 같은 오픈 소스 운영 체제를 사용하여 새 보드에 포팅하는 것입니다. 어쨌든, 목표는 기존 코드를 충분히 이해하여 변경 사항을 삽입 할 곳을 파악하고 가능하면 코드를 수정하여 버그를 만들지 않도록하는 것입니다.

Finally, most embedded engineers are going to need at least rudimentary laboratory skills. This includes being able to solder up prototypes and operate an oscilloscope, signal generator, and spectrum analyzer. The introduction you'll receive in college is probably adequate grounding in this; you'll gain much greater facility with experience, of course. In this day and age, it's also very useful to be able to work with surface-mount components. You can practice this very inexpensively on any junked piece of hardware — an old PC motherboard, a DVD player, or any similar board with lots of parts on it. 
마지막으로, 많은 임베디드 엔지니어들은 기본적인 연구소 기술을 익혀야 합니다. 그것들에는 프로토타입을 직접 납땜해서 만들 수 있다거나, 오실로스콥을 작동시키고, 시그널 생성기를 만지고, 스펙트럼 분석기를 쓸 수 있는 것들 입니다. 당신이 대학에서 받게 될 소개는 이것에서 적절한 접지 일 것입니다; 물론 훨씬 더 큰 편의 시설을 경험하게 될 것입니다. 이 시대에는 표면 실장 부품으로 작업하는 것이 매우 유용합니다 - 오래된 PC 마더 보드, DVD 플레이어 또는 그 위에 많은 부품이있는 유사한 보드를 사용 하는 것

I'm sure you've noted the recurring theme here: even if you learn some skills theoretically at school, I'm exhorting you to find opportunities to keep working at example problems requiring those skills in real life. Furthermore, a lot of what you need to know can only be acquired through dealing with actual problems. Engineering is a practical discipline. Steep yourself in homebrew projects to keep your skills fresh and ready for action; you're also demonstrating self-motivation to future employers.
당신은 지금까지 반복된 내용을 알았을 겁니다: 만약 학교에서 이론적으로 어떤 기술을 익혔을 지라도, 그 내용들을 실제 상황에서 볼 수 있는 기회를 찾기를 바랍니다. 많은 것들이 실제 경험을 통해서만 알 수 있습니다. 엔지니어링은 실질것인 것입니다. 신 기술에 적응하고 바로 실행할 수 있도록 하려면 자신을 숙성시키기 위해 노력을 해야 합니다. 당신은 미래 고용자들에게 어필을 하는 것입니다.


2017년 5월 2일 화요일

watchdog timer

A watchdog timer (sometimes called a computer operating properly or COP timer, or simply a watchdog) is an electronic timer that is used to detect and recover from computer malfunctions.

During normal operation, the computer regularly resets the watchdog timer to prevent it from elapsing, or "timing out".

If, due to a hardware fault or program error, the computer fails to reset the watchdog, the timer will elapse and generate a timeout signal.

The timeout signal is used to initiate corrective action or actions.

The corrective actions typically include placing the computer system in a safe state and restoring normal system operation.


Watchdog timers are commonly found in embedded systems and other computer-controlled equipment where humans cannot easily access the equipment or would be unable to react to faults in a timely manner.

In such systems, the computer cannot depend on a human to reboot it if it hangs; it must be self-reliant.

For example, remote embedded systems such as space probes are not physically accessible to human operators; these could become permanently disabled if they were unable to autonomously recover from faults.

A watchdog timer is usually employed in cases like these.

Watchdog timers may also be used when running untrusted code in a sandbox, to limit the CPU time available to the code and thus prevent some types of denial-of-service attacks.

reference
    Link 1: english Wikipedia
    Link 2: korean Wikipedia

2017년 4월 29일 토요일

(E)Silicon Labs C8051 LED Blinky Example Explained(C8051 chip 기본동작 LED 예제로 설명하기)

Purpose
for newbie(software engineer) to understand basic concept of embedded programming.
line by line explanation.

Preparation
board: C8051F560 Development Kit
part(Chip): C8051F568-ACK06Z
datasheet: C8051F55x/56x/57x
development kit document: C8051F560 DEVELOPMENT KIT USER ’S GUIDE
development Tool: Simplicity Studio v4
silicon labs debugger
PC(notebook)

Prerequisite
install simplicity studio v4
connect PC-board-debugger

Create (example) project
simplicity IDE - File - New - Project - Silicon Labs MCU Project
select board
select part
select project type:example
select f55x-57x Blinky
copy contents

Explanation
1. Program Description:
  This program flashes the green LED on the C8051F560 target board about
  five times a second using the interrupt handler for Timer2.

2. How To Test:
  1) Download code to the 'F560 target board
  2) Ensure that the P1.3 pins are shorted together on the J19 header
  3) Run the program.  If the LED flashes, the program is working
  J19: Side A: Connects P1.3_A LED and P1.4_A Switch to MCU port pins


3. Code:
  // Includes
  // Global CONSTANTS -> set system clock speed, and select pin to connect to LED
  // Function PROTOTYPES
  //// OSCILLATOR_Init -> set oscillator speed
  //// PORT_Init -> set pin to manipulate LED
  //// TIMER2_Init -> set timer speed, init(&reload) value, enable interrupt and start timer
  // Interrupt Service Routines
  //// Timer2_ISR -> set interrupt service routine function when timer executed
  // MAIN Routine -> initialize and execute while not to exit firmware.

4. line by line code explanation.
    1) Total 175 line of Code
        - 93 lines of Comments
        - 16 lines of new line
        - 66 line of (meaningful) code
    2) will be continued

37: #include <SI_C8051F550_Defs.h>
-> SFR(Special Function Register) address
-> (IRN) Interrupt Request Numbers

38: #include <SI_C8051F550_Register_Enums.h>
-> Register Names

44: #define SYSCLK       24000000/8        // SYSCLK frequency in Hz
SYSCLK : System  Clock
Processor Clock: Chip Clock
-> more explanation needed
reference: Link

46: SBIT (LED, SFR_P1, 3);                 // LED='1' means ON
LED is variable to connect SFR_P1(port 1), pin 3 with rear LED.
so LED=1 make LED light on

52: void OSCILLATOR_Init (void);
initialize oscillator for oscillation of the crystal

53: void PORT_Init (void);
set pin to execute the chip for purpose
in this case LED pin

54: void TIMER2_Init (U16 counts);
configuration timer 2 to execute chip.
configure consists Interrupt Service Routine, Auto-reload, Timer base

59 ~ 75: Main
explained later

88 ~ 96: OSCILLATOR_Init function
88: void OSCILLATOR_Init (void)
89: {
90:    U8 SFRPAGE_save = SFRPAGE;
To read or modifying the SFR value, we need to contact the register.
the steps are
1. Select the appropriate SFR page number using the SFRPAGE register.
2. Use direct accessing mode to read or write the special function register (MOV instruction).

SFR has pages, for C8051F55x/56x/57x family of devices utilizes three SFR pages: 0x00, 0x0C, and 0x0F (ref: datasheet 12.1. SFR Paging)

91:    SFRPAGE = CONFIG_PAGE;
CONFIG_PAGE is 0x0F, and to modify OSCICN register this address should be accessed
92:
93:    OSCICN = 0xC4;                      // Set oscillator divide to /8
OSCICN: Internal Oscillator Control
0xC4 saids 100: SYSCLK derived from Internal Oscillator divided by 8.
datasheet saids SFR Address = 0xA1; SFR Page = 0x0F
so this makes system clock to 24000000(default) / 8 (line 44)
94:
95:    SFRPAGE = SFRPAGE_save;
return pre-sfrpage
96: }

111: void PORT_Init (void)
112: {
113:    U8 SFRPAGE_save = SFRPAGE;
114:    SFRPAGE = CONFIG_PAGE;
115:
116:    P1MDOUT |= 0x08;                 // Enable LED as a push-pull output
P1MDOUT was declared as
SFR (P1MDOUT,     0xA5); ///< Port 1 Output Mode
0xA5 address's value is assigned to P1MDOUT
to configure P1MDOUT(Port 1 mode Out)
it can be done with config2.exe
0x08 is 00001000 as binary and this means port 1 pin 3 is push-pull output
117:    P1SKIP  |= 0x08;                    // Skip the LED pin on the crossbar
skip port 1 pin 3 not to connect any peripheral
119:    XBR2     = 0x40;                    // Enable crossbar and weak pull-ups
see ref1 below
121:    SFRPAGE = SFRPAGE_save;
122: }

137: void TIMER2_Init (U16 counts)
138: {
139:    U8 SFRPAGE_save = SFRPAGE;
140:    SFRPAGE = LEGACY_PAGE;

142:   TMR2CN  = 0x00;                  // Stop Timer2; Clear TF2;
                                                 // use SYSCLK/12 as timebase
144:   CKCON  &= ~0x60;               // Timer2 clocked based on T2XCLK; <- same as above comment(SYSCLK/12 as timebase)

146:   TMR2RL  = -counts;              // Init reload values
timebase is 250,000 hz(250,000 cycles in 1 second)
counts value is 25,000(number, cycles) so
25,000 times takes 25,000 / 250,000 * 1seconds = 1/10 seconds.
this means 10hz frequency
147:   TMR2    = 0xFFFF;                // Set to reload immediately
148:   IE_ET2  = 1;                        // Enable Timer2 interrupts
149:   TMR2CN_TR2 = 1;               // Start Timer2

151:   SFRPAGE = SFRPAGE_save;
152:}

Timer 2
-> check the block diagram related to each register
-> understand datasheet register definition


166: INTERRUPT(TIMER2_ISR, TIMER2_IRQn)
when timer2 interrupt occurs(TIMER2_IRQn, 5 as constant) this TIMER2_ISR function(interrupt service routine) executed
167: {
168:    TMR2CN_TF2H = 0;               // Clear Timer2 interrupt flag
clear flag for next interrupt, because this function already executed.
169:    LED = !LED;                         // Change state of LED
LED represents LED pin
toggle means once on and once off when this interrupt service routine occurs
170: }

ref1: Link
Basically, it gives the designer the flexibility to chose which pins the desired peripheral is routed to. Let's say you have a UART devices that needs to connect to pins P1.0 and P1.1. The crossbar allows you to bring that signal out to that pin or a different supported pin in another design. Think of it as a multiplexer. Each physical pin is an output and all the peripherals are the inputs.

Hope that helps. Every micro controller has this sort of functionality, though usually a pin is limited to a few peripherals it can connect to. This is generally called "pin muxing".

2017년 4월 28일 금요일

Memory Types on Embedded Programming(Memory의 종류 및 고려해야 할 점)

Memory의 종류 및 고려해야 할 점

1. 전원을 차단 시 특성에 의한 구분
    1) 지워지는 것
        - RAM: Random Access Memory
    2) 지워지지 않는 것
        - ROM: Read Only Memory

2. 세부 종류
    1) RAM
        SRAM

    2) ROM
        Flash
        EEPROM

3. 메모리가 필요한 예시
    1) 전원이 꺼져도 없어지지 않아야 한다: 코드
    2) 프로그램 실행: 실제 실행되는 Binary -> 코드가 변환하여 Upload
    3) 프로그램 실행 시 사용되고, 전원이 꺼져도 없어지지 않아야 하는것: Setting 값 등

-> 설명: 코드는 전원이 꺼져도 없어지지 않아야 하니까 ROM 의 한 종류인 Flash 에 저장이 된다. 그리고 전원이 들어오면 실행이 되어야 하기 때문에 이 코드를 RAM Memory 에 올리고 MCU 가 실행 된다. 보통은 RAM 영역에서 실행하고 전원을 끄면 RAM의 내용이 지워지면 되지만 Setting 값 들(모니터의 밝기 등)은 저장되어 있는 것이 고객이 사용하기에 편리하기 때문에 이런 특성을 가진 변수를 저장할 때는 ROM의 한 종류인 EEPROM을 사용한다. EEPROM은 같은 ROM인 Flash에 비해 read/write 속도가 느리고 쓰는 횟수도 제한되어(10만번) 있다.

4. 실제 사용하고 싶은 MCU 를 선택 할 때 고려할 것
    - 사용할 코드의 크기 -> Flash
    - 실제 프로그램에 실행 시 RAM에 올릴 코드의 크기 -> SRAM
    - 전원이 꺼져도 계속 값이 유지되어야 하는 값들 -> EEPROM
    -> 동일 Family 의 MCU 라도 메모리 크기에 의한 Chip 이 따로 있는 이유이다.


참조: http://www.icbanq.com/pbloger/board_View.aspx?number=965

SRAM 은 DRAM에 비하여 5배 빠르며 비싸다.
Static의 의미는 전기를 주는 한 데이터가 지워지지 않는다는 의미이며, Dynamic은 1초마다 refresh(Capacitor에 전자를 채워 주는 것)를 해 줘야 데이터가 유지된다.
보통 MCU의 RAM에 SRAM만 있는 이유는 속도 때문이라고 생각한다.


참조: http://yeslab.tistory.com/20


용량이 큰 경우에는 돈이 중요하기 때문이다.

참조: http://terms.naver.com/entry.nhn?docId=1180951&cid=40942&categoryId=32832

flash 와 EEPROM의 비교

flash 는 싸며 빠르며 큰 block 단위로 지우고 쓸 수 있다.
EERPOM은 상대적으로 비싸며 느리며 작은 block 단위로 지우고 쓸 수 있다.
적은 크기의 데이터를 쓴다면 EEPROM 이 맞고 큰 크기의 데이터가 필요하며 flash 가 맞다.

flash 안에서도 program flash, data flash 를 나누어서 쓰고 있는데 말 그대로 프로그램 code가 저장되는 곳이 program flash 이며 사용할 데이터(setting 값 같은) 를 저장하는 곳이 data flash 이다.
EEPROM, program flash, data flash 중 어떤 것을 선택할지는 기능과 가격을 고려해서 사요할 것이며 유사 프로젝트에서 경험적으로 진행 할 것이라고 생각한다.

그리고 ROM(Read Only Memory) write 의 횟수가 적다는 의미이지(주로 사용하는 기능이 Read) write가 안된다는 말이 아니다.

참조1/2: https://en-sg.knowledgebase.renesas.com/English_Content/MCUMPU/Basic_Information/What_is_the_difference_between_%22program_ROM%22_and_%22data_flash%22%3F
참조2/2: https://en.wikipedia.org/wiki/Flash_memory

EEPROM 크기가 작기 때문에 필요한 경우가 많은데 가격이 비싸다 그래서 가격이 싼 flash memory를 EEPROM 과 같이 쓰기 위해서 emulation을 한다. 문제는 flash가 하나의 큰 블럭 단위로 지우고 쓰기 때문에 EEPROM 과 같이 작은 단위의 블록으로 활용하려면 이를 위한 알고리즘이 필요하다. 결국 flash memory를 하나의 블럭을 전부 쓴 다음에만 지우는 것이 필요하게 된다.

참조1/2: https://www.ecnmag.com/article/2007/09/benefits-flash-eeprom-re-programming-end-application-becomes-easy
참조2/2: https://electronics.stackexchange.com/questions/258851/flash-eeprom-emulation

DDR 도 RAM 으로 사용하는 메모리의 한 종류

Program Flash, Data Flash, SRAM 으로 기본 메모리가 이루어져 있고
이 중 Flash 에서 Flash NVM(64KB), SRAM 중에서 Flash RAM(4KB) 을 사용하여 EEPROM Emulation 을 진행한다 이렇게 되면 EEPROM 을 10년 사용할 수 있게 된다.

2017년 4월 23일 일요일

Image Process Pipeline

Image Sensor 에서 이미지를 획득(Acquisition) 한 다음 이미지 프로세싱을 수행하고 이 이미지 프로세싱을 나열한 것이 pipeline 이다. 이 pipeline 이 지나면 최종 이미지(YUV 이미지?)가 생성된다.

So what purpose does ISP have? Well, pixels are sensitive to light between some set of wavelengths, essentially they’re color agnostic.
ISP 의 목적은 무엇인가? pixel은 빛에 민감하다(관련된 특성은 빛 파장이며, 이 때 색은 감지하지 못한다(agnostic, 불가지론의).)

The way to get a color image out is to put a filter on top, usually a bayer pattern color filter, then interpolate the color of the pixels adjacent.
색을 얻는 방법은 필터를 센서 위에 두는 것이다, 보통 베이어 패턴의 색 필터를 사용한다. 그 후에는 interpolate로 주변 픽셀의 색을 구한다. (한 픽셀은 R, G, B 중 한가지만 얻을 수 있기 때문에)

Your 8 MP CMOS doesn’t sense red green and blue for each pixel, it senses one color for each, then ISP guesses the color based on what’s next to it. This is called demosaicing, and it’s probably the primary job of ISP, and there are many secret sauce methods to computing this interpolated image.
8메가의 CMOS 센서는 빨간색, 녹색, 파란색을 각 픽셀에서 얻지 못한다. 하나가지 색만 감지해 낼 수 있다. 그리고 ISP는 주변의 색을 추측 해 낸다. 이것을 demosic 한다고 한다. 이것이 ISP의 가장 기본적인 일이다. 그리고 ISP는 이 interpolate 된 이미지를 가지고 많은 일을 한다.

In addition ISP does all the other housekeeping, it controls autofocus, exposure, and white balance for the camera system.
ISP는 autofocus, exposure, white balance 도 한다.

Recently correcting for lens imperfections like vignetting or color shading imparted by the imperfect lens system (which you’ll add right back in with instagram, you heathen) has been added, along with things like HDR recombining, noise reduction, other filtering, face or object detection, and conversion between color spaces.
최근에는 lens의 불완전함(비네팅, 컬러 쉐이딩 - 렌즈의 불완전함 때문에 생긴) 을 바로 잡기도 하며 HDR recombining, noise reduction, 다른 filtering, 얼굴 인식, 물체 인식, 색 공간간의변환 등도 수행 합니다.

There’s variance between the features that ISP does, but this is really the controller for getting that bayer data into a workable image array.
ISP 에서 하는 일은 ISP의 종류에 따라 다양 하지만, bayer를 사용 가능한 image array 로 만든 다음 그것을 조작 하는 것임은 틀림 없습니다.



참조
http://www.anandtech.com/show/6777/understanding-camera-optics-smartphone-camera-trends/4
https://www.einfochips.com/blog/consumer-electronics/a-peek-inside-your-camera-i-image-signal-processing-isp-pipeline.html
https://www.einfochips.com/blog/consumer-electronics/a-peek-inside-your-camera-ii-image-sensor-modules.html

Image Sensor

Image Processing 을 이해하기 위한 Image Sensor 종류 확인

보통 CMOS 센서를 쓰고, 빛의 양(회색 빛)을 숫자로 받을 수 있으며 색을 확인하기 위하여 Bayer filter 를 사용하여 interpolation 을 하면 digitize(숫자화, 여기서는 양자화 까지 포함?) 된, matrix 형태의 이미지를 받을 수있다.
궁금한 것은 sensor 의 셋팅을 통하여 센서에서 받는 이미지의 값이 달라지고 이것이 최종 이미지 품질을 변화시킬 텐데
sensor 셋팅을 통해서 할 수있는 일들이 무엇인지 궁금하다. 왜냐하면 이미지 프로세싱과 구분이 잘 안되기 때문이다.


아래 내용 참조: https://en.wikipedia.org/wiki/Image_sensor

An image sensor or imaging sensor is a sensor that detects and conveys the information that constitutes an image. It does so by converting the variable attenuation of light waves (as they pass through or reflect off objects) into signals, small bursts of current that convey the information. The waves can be light or other electromagnetic radiation. Image sensors are used in electronic imaging devices of both analog and digital types, which include digital cameras, camera modules, medical imaging equipment, night vision equipment such as thermal imaging devices, radar, sonar, and others. As technology changes, digital imaging tends to replace analog imaging.
이미지 센서 혹은 이미징 센서는 이미지 정보를 감지하고 전달한다. 빛 파장의 가변감쇄를 통하여(통과 시키거나 반사하면서) 시그널이나, 적은 저항으로 이미지 정보를 저장한다. 그 파자은 빛이나 다른 전자기복사가 될 수 있다. 이미지 센서는 전자 이미지 장치(아날로그, 디지털 타입 모두)에 사용된다. 디지털 카메라, 카메라 모듈, 의료 이미징 장비, 야간 투시경 장비(열 감지 장치, 레이다, 음향포정장치 등)에 사용된다. 기술이 변화하면서 디지털 이미징은 아날로그 이미징으로 옮겨가고 있다.

Early analog sensors for visible light were video camera tubes. Currently, used types are semiconductor charge-coupled devices (CCD) or active pixel sensors in complementary metal–oxide–semiconductor (CMOS) or N-type metal-oxide-semiconductor (NMOS, Live MOS) technologies. Analog sensors for invisible radiation tend to involve vacuum tubes of various kinds. Digital sensors include flat panel detectors.
초기 사람에게 보이는 영역(가시광)을 위한 아날로그 센서는 비디오 카메라 튜브 였습니다. 현재 사용되는 센서의 타입은 반도체 CCD(charge-coupled devices)나 active Pixel sensor인 CMOS(complementary metal–oxide–semiconductor) 혹은 NMOS(N-type metal-oxide-semiconductor) 기술 입니다. 보이지 않는 영역을 위한 아날로그 센서는 다양한 vaccum tube를 포함하고 있습니다. 디지털 센서는 평평한 판넬 감지기를 포함합니다.


CCD vs CMOS technology
Today, most digital cameras use a CMOS sensor, because CMOS sensors perform better than CCDs. An example is the fact that they incorporate an integrated circuit, helping reduce costs. CCD is still in use for cheap low entry cameras, but weak in burst mode.[1] Both types of sensor accomplish the same task of capturing light and converting it into electrical signals.
오늘, 대부분의 디지털 카메라는 CMOS 센서를 사용한다. 왜냐하면 CMOS 센서는 CCD 보다 나은 성능을 내기 때문이다(-.-;). 예를 들면 CMOS는 가격을 줄이는 데 도움이 되는 집적회로를 포함하고 있다. CCD는 보통 싼 기본기능이 탑재된 카메라에 쓰인다. 하지만 독점 방식에 약하다. 두개의 (센서)타입 모두 빛을 캡쳐해서 전자 시그널로 변환하는 기능을 수행한다.

Each cell of a CCD image sensor is an analog device. When light strikes the chip it is held as a small electrical charge in each photo sensor. The charges in the line of pixels nearest to the (one or more) output amplifiers are amplified and output, then each line of pixels shifts its charges one line closer to the amplifier(s), filling the empty line closest to the amplifiers(s). This process is then repeated until all the lines of pixels have had their charge amplified and output.[2]
CCD 이미지 센서의 각 셀은 아날로그 장치이다. 빛이 센서의 개별 칩(픽셀)에 부딧힐 때 작은 전하가 생긴다. 아웃풋 증폭기와 가까운 row 픽셀 라인의 전하들은 증폭되고 아웃풋 된다(?) 그리고 각 픽셀 라인은 그 전하를 가장 가까운 빈 라인을 채우면서 한 라인 가까운 증폭기에 시프트 시킨다. 이프로세스는 모든 픽셀 라인이 전하로 채워질 때까지 계속된다.

A CMOS image sensor has an amplifier for each pixel compared to the few amplifiers of a CCD. This results in less area for the capture of photons than a CCD, but this problem has been overcome by using microlenses in front of each photodiode, which focus light into the photodiode that would have otherwise hit the amplifier and not be detected.[3] Some CMOS imaging sensors also use Back-side illumination to increase the number of photons that hit the photodiode.
CMOS 이미지 센서는 각 픽셀에 증폭기가 달려있어 상대적으로 적은 CCD 와 비교된다. 이 차이가 적은 포톤을 잡는 특징을 만들었지만, 이 문제는 각 포토다이오드 앞에 빛을 포토다이오드에 포커스 하게 해주는 마이크로렌즈를 사용함으로써 빛이 증폭기를 비춰서 디텍트 되지 않을수 있는 위험을 없애 주었다. 일부 CMOS 이미지 센서는 뒷면 조명을 사용하여 포토 다이오드를 치는 포톤의 수를 증가시켜 주었다.(?)

CMOS sensors can potentially be implemented with fewer components, use less power, and/or provide faster readout than CCD sensors.[4] They are also less vulnerable to static electricity discharges.
CMOS 센서는 CCD보다 잠재적으로 적은 수, 적은 파워 그리고 빠른 해독이 가능하다. 그리고 정전기에도 덜 연약하다.

Another hybrid CCD/CMOS architecture, sold under the name "sCMOS," consists of CMOS readout integrated circuits (ROICs) that are bump bonded to a CCD imaging substrate – a technology that was developed for infrared staring arrays and now adapted to silicon-based detector technology.[5] Another approach is to utilize the very fine dimensions available in modern CMOS technology to implement a CCD like structure entirely in CMOS technology. This can be achieved by separating individual poly-silicon gates by a very small gap. These hybrid sensors are still in the research phase and can potentially harness the benefits of both CCD and CMOS imagers.[6]
또 다른 CCD/CMOS 를 조합한 구조는, 'sCMOS' 라고 하며, CMOS 해독 집적회로(ROICs) 가 CCD 이미지 기판에 붙어 있다 - 이 기술은 적외선 응시 배열 때문에 만들어 졌으며 지금은 실리콘 기반의 탐지 기술에도 적용 되고 있다.  ...

Performance
There are many parameters that can be used to evaluate the performance of an image sensor, including dynamic range, signal-to-noise ratio, and low-light sensitivity. For sensors of comparable types, the signal-to-noise ratio and dynamic range improve as the size increases.


Color separation
There are several main types of color image sensors, differing by the type of color-separation mechanism:
color 를 sensing 하기 위하면 몇가지 다른 방법이 있다.

1) Bayer filter sensor,
low-cost and most common, using a color filter array that passes red, green, or blue light to selected pixel sensors, forming interlaced grids sensitive to red, green, and blue – the missing color samples are interpolated using a demosaicing algorithm. In order to avoid interpolated color information, techniques like color co-site sampling use a piezo mechanism to shift the color sensor in pixel steps. The Bayer filter sensors also include back-illuminated sensors, where the light enters the sensitive silicon from the opposite side of where the transistors and metal wires are, such that the metal connections on the devices side are not an obstacle for the light, and the efficiency is higher.[7][8]

2) Foveon X3 sensor,
using an array of layered pixel sensors, separating light via the inherent wavelength-dependent absorption property of silicon, such that every location senses all three color channels.

3) 3CCD,
using three discrete image sensors, with the color separation done by a dichroic prism.






















2017년 4월 22일 토요일

Video compression picture types(I, P, B frames)

계기: i frame 과  p frame 이 무엇이고 그 차이점을 이해하기 하기 위하여

I‑frame (Intra-coded picture)
사진의 모든 정보, P-frame과 B-frame은 이미지의 일부(압축된)만 가지고 있으므로 I-frame에 비해 크기가 작다.

P-frame (Predicted picture)
이전 이미지에서 변경된 정보만을 가지고 있는 frame. delta-frames 라고도 부른다.

B-frame(Bi-predictive picture)
지금, 이전, 그리고 다음의 프레임의 다른 점을 저장하여 더(P-frame 보다?) 공간을 줄이는 것

참조: https://en.wikipedia.org/wiki/Video_compression_picture_types