<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>guide - OCFreaks!</title>
	<atom:link href="https://www.ocfreaks.com/tag/guide/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.ocfreaks.com/tag/guide/</link>
	<description>Overclocking , Gaming , Technology , Robotics &#38; DIY!</description>
	<lastBuildDate>Wed, 25 Jul 2018 10:51:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.4</generator>
<site xmlns="com-wordpress:feed-additions:1">42777727</site>	<item>
		<title>Create new STM32 project in Keil uVision 5 tutorial</title>
		<link>https://www.ocfreaks.com/create-new-stm32-project-keil-uvision-5-tutorial/</link>
					<comments>https://www.ocfreaks.com/create-new-stm32-project-keil-uvision-5-tutorial/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Umang Gajera]]></dc:creator>
		<pubDate>Wed, 25 Jul 2018 10:51:26 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[stm32]]></category>
		<category><![CDATA[tutorial]]></category>
		<guid isPermaLink="false">http://www.ocfreaks.com/?p=3103</guid>

					<description><![CDATA[<p>In this tutorial we see how to create project in KEIL MDK uVision 5 for STM32 ARM Cortex-M based MCUs. Its for beginners  who want to get started in programming STM32 with Keil. This tutorial also applies for all supported devices across the STM32 Family.</p>
<p>The post <a href="https://www.ocfreaks.com/create-new-stm32-project-keil-uvision-5-tutorial/">Create new STM32 project in Keil uVision 5 tutorial</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/common/keil_5_title.png" class="aligncenter" alt="" width="445px" height="227px" /></p>
<p>In this tutorial we see how to create project in KEIL MDK uVision 5 for STM32 ARM Cortex-M based MCUs. Its for beginners who want to get started in programming STM32 with Keil. This tutorial also applies for all supported devices across the STM32 Family viz. STM32F0/F1/F2/F4/F7/etc/. Keil uV 5 is much different than older Keil uV4. uVision 5 has integrated pack installer which is used to install specific MCU family packs and other libraries. To create project for STM32 MCU, you will first need to install <strong>MDK5 software packs</strong> for your microcontroller family. Either you can download it separately or do it from within the IDE.I recommend adding software packs using IDE.</p>
<p>Basically three(or more?) types of STM32 Keil projects can be created:</p>
<ol>
<li>One that uses CMSIS(core) only.</li>
<li>One that is based on Standard Peripheral Library.</li>
<li>Finally, one that is based on HAL (Hardware abstraction Layer) Library.</li>
</ol>
<p>For the sake of this tutorial we will see how to create CMSIS and SPL based STM32F103C8 Keil uv5 project, as an example, but will work exactly the same for STM32F0, STM32F4, and other families. I will cover HAL based projects in another tutorial. </p>
<h2 class="shead">1) Installing prerequisite STM32 Keil software pack</h2>
<p><strong>If already installed, you can SKIP this.</strong></p>
<p><strong>Step A.</strong> Download latest Keil MDK uVision5 from <a href="https://www.keil.com/demo/eval/arm.htm" target="_blank">Keil&#8217;s website</a>.</p>
<p><strong>Step B.</strong> Install Keil uVision 5 to default path.</p>
<p><strong>STEP C.</strong> Open Keil 5 and click on <span class="doc_ref">&#8220;Pack Installer&#8221;</span> icon as shown below:</p>
<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/common/keil5_pack_installer.png" class="aligncenter" alt="" width="687px" height="179px" /></p>
<p><strong>STEP D.</strong> On the left half on the window, under <span class="doc_ref">&#8220;Devices&#8221;</span> type <span class="doc_ref">&#8220;STM3F103C8&#8221;</span><br />
(<strong>or</strong> other device name depending on the device present on your development board) in search box and select the MCU in the list below. Now, on the right half of the window click on the <span class="doc_ref">&#8220;install&#8221;</span> button which is towards to the right of <span class="doc_ref">&#8220;Keil:STM32F1xxx_DFP&#8221;</span> and <span class="doc_ref">&#8220;Keil:STM32NUCLEO_B&#8221;</span>. Repeat this step if want to add support for other device family. After this, wait until pack installer finishes downloading the required pack files for selected MCU.</p>
<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/stm32_keil_uv5_project_cmsis_spl/c_install_stm32_dfp.png" class="aligncenter" alt="keil install software pack for STM32" width="691px" height="447px" /></p>
<p>Alternatively, you can manually download the software pack and install it directly from <a href="https://www.keil.com/dd2/pack/">MDK5 Software Packs</a>. It will be present Under <span class="doc_ref">&#8220;KEIL-> STMicroelectronics STM32F1 Series Device Support, Drivers&#8221;</span>. In general for STM32Fx Devices.</p>
<p><strong>STEP E.</strong> After installing from Pack Installer you will get a confirmation to reload packs. Click <span class="doc_ref">&#8220;Yes&#8221;</span> as shown below:</p>
<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/common/keil5_pack_install_confirm.png" class="aligncenter" alt="" width="322px" height="165px" /></p>
<h2 class="shead">2) Step by step Tutorial</h2>
<p>Okay, so now we have the necessary packs installed to create our first STM32 project in Keil 5. Just follow the steps mentioned below to create a new project in Keil uV 5 or if your project is not working properly:</p>
<h4>Step 1.</h4>
<p>Open the Keil IDE, under main menu goto <span class="doc_ref">&#8220;Project->New uVision Project&#8230;&#8221;</span> and a window prompt will open asking to save the new project. Type your desired project name and save.</p>
<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/common/keil5_new_project.png" class="aligncenter" alt="new project" width="513px" height="141px" /></p>
<h4>Step 2.</h4>
<p>After that, a new window will appear as shown below. Make sure <span class="doc_ref">&#8220;Software Packs&#8221;</span> is selected for the 1st drop down. In the search box below it, type <span class="doc_ref">&#8220;STM32F103C8&#8221;</span> and then select the device from list below. For e.g.: STM32F103C8 for STM32 Blue Pill, STM32F103RB for Nucleo-F103RB, STM32F030R8 for Nucleo-F030R8 and so on.</p>
<p>Finally click <span class="doc_ref">&#8220;OK&#8221;</span>. </p>
<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/stm32_keil_uv5_project_cmsis_spl/3_select_stm32_mcu.png" class="aligncenter" alt="select STM32 target MCU" width="626px" height="468px" /></p>
<h4>Step 3.</h4>
<p><strong>A. For CMSIS: </strong><br />
Inside the <span class="doc_ref">&#8220;Manage Run-Time Environment Window&#8221;</span> select the check boxes for <span class="doc_ref">&#8220;CORE&#8221;</span> under <span class="doc_ref">&#8220;CMSIS&#8221;</span> and <span class="doc_ref">&#8220;Startup&#8221;</span> under <span class="doc_ref">&#8220;Device&#8221;</span>. If you want to select any other libraries you can do so by selecting the respective checkboxes. Selecting <span class="doc_ref">&#8220;Startup&#8221;</span> will automatically add all the necessary startup/boot files required for STM32F1xx device, so we don&#8217;t have to import them from external sources. The selection of libraries can be changed any time later.</p>
<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/stm32_keil_uv5_project_cmsis_spl/4_stm32_cmsis_startup.png" class="aligncenter" alt="Select libraries" width="560px" height="549px" /></p>
<p><strong>B. For Standard Peripheral Library (SPL):</strong><br />
If you want to use SPL, the select the required peripheral library components as required. Note that some components have dependencies as well, so you will also need to include dependent components. For. E.g. GPIO needs RCC to enable clocks. </p>
<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/stm32_keil_uv5_project_cmsis_spl/4b_stm32_spl.png" class="aligncenter" alt="Select components for SPL" width="560px" height="603px" /></p>
<h4>Step 4.</h4>
<p>Now click on <span class="doc_ref">&#8220;Options for Target&#8221;</span> button as shown below:</p>
<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/stm32_keil_uv5_project_cmsis_spl/5_target_options_stm32.png" class="aligncenter" alt="Keil Options for Target" width="540px" height="196px" /></p>
<p>Make sure the settings match as shown below.</p>
<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/stm32_keil_uv5_project_cmsis_spl/6_setting_stm32.png" class="aligncenter" alt="Target settings" width="626px" height="468px" /></p>
<h4>Step 5.</h4>
<p>Now, click on the <span class="doc_ref">&#8220;Output&#8221;</span> tab. If you want to generate hex file then you can check <span class="doc_ref">&#8220;Create HEX File&#8221;</span>. You also enter a suitable name for the executable output file.</p>
<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/stm32_keil_uv5_project_cmsis_spl/7_output_hex_file.png" class="aligncenter" alt="Create Hex File" width="580px" height="282px" /></p>
<h4>Step 6.</h4>
<p>Then click on the <span class="doc_ref">&#8220;Linker&#8221;</span> tab and Under that tab check the checkbox option which says <span class="doc_ref">&#8220;Use Memory Layout from Target Dialog&#8221;</span>.</p>
<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/common/keil5_linker_options.png" class="aligncenter" alt="keil linker options" width="626px" height="268px" /></p>
<h4>Step 7.</h4>
<p>Now, under the <span class="doc_ref">&#8220;Debug&#8221;</span> tab, select ST-LINK as debugger since its the most common for debugging and programming STM32. Finally to click <span class="doc_ref">&#8220;OK&#8221;</span> to apply settings and close window.</p>
<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/stm32_keil_uv5_project_cmsis_spl/8_select_debugger.png" class="aligncenter" alt="STM32 Keil uv5 Debug options" width="626px" height="468px" /></p>
<h4>Step 8.</h4>
<p>Now, in the source navigation pane on the left area, right click on <span class="doc_ref">&#8220;Source Group 1&#8221;</span> and select <span class="doc_ref">&#8220;Add New Item to Group &#8216;Source Group 1&#8242;&#8221;</span>.</p>
<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/stm32_keil_uv5_project_cmsis_spl/9_add_files.png" class="aligncenter" alt="add new item to source" width="517px" height="370px" /></p>
<h4>Step 9.</h4>
<p>A new window will pop-up to add an item as shown below. Select <span class="doc_ref">&#8220;C File (.c)&#8221;</span> or C++ File (.cpp) , then enter the name of the file in the text box to the right of <span class="doc_ref">&#8220;Name:&#8221;</span> and click <span class="doc_ref">&#8220;Add&#8221;</span>.</p>
<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/stm32_keil_uv5_project_cmsis_spl/10.png" class="aligncenter" alt="add files to keil project" width="460px" height="435px" /></p>
<h4>Step 10.</h4>
<p>Now you can write your code in the editor. To compile your program Press <span class="doc_ref">&#8220;F7&#8221;</span> key or in the main menu goto <span class="doc_ref">&#8220;Project->Build Target&#8221;.</span> To check for any compilation errors you can have a look at the build output at the bottom of main window. Two screenshots of the Keil MDK uVision 5 are given below. </p>
<p><strong>A. For CMSIS Core Project:</strong><br />
<img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/stm32_keil_uv5_project_cmsis_spl/12a_compile_cmsis_only.png" class="aligncenter" alt="Keil uv5 screenshot STM32 CMSIS" width="688px" height="549px" /> </p>
<p><strong>B. For Standard Peripheral Library based Project</strong>:</p>
<p><img decoding="async" src="https://www.ocfreaks.com/imgs/embedded/stm32_keil_uv5_project_cmsis_spl/12b_compile_spl.png" class="aligncenter" alt="Keil uv5 screenshot STM32 SPL" width="690px" height="550px" /> </p>
<p>The post <a href="https://www.ocfreaks.com/create-new-stm32-project-keil-uvision-5-tutorial/">Create new STM32 project in Keil uVision 5 tutorial</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ocfreaks.com/create-new-stm32-project-keil-uvision-5-tutorial/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3103</post-id>	</item>
		<item>
		<title>Interrupt Priority Grouping in ARM Cortex-M NVIC</title>
		<link>https://www.ocfreaks.com/interrupt-priority-grouping-arm-cortex-m-nvic/</link>
					<comments>https://www.ocfreaks.com/interrupt-priority-grouping-arm-cortex-m-nvic/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Umang Gajera]]></dc:creator>
		<pubDate>Tue, 03 Oct 2017 18:13:47 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[tutorial]]></category>
		<guid isPermaLink="false">http://www.ocfreaks.com/?p=2918</guid>

					<description><![CDATA[<p>Microcontrollers based on ARM Cortex-M processor feature Nested Vectored Interrupt Controller or NVIC for handling interrupts. NVIC in ARM Cortex-M3 (ARMv7-M) implements fixed 8-bit priority fields in Interrupt Priority Register (IPR), thereby giving us up to 256(28) priority levels. But, not all of the ARM Microcontrollers implement 8 bits for priority levels, in which case [&#8230;]</p>
<p>The post <a href="https://www.ocfreaks.com/interrupt-priority-grouping-arm-cortex-m-nvic/">Interrupt Priority Grouping in ARM Cortex-M NVIC</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Microcontrollers based on ARM Cortex-M processor feature Nested Vectored Interrupt Controller or <strong>NVIC</strong> for handling interrupts. NVIC in ARM Cortex-M3 (ARMv7-M) implements fixed 8-bit priority fields in <strong>Interrupt Priority Register</strong> (<span class="doc_ref">IPR</span>), thereby giving us up to 256(2<sup>8</sup>) priority levels. But, not all of the ARM Microcontrollers implement 8 bits for priority levels, in which case the remaining priority bits are treated as Zeros because the field size is fixed to 8 bits. The un-implemented bits are LSb aligned. Generally the implemented bits are in proportion with number of external(peripheral) interrupts a given microcontroller supports. These priority fields are stored in the Interrupt Priority Register. Each priority register is 32-bits wide and holds 4 priority fields. This is as shown below:</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/common/interrupt_priority_fields_arm.png" alt="Interrupt Priority Fields in IPRs of ARM Cortex-M3 NVIC" width="535px" height="255px" /></p>
<p style="margin-bottom:0px">Here, <span class="code_var">IRPn</span> represents <strong><em>n</em></strong>th Interrupt Priority Register. <span class="code_var">PRI_m</span> is the Priority field for Interrupt <strong><em>m</em></strong> (<strong>IRQm</strong>).</p>
<ul>
<li>The IPR number <strong>n</strong> for Interrupt <strong>m</strong> is the Quotient of &#8220;<strong>m/4</strong>&#8221; i.e. <span class="code_var">n = (int)m/4 = m DIV 4</span></li>
<li>The byte offset is the remainder of &#8220;<strong>m/4</strong>&#8221; i.e. <span class="code_var">offset = m % 4 = m MOD 4</span></li>
</ul>
<p style="margin-bottom:0px">In Cortex-M3, each of these fields can be further sub-divided into <strong>two parts</strong>, which are:</p>
<ul>
<li><strong>Preemption Priority or Group Priority level:</strong> This is upper part(sub-field) of the 8-bit priority field. This is the main priority level which defines the preemption of interrupt exceptions or IRQs. An Interrupt will preempt the execution of the current Interrupt, if its Group Priority is higher than the Interrupt being currently serviced. Lower priority values denote higher priority &#038; vice-versa.</li>
<li><strong>Sub-Priority Level:</strong> This comes into picture when there are multiple pending interrupts having same preemption or Group Priority. In this case the sub-priority will determine which Interrupt gets executed first. Also note that, if pending ISRs have same Group and Sub-Group priority then the Interrupt having the lowest IRQ number will be executed first.</li>
</ul>
<p>Cortex-M0 Processor only implements 2 bits in the priority field [7:6] and rest bits [5:0] are always treated as Zeros, thereby supporting only 4 unique priority levels. This implementation is fixed for all MCUs which use Cortex-M0 (ARMv6-M) CPU. It also doesn&#8217;t implement Interrupt Priority Grouping.</p>
<h2 class="shead">Interrupt Priority Groups in ARM Cortex-M3</h2>
<p>Based on the sub-divisions, priority groups are formed depending on how many bits are used for preemption and sub-priority levels. The master table which assigns a Priority Grouping Number for each of the 8 possible divisions is shown below:</p>
<table class="aligncenter" style="margin-bottom:15px">
<tr>
<th>Priority Grouping Number</th>
<th>Split Point</th>
<th>Group Priority Bits (x)</th>
<th>Sub Priority Bits (y)</th>
<th>Total Group Priorities</th>
<th>Total Sub Priorities</th>
</tr>
<tr style="text-align:center">
<td>0</td>
<td>[xxxxxxx.y]</td>
<td>[7:1]</td>
<td>[0]</td>
<td>128</td>
<td>2</td>
</tr>
<tr style="text-align:center">
<td>1</td>
<td>[xxxxxx.yy]</td>
<td>[7:2]</td>
<td>[1:0]</td>
<td>64</td>
<td>4</td>
</tr>
<tr style="text-align:center">
<td>2</td>
<td>[xxxxx.yyy]</td>
<td>[7:3]</td>
<td>[2:0]</td>
<td>32</td>
<td>8</td>
</tr>
<tr style="text-align:center">
<td>3</td>
<td>[xxxx.yyyy]</td>
<td>[7:4]</td>
<td>[3:0]</td>
<td>16</td>
<td>16</td>
</tr>
<tr style="text-align:center">
<td>4</td>
<td>[xxx.yyyyy]</td>
<td>[7:5]</td>
<td>[4:0]</td>
<td>8</td>
<td>32</td>
</tr>
<tr style="text-align:center">
<td>5</td>
<td>[xx.yyyyyy]</td>
<td>[7:6]</td>
<td>[5:0]</td>
<td>4</td>
<td>64</td>
</tr>
<tr style="text-align:center">
<td>6</td>
<td>[x.yyyyyyy]</td>
<td>[7]</td>
<td>[6:0]</td>
<td>2</td>
<td>128</td>
</tr>
<tr style="text-align:center">
<td>7</td>
<td>[.yyyyyyyy]</td>
<td>N/A</td>
<td>[7:0]</td>
<td>1</td>
<td>256</td>
</tr>
</table>
<div class="special sp_blue notestar">Note: The split point or the Binary point denotes the segregation of Interrupt Priority Field (in <strong>IPR</strong>) into Group-Priority bits denoted by &#8216;<strong>x</strong>&#8216; and Sub-Priority bits denoted by &#8216;<strong>y</strong>&#8216;.</div>
<p>This Priority Grouping is common for all ARM Cortex-M3 processor based microcontrollers. Any of the 8 possible grouping can be selected using the <span class="code_var">PRIGROUP</span> field (bits[10:8]) of the <span class="doc_ref">AIRCR</span> (Application Interrupt and Reset Control Register). The Priority Grouping Number value shown in the table is assigned to the <strong>PRIGROUP</strong> field of <span class="doc_ref">AIRCR</span>.</p>
<p>For MCUs which implement less than 8 bits, the non-implemented bits are treated as Zeros in the table above. For example LPC17xx devices (like LPC1768/LPC1769) implement only 5 bits for Priority. The remaining(lower) 3 bits are treated as Zeros. This is shown below:</p>
<h4>LPC176x Interrupt Priority Grouping</h4>
<table class="aligncenter" style="margin-bottom:20px">
<tr>
<th>Priority Grouping Number</th>
<th>Split Point</th>
<th>Group Priority Bits (x)</th>
<th>Sub Priority Bits (y)</th>
<th>Total Group Priorities</th>
<th>Total SubGroup Priorities</th>
</tr>
<tr style="text-align:center">
<td>0,1,2</td>
<td>[xxxxx.000]</td>
<td>[7:3]</td>
<td>N/A</td>
<td>32</td>
<td>1</td>
</tr>
<tr style="text-align:center">
<td>3</td>
<td>[xxxx.y000]</td>
<td>[7:4]</td>
<td>[3]</td>
<td>16</td>
<td>2</td>
</tr>
<tr style="text-align:center">
<td>4</td>
<td>[xxx.yy000]</td>
<td>[7:5]</td>
<td>[4:3]</td>
<td>8</td>
<td>4</td>
</tr>
<tr style="text-align:center">
<td>5</td>
<td>[xx.yyy000]</td>
<td>[7:6]</td>
<td>[5:3]</td>
<td>4</td>
<td>8</td>
</tr>
<tr style="text-align:center">
<td>6</td>
<td>[x.yyyy000]</td>
<td>[7]</td>
<td>[6:3]</td>
<td>2</td>
<td>16</td>
</tr>
<tr style="text-align:center">
<td>7</td>
<td>[.yyyyy000]</td>
<td>N/A</td>
<td>[7:3]</td>
<td>1</td>
<td>32</td>
</tr>
</table>
<p>An Example with Priority Grouping of 5 on LPC17xx Devices which implement 5 bits for Priority is as follows:</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/common/priority_grouping_arm_cortex_m.png"  alt="Priority Grouping in ARM Cortex-M3 NVIC" width="535px" height="340px" /></p>
<h4>STM32 (STM32F10xxx) Interrupt Priority Grouping</h4>
<p>Priority Grouping for other Cortex-M3 MCUs from the STM32 family like STM32F103, etc.. which implement only 4 bits of interrupt priority is given below. </p>
<table class="aligncenter" style="margin-bottom:20px">
<tr>
<th>Priority Grouping Number</th>
<th>Split Point</th>
<th>Group Priority Bits (x)</th>
<th>Sub Priority Bits (y)</th>
<th>Total Group Priorities</th>
<th>Total SubGroup Priorities</th>
</tr>
<tr style="text-align:center">
<td>0,1,2,3</td>
<td>[xxxx.0000]</td>
<td>[7:4]</td>
<td>N/A</td>
<td>16</td>
<td>1</td>
</tr>
<tr style="text-align:center">
<td>4</td>
<td>[xxx.y0000]</td>
<td>[7:5]</td>
<td>[4]</td>
<td>8</td>
<td>2</td>
</tr>
<tr style="text-align:center">
<td>5</td>
<td>[xx.yy0000]</td>
<td>[7:6]</td>
<td>[5:4]</td>
<td>4</td>
<td>4</td>
</tr>
<tr style="text-align:center">
<td>6</td>
<td>[x.yyy0000]</td>
<td>[7]</td>
<td>[6:4]</td>
<td>2</td>
<td>8</td>
</tr>
<tr style="text-align:center">
<td>7</td>
<td>[.yyyy0000]</td>
<td>N/A</td>
<td>[7:4]</td>
<td>N/A</td>
<td>16</td>
</tr>
</table>
<p>Similarly we can get the Priority Grouping table for LPC13xx devices like LPC1343/LPC1347 using the master table. Note that LPC134x MCUs implement only 3 bits of Priority hence can give 8 unique priority levels.</p>
<p>PRIGROUP can get a bit confusing since the unimplemented bits are towards the LSb i.e. in the lower half starting from bit location 0. But thankfully all of this hassle is handled by the CMSIS library.</p>
<h2 class="shead">Assigning/Programming Priority Levels using CMSIS</h2>
<p>The CMSIS NVIC functions defined in <span class="code_var">core_cm3.h</span> header defines standard interfaces for Configuring and Assigning Interrupt Priority levels which are listed below. These functions take care of aligning the priority bits as required, if the number of implemented bits are less than 8. First lets see the declarations of these functions.</p>
<pre><code class="language-cpp">
void NVIC_SetPriorityGrouping(uint32_t PriorityGroup);

uint32_t NVIC_GetPriorityGrouping(void);

uint32_t NVIC_EncodePriority(uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority);

void NVIC_DecodePriority(uint32_t Priority, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority);

void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority);

uint32_t NVIC_GetPriority(IRQn_Type IRQn);
</code></pre>
<ul>
<li><strong><span class="code_var">NVIC_SetPriorityGrouping()</span>:</strong> This function is used to select the Priority Grouping. The parameter PriorityGroup is the Priority Grouping Number as given the Tables above. This function changes the <strong>PRIGROUP</strong> bits[10:8] of <span class="doc_ref">AIRCR</span>(Application Interrupt &#038; Reset Control Register) register which defines how the Priority Fields in <strong>IPRs</strong> are split.</li>
<li><strong><span class="code_var">NVIC_GetPriorityGrouping()</span>:</strong> It returns the Priority Grouping(0 to 7) currently selected.</li>
<li><strong><span class="code_var">NVIC_EncodePriority(..)</span>:</strong> This function will return &#8220;encoded&#8221; Priority Field for given a Priority Grouping(0 to 7), Preempt Priority and Sub-Priority. This function automatically takes care of un-implemented bits. The value returned by this function can be directly assigned to required Priority field in <span class="doc_ref">IPRn</span> using <span class="code_var">NVIC_SetPriority(..)</span>.</li>
<li><strong><span class="code_var">NVIC_DecodePriority(..)</span>:</strong> This function will &#8220;decode&#8221; the Priority Field into Pre-empt Priority and Sub-Priority for a given Priority Grouping(0 to 7).</li>
<li><strong><span class="code_var">NVIC_SetPriority(..)</span>:</strong> As the name suggestes, it is used to assign a priority for given Interrupt source. Note that the parameter <span class="code_var">priority</span> must be in accordance with Priority Grouping selected, hence <span class="code_var">NVIC_EncodePriority()</span> must be used to encode priority before calling this function.</li>
<li><strong><span class="code_var">NVIC_GetPriority(..)</span>:</strong> Returns the priority value for given IRQ.</li>
</ul>
<div class="special sp_cyan notewarning">Functions <span class="code_var">NVIC_SetPriorityGrouping()</span>, <span class="code_var">NVIC_GetPriorityGrouping()</span>, <span class="code_var">NVIC_EncodePriority(..)</span> &#038; <span class="code_var">NVIC_DecodePriority(..)</span> are not applicable for <strong>Cortex-M0</strong> since it does not implement Priority Groups. </div>
<p>C/C++ Example 1:</p>
<pre><code class="language-cpp">
#include &lt;lpc17xx.h&gt;

int main(void)
{
	unsigned int priority = 0;
	
	NVIC_SetPriorityGrouping(4); 
	/* bits[7:5] used for Group Priority
	   bits[4:3] used for Sub-Group Priority */
	
	priority = NVIC_EncodePriority(4,2,0);
	/*4= Priority Grouping, 2= Group Priority, 0= Sub-Priority*/

	NVIC_SetPriority(TIMER0_IRQn,priority); //Set new Priority
	
	while(1)
	{
		/*Code.*/
	}
	
	//return 0;
}
</code></pre>
<p>C/C++ Example 2:</p>
<pre><code class="language-cpp">
#include &lt;lpc17xx.h&gt;
#define NUM_IRQn 35 //Total number of peripheral interrupts
#define PRIGROUP_4 4
#define DEFAULT_GROUP_PRI 7
#define DEFAULT_SUB_PRI 3
#define TIMER2_GROUP_PRI 2
#define TIMER2_SUB_PRI 0

int main(void)
{
	unsigned int priority = 0, priGroup = 0;
	
	NVIC_SetPriorityGrouping(PRIGROUP_4); 
	/* bits[7:5] used for Group Priority
	   bits[4:3] used for Sub-Group Priority */
	
	priGroup = NVIC_GetPriorityGrouping();
	
	priority = NVIC_EncodePriority(priGroup, //=4
							DEFAULT_GROUP_PRI, //=7, Preempt/Group Priority
							DEFAULT_SUB_PRI); //=3, SubPriority within Group
	
	for(int currIRQ = 0; currIRQ < NUM_IRQn; currIRQ++ )
	{
		NVIC_SetPriority(currIRQ, priority); //Set new default Priorities for all peripheral IRQs
	}
	
	priority = NVIC_EncodePriority(priGroup, //=4
							TIMER2_GROUP_PRI, //=2, Preempt/Group Priority
							TIMER2_SUB_PRI); //=0, SubPriority within Group
	
	NVIC_SetPriority(TIMER2_IRQn, priority); //Set new higher priority for TIMER2 IRQ	
	
	while(1)
	{
		/*Code.*/
	}
	
	//return 0;
}
</code></pre>
<h2 class="shead">Exception Mask Registers</h2>
<p>ARM Cortex-M3 implements three Exception Mask Registers which are used to disable the execution of certain group or type of Interrupts/Exceptions where they can impact the performance of time critical tasks. This is more useful for applications having real time constraints, where the system has to gurantee completion of certain tasks within required time-frame. These registers can be only accessed via <strong>core register access functions</strong> provided by <strong>CMSIS</strong> which are defined in <span class="code_var">core_cmFunc.h</span>.</p>
<h4>PRIMASK - Priority Mask Register</h4>
<p><span class="doc_ref">PRIMASK</span> register is used to disable interrupts which have configurable priority i.e. External/Peripheral Interrupts when bit[0] in this register is set to 1. When set to 0 this register won't have any effect on interrupts. Rest of the bits[31:1] are reserved.</p>
<p>CMSIS provides 2 functions to access this register viz:<br />
<strong></p>
<ul>
<li><span class="code_var">void __set_PRIMASK(uint32_t priMask)</span></li>
<li><span class="code_var">uint32_t __get_PRIMASK(void)</span></li>
</ul>
<p></strong></p>
<h4>FAULTMASK - FAULT Mask Register</h4>
<p><span class="doc_ref">FAULTMASK</span> register is used to disable all interrupts execpt Non-Maskable Interrupt(NMI) when bit[0] in this register is set to 1. When set to 0 this register won't have any effect on interrupts. Rest of the bits[31:1] are reserved.</p>
<p>CMSIS provides 2 functions to access FAULTMASK register viz:<br />
<strong></p>
<ul>
<li><span class="code_var">void __set_FAULTMASK(uint32_t faultMask)</span></li>
<li>
<span class="code_var">uint32_t  __get_FAULTMASK(void)</span></li>
</ul>
<p></strong></p>
<h4>BASEPRI - Base Priority Mask Register</h4>
<p><span class="doc_ref">BASEPRI</span> register defines the minimum priority to service interrupts. Only Bits[7:0] are used. This 8-bit field is same as the priority field in IPRs. When a certain non-zero 8-bit priority value is set to this register, then it will disable all interrupts having same or lower priority than the value set. If this register is set to 0 then it won't have any effect. Note that this function doesn't shift the priority bits in case some bits are not implemented. The user is responsible for left shifiting the bits by <span class="code_var">(8 - __NVIC_PRIO_BITS)</span> where <span class="code_var">__NVIC_PRIO_BITS</span> is number of implemented priority bits which is defined in the device header file.</p>
<p>CMSIS provides 2 functions to access BASEPRI register viz:<br />
<strong></p>
<ul>
<li><span class="code_var">void __set_BASEPRI(uint32_t basePri)</span></li>
<li>
<span class="code_var">uint32_t  __get_BASEPRI(void)</span></li>
</ul>
<p></strong></p>
<h4>References and Further Reading:</h4>
<ol>
<li><a href="http://infocenter.arm.com/help/topic/com.arm.doc.dui0552a/DUI0552A_cortex_m3_dgug.pdf" target="_blank">ARM Cortex-M3 User Guide</a></li>
<li><a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.100165_0201_00_en/index.html" target="_blank">ARM Cortex-M3 Processor Technical Reference Manual</a></li>
<li><a href="http://infocenter.arm.com/help/topic/com.arm.doc.dui0497a/DUI0497A_cortex_m0_r0p0_generic_ug.pdf" target="_blank">ARM Cortex-M0 User Guide</a></li>
<li><a href="http://arm-software.github.io/CMSIS_5/Core/html/modules.html" target="_blank">CMSIS-Core v5 Documentation</a></li>
<li><a href="https://www.nxp.com/docs/en/user-guide/UM10360.pdf" target="_blank">LPC176x/5x User Manual</a></li>
<li><a href="http://www.st.com/resource/en/reference_manual/cd00171190.pdf" target="_blank">STM32F10x User Manual</a></li>
<li><a href="https://www.nxp.com/docs/en/user-guide/UM10375.pdf" target="_blank">LPC13xx User Manual</a></li>
</ol>
<p>The post <a href="https://www.ocfreaks.com/interrupt-priority-grouping-arm-cortex-m-nvic/">Interrupt Priority Grouping in ARM Cortex-M NVIC</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ocfreaks.com/interrupt-priority-grouping-arm-cortex-m-nvic/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2918</post-id>	</item>
		<item>
		<title>Tutorial on Using MCUXpresso to create Cortex-M projects with CMSIS</title>
		<link>https://www.ocfreaks.com/tutorial-using-mcuxpresso-create-cortex-m-project-cmsis/</link>
					<comments>https://www.ocfreaks.com/tutorial-using-mcuxpresso-create-cortex-m-project-cmsis/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Umang Gajera]]></dc:creator>
		<pubDate>Wed, 23 Aug 2017 16:51:06 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Guides & Tutorials]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[tutorial]]></category>
		<guid isPermaLink="false">http://www.ocfreaks.com/?p=2826</guid>

					<description><![CDATA[<p>After getting your Cortex-M development board now its time for getting started with MCUXpresso IDE. In this Step by Step tutorial we will go through how to create projects in MCUXpresso IDE for Cortex-M series Microcontrollers by NXP(Founded by Philips) based on CMSIS (Cortex Microcontroller Software Interface Standard). MCUXpresso is a derivative of LPCXpresso and [&#8230;]</p>
<p>The post <a href="https://www.ocfreaks.com/tutorial-using-mcuxpresso-create-cortex-m-project-cmsis/">Tutorial on Using MCUXpresso to create Cortex-M projects with CMSIS</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/title.png" height="251px" width="435px" /></p>
<p>After getting your Cortex-M development board now its time for getting started with MCUXpresso IDE. In this Step by Step tutorial we will go through how to create projects in MCUXpresso IDE for Cortex-M series Microcontrollers by NXP(Founded by Philips) based on <strong>CMSIS (Cortex Microcontroller Software Interface Standard)</strong>. MCUXpresso is a derivative of LPCXpresso and Kinetis Design Studio IDEs with combined support for LCP and Kinetis MCUs. The IDE comes with integrated <strong>arm-gcc</strong> compiler and all the necessary debug drivers like LPC-Link, etc.. to get started with rapid embedded systems application development using your Xpresso board. Both older and newer boards are supported.</p>
<p>This guide is applicable for NXP&#8217;s <strong>Cortex-M MCU</strong> families like LPC800(e.g. LPC81x), LPC1100(e.g. LPC111x), LPC1300(e.g. LPC134x), LPC1700(e.g. LPC176x), LPC4300, etc. After creating MCUXpresso projects with CMSIS, the IDE will automatically add all the necessary startup files(for initializing MCU), headers and a project source file(C/C++) depending on the settings we choose while creating project.</p>
<p><strong>Where to download the IDE from?</strong> You can download and install the IDE from the links given below:</p>
<ul>
<li><a href="http://www.nxp.com/products/developer-resources/run-time-software/mcuxpresso-software-and-tools/mcuxpresso-integrated-development-environment-ide-v10.0.2:MCUXpresso-IDE" target="_blank">MCUXpresso v10.0.2</a></li>
<li>You can always check the latest version @ <a href="http://www.nxp.com/products/developer-resources/run-time-software/mcuxpresso-software-and-tools:MCUXPRESSO" target="_blank">MCUXpresso Software and Tools for ARM® Cortex®-M cores </a></li>
</ul>
<p>After download, install from the setup file using default settings. During installation it will also install debug probe drivers which is also used to flash the code. Just click Yes/Next/Accept if its asks for driver install confirmation. By default the IDE will install to location &#8211; <span class="code_var">C:\NXP\MCUXpressoIDE_&lt;version&gt;\</span>. After install follow the steps below to create a new project. In this guide I have shown project creation using LPC1114/302 as target, as an example/demo. The steps will be same for other Cortex-M series MCUs like say LPC1769. I have provided workspace archives containing example projects for LPC812, LPC1114, LPC1343 and LPC1768/LPC1769. Download links are given towards the end of this tutorial.</p>
<h2 class="shead">Step by Step Tutorial</h2>
<p><strong>Step 1:</strong> When you start MCUXpresso, it will first ask for a path to create a workspace. A workspace is like a master directory with settings and can contain many individual projects, more like a general &#8220;Projects&#8221; folder. When prompted enter the path where you want to create your workspace:</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/2_workspace.png" height="279px" width="616px" /></p>
<hr width="90%"/>
<p><strong>Step 2:</strong> Now, the IDE will launch as shown below. Now click the on <span class="doc_ref">&#8220;New project&#8230;&#8221;</span> in the bottom right view of the IDE, under <span class="doc_ref">&#8220;Quickstart Panel&#8221;</span> tab:</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/3_mcuxpresso_window.png" height="503px" width="690px" /> </p>
<hr width="90%"/>
<p><strong>Step 3:</strong> A wizard to create a project will open. First we have to select the target MCU which we are using, from the MCU list which can be found under <span class="doc_ref">&#8220;Preinstalled MCUs&#8221;</span> as shown below:</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/4_target_mcu_selection.png" height="604px" width="695px" /> </p>
<hr width="90%"/>
<p><strong>Step 4:</strong> Next select <span class="doc_ref">&#8220;C++ Project&#8221;</span>:</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/5.png" height="402px" width="511px" /> </p>
<hr width="90%"/>
<p><strong>Step 5:</strong> Next enter a suitable name for your project. Make sure that the checkbox <span class="doc_ref">&#8220;Use default location&#8221;</span> is selected. This will create the project directory inside the workspace directory. Then click <span class="doc_ref">&#8220;Next&#8221;</span>:</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/6_project_name.png" height="353px" width="511px" /> </p>
<hr width="90%"/>
<p><strong>Step 6:</strong> Click on <span class="doc_ref">&#8220;Import&#8221;</span> so we can import the CMSIS files for our MCU:</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/7_cmsis_import.png" height="385px" width="569px" /> </p>
<p>A new <span class="doc_ref">&#8220;Import&#8230;&#8221;</span> window will appear. Click on <span class="doc_ref">&#8220;Browse&#8221;</span> under <span class="doc_ref">&#8220;Project archive (zip)&#8221;</span>. Then Select the required CMSIS library zip file for your MCU family. This can be found under <span class="code_var">&#8220;ide\Examples\Legacy\NXP\LPC1000&#8221;</span>(for LPC1000 MCUs) inside the MCUXpresso installation directory and click <span class="doc_ref">&#8220;Next&#8221;</span> as shown below:</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/step6a.png" height="1332px" width="599px" /></p>
<p>select the CMSIS_CORE project only if you won&#8217;t be using CMSIS_DSPLIB or you can select both Then click on <span class="doc_ref">&#8220;Finish&#8221;</span> as shown below:</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/11.png" height="394px" width="599px" /> </p>
<hr width="90%"/>
<p><strong>Step 7:</strong> Now under <span class="doc_ref">&#8220;CMSIS Core library&#8221;</span> select CMSIS_CORE_LPCxxxx for your MCU family and click Next. In the next screen, do the same for CMSIS_DSP library if you had selected it in step 6. Or select <span class="doc_ref">&#8220;none&#8221;</span> and click next.</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/step7a.png" height="788px" width="569px" /></p>
<div class="highlight">
<div class="special sp_red notewarning"><strong>Attention:</strong> After this stage, depending on your target MCU family MCUXpresso <strong>may ask</strong> for a few more debugging related options. <strong>For other MCUs these page(s) won&#8217;t appear.</strong></div>
<p><strong>Extra options specific for LPC8xx &#038; LPC11U6x/E6x Target MCUs (Ignore this for other MCUs).</strong> This option is used to enable or disable MTB (Micro Trace buffer) which provides a method to collect details about the instructions being executed. Even if you disable this, still a file named &#8220;mtb.c&#8221; will be created in your project which defines the array variable which is used as trace buffer &#8211; but the code will be not compiled since C/C++ Macro definitions will disable it. If you choose to enable it, you can change the buffer value any time in the IDE.<br />
<img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/step7b_mtb_options.png" height="415px" width ="533px" /> </p>
<p><strong>Extra options specific for LPC13xx, LPC15xx &#038; LPC541xx/546xx Target MCUs (Ignore this for other MCUs).</strong> This will is used to enable or disable SWO (Serial Wire Output) Trace used for capturing events occurring on MCU in real time. This is only support by LPC-LINK2 debug probe. So, if your board has LPC-LINK1 probe or any other debug probe you will have to disable this option. You can read more @ <a href="http://www.nxp.com/docs/en/quick-reference-guide/MCUXpresso_IDE_SWO_Trace.pdf" target="_blank">MCUXpresso IDE SWO Trace Guide</a><br />
<img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/step7c_swo_trace_options.png" height="329px" width ="536px" /> </div>
<p>On the next options page click <span class="doc_ref">&#8220;Finish&#8221;</span>:</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/14.png" height="497px" width="578px" /> </p>
<hr width="90%"/>
<p><strong>Step 8:</strong> The IDE will now create a project with the settings we selected as shown below. The name of the source file containing the <span class="code_var">main()</span> function will be <span class="code_var">&lt;Project-Name&gt;.cpp</span>. When you are ready with your program you can click <span class="doc_ref">&#8220;Build&#8221;</span> under <span class="doc_ref">&#8220;Quickstart Panel&#8221;</span> to compile.</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/15.png" height="663px" width="715px" /> </p>
<p>Finally, to start debugging(or Flashing compiled program) connect you Xpresso board to your computer and click on <span class="doc_ref">&#8220;Debug&#8221;</span> under <span class="doc_ref">&#8220;Quickstart Panel&#8221;</span>. This will start a debug session and a new pop-will appear to select your debugger(debug probe). It will automatically detect the debug probe. Just click <span class="doc_ref">&#8220;Next&#8221;</span>:</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/16.png" height="473px" width="511px" /> </p>
<p>Once the program is flashed on to the chip you can click on the resume(Green Triangular Play button) or F8 key to start debugging or code execution on the target MCU as shown below:</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/17_start_debugging.png" height="114px" width="545px" />   </p>
<p>To stop debug session click on the Terminate(red square) button or &#8220;Ctrl+F2&#8221;:</p>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/embedded/mcuxpresso_tutorial/18_stop_debugging.png" height="114px" width="595px" /></p>
<hr width="90%"/>
<h4> Download MCUXpresso Workspace containing example/demo project and CMSIS library as zip:</h4>
<ul>
<li><a href="https://www.ocfreaks.com/imgs/_downloads/embedded/MCUXpresso_CMSIS_lpc81x_WS.zip">lpc81x_WS.zip</a> &#8211; contains project for LPC812 as Target MCU</li>
<li><a href="https://www.ocfreaks.com/imgs/_downloads/embedded/MCUXpresso_CMSIS_lpc111x_WS.zip">lpc111x_WS.zip</a> &#8211; contains project for LPC1114/302 as Target MCU</li>
<li><a href="https://www.ocfreaks.com/imgs/_downloads/embedded/MCUXpresso_CMSIS_lpc134x_WS.zip">lpc134x_WS.zip</a> &#8211; contains project for LPC1343 as Target MCU</li>
<li><a href="https://www.ocfreaks.com/imgs/_downloads/embedded/MCUXpresso_CMSIS_lpc176x_WS.zip">lpc176x_WS.zip</a> &#8211; contains projects for LPC1769 &#038; LPC1768 as Target MCU</li>
</ul>
<div class="special sp_blue noteinfo"><strong>How use/import the zip archive? </strong></p>
<p>The zip files given above contains archive of workspace which includes the individual project and CMSIS library. Just unzip it a suitable location and open the location as workspace in MCUXpresso.<br />
<strong>=OR=</strong><br />
You can import the workspace zip as project from the IDE itself from <strong>&#8220;File->Open Projects from File System&#8230;&#8221;</strong> menu &#8211; note that contents of the zip will be imported as project into the existing workspace.</div>
<p><strong>Reference(s), further reading and Resources:</strong></p>
<ul>
<li><a href="http://www.nxp.com/docs/en/user-guide/MCUXpresso_IDE_User_Guide.pdf">MCUXpresso IDE User Guide</a></li>
<li><a href="http://www.nxp.com/products/developer-resources/run-time-software/mcuxpresso-software-and-tools:MCUXPRESSO">MCUXpresso Software and Tools for ARM® Cortex®-M cores </a></li>
<li><a href="https://developer.arm.com/embedded/cmsis">CMSIS Overview &#038; Components</a></li>
<li><a href="http://arm-software.github.io/CMSIS_5/Core/html/index.html">CMSIS-Core Documentation</a></li>
<li><a href="http://arm-software.github.io/CMSIS_5/DAP/html/index.html">CMSIS-DAP (Debug Access port) Documentation</a></li>
</ul>
<p>The post <a href="https://www.ocfreaks.com/tutorial-using-mcuxpresso-create-cortex-m-project-cmsis/">Tutorial on Using MCUXpresso to create Cortex-M projects with CMSIS</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ocfreaks.com/tutorial-using-mcuxpresso-create-cortex-m-project-cmsis/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2826</post-id>	</item>
		<item>
		<title>How to Compress Video Files without much Quality Loss using Handbrake</title>
		<link>https://www.ocfreaks.com/compress-video-files-without-much-quality-loss-using-handbrake/</link>
					<comments>https://www.ocfreaks.com/compress-video-files-without-much-quality-loss-using-handbrake/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Saby D'silva]]></dc:creator>
		<pubDate>Sun, 09 Jul 2017 14:19:39 +0000</pubDate>
				<category><![CDATA[Guides & Tutorials]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[video]]></category>
		<guid isPermaLink="false">http://www.ocfreaks.com/?p=2794</guid>

					<description><![CDATA[<p>In this step by step tutorial you will get acquainted with Handbrake, and how to use it to compress large videos without much quality loss. </p>
<p>The post <a href="https://www.ocfreaks.com/compress-video-files-without-much-quality-loss-using-handbrake/">How to Compress Video Files without much Quality Loss using Handbrake</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" class="aligncenter spaced" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/title.png" height="271px" width="400px" alt="Handbrake Smiley"></a></p>
<p class="compact">Hi folks. In this step-by-step tutorial, I will show you how to compress videos using the free open-source tool Handbrake. This can prove especially useful to those who want to store lots of videos in devices with a limited storage capacity. Storing uncompressed large video files on such a device isn&#8217;t logical and is IMHO, downright stupid. This tutorial will get you acquainted with Handbrake and how you can use it to reduce the file size of large videos in a few minutes. You can download Handbrake from <a href="https://handbrake.fr/" target="_blank">here</a>. The detailed explanation of all the settings used in this tutorial can be found in my other articles on Handbrake(Links given at the bottom). </p>
<p class="compact">Without further ado, lets get started:</p>
<h4>Step 1: Open Handbrake</h4>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/hbmain.png" height="408px" width="596px" alt="Handbrake Window"></p>
<h4> Step 2: Importing Source File(s) </h4>
<p> Import your video files to transcode by either dragging and dropping the file or clicking on &#8220;File&#8221; and navigating to the desired path. To batch encode all videos in a particular folder, click on &#8220;Folder&#8221; and navigate to the desired path. Select &#8220;MP4&#8221; container.</p>
<div class="ocf-img-carousel hide-pre-init" data-imgcar-mode ="2" data-alt-txt="Handbrake Import Files" >
<div class="aligncenter single-item">
<div class="img-slides"><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/hbdd.gif" alt="Handbrake Drag and Drop File" /><span class="desc slide">Handbrake Drag and Drop File</span></div>
<div class="img-slides"><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/hbfio.gif" alt="Handbrake File Open" /><span class="desc slide">Handbrake File Open</span></div>
<div class="img-slides"><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/hbfoo.gif" alt="Handbrake Folder Open" /><span class="desc slide">Handbrake Folder Open</span></div>
</div>
<ul class="thumbnails">
<li class="img-thumbs"><img decoding="async" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/hbdd.gif" /></li>
<li class="img-thumbs"><img decoding="async" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/hbfio.gif" /></li>
<li class="img-thumbs"><img decoding="async" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/hbfoo.gif" /></li>
</ul>
</div>
<div style="display: none">
<div class="compact image">
<a href="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/hbdd.gif" target="_blank"><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/hbdd.gif" height="408px" width="596px" alt="Handbrake Drag and Drop File"></a>
</div>
<div class="compact image">
<a href="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/hbfio.gif" target="_blank"><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/hbfio.gif" height="408px" width="596px" alt="Handbrake File Open"></a>
</div>
<div class="compact image">
<a href="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/hbfoo.gif" target="_blank"><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/hbfoo.gif" height="408px" width="596px" alt="Handbrake Folder Open"></a>
</div>
</div>
<h4>Step 3: Picture Settings </h4>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/1pic.png" height="378px" width="720px" alt="Handbrake Pictures Tab"><b>In the Picture tab: </b></p>
<ol class="dec">
<li>Select Anamorphic &#8220;Loose&#8221; and Modulus &#8220;2&#8221;.</li>
<li>Choose your desired Video Width. For mobile devices, I recommend a max resolution of 720p, which translates to a width of 1280 pixels for my input file (big_buck_bunny_1080p_h264.mp4).</li>
<li>Check Cropping &#8220;Custom&#8221; and make all values 0, if you don&#8217;t wish to crop your video. Or check &#8220;Automatic&#8221;, whichever works for you.</li>
</ol>
<h4>Step 4: Filter Settings </h4>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/2fil.png" height="378px" width="720px" alt="Handbrake Filters Tab"><b>In the Filters Tab:</b></p>
<ol class="dec">
<li>Select &#8220;NLMeans&#8221; Denoise with preset &#8220;Ultralight&#8221; and Tune &#8220;None&#8221;.</li>
</ol>
<h4>Step 5: Video Settings </h4>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/3vid.png" height="378px" width="720px" alt="Handbrake Video Tab"><b>In the Video Tab:</b></p>
<ol class="dec">
<li>Select Codec &#8220;x264&#8221;, Framerate &#8220;Same as Source&#8221; and check &#8220;Variable Framerate&#8221;.</li>
<li>Check &#8220;Constant Quality&#8221; and keep the RF Slider between 21-25, no more, no less. I recommend using 24 for mobile devices.</li>
<li>Keep Encoder Preset Slider to &#8220;Veryfast&#8221;, and select Encoder Tune &#8220;Film&#8221;, Encoder Profile &#8220;Main&#8221; and Encoder Level &#8220;4.0&#8221;.</li>
</ol>
<h4>Step 6: Audio Settings </h4>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/4aud.png" height="378px" width="720px" alt="Handbrake Audio Tab"><b>In the Audio Tab:</b></p>
<ol class="dec">
<li>Select Codec &#8220;AAC (avcodec)&#8221;, select &#8220;Bitrate&#8221; and keep it to 160 or lower for mobile devices.</li>
</ol>
<h4>Step 6: Adding Subtitles </h4>
<p><img decoding="async" class="aligncenter" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_step_by_step/5sub.png" height="378px" width="720px" alt="Handbrake Subtitles Tab"><b>In the Subtitles Tab:</b></p>
<ol class="dec">
<li>Add or remove Subtitles as per your wish.</li>
</ol>
<h4>Step 7: Finally, click on &#8220;Start Encode&#8221;</h4>
<p><b>Step 7.1 (Optional): Get some coffee while your CPU does all the heavy lifting and compresses your video files &#038; converts it to MP4 format!</b></p>
<p>For a more comprehensive, detailed and in-depth explanation of all the Handbrake settings, visit the following links:</p>
<ul>
<li><a href="https://www.ocfreaks.com/handbrake-complete-tutorial-part-1-transcode-compress-videos/" target="_blank">Handbrake Complete Tutorial Part 1: How to Transcode &#038; Compress Videos</a></li>
<li><a href="https://www.ocfreaks.com/beginners-guide-tutorial-video-redundancies/" target="_blank">Beginners Guide to Video Redundancies</a></li>
<li><a href="https://www.ocfreaks.com/handbrake-tutorial-part-2-x264-advanced-encoding-compression-settings-guide/" target="_blank">Handbrake Tutorial Part 2: x264 Advanced Encoding &#038; Compression Settings Guide</a></li>
</ul>
<p>The post <a href="https://www.ocfreaks.com/compress-video-files-without-much-quality-loss-using-handbrake/">How to Compress Video Files without much Quality Loss using Handbrake</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ocfreaks.com/compress-video-files-without-much-quality-loss-using-handbrake/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2794</post-id>	</item>
		<item>
		<title>Handbrake Tutorial Part 2: x264 Advanced Encoding &#038; Compression Settings Guide</title>
		<link>https://www.ocfreaks.com/handbrake-tutorial-part-2-x264-advanced-encoding-compression-settings-guide/</link>
					<comments>https://www.ocfreaks.com/handbrake-tutorial-part-2-x264-advanced-encoding-compression-settings-guide/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Saby D'silva]]></dc:creator>
		<pubDate>Thu, 02 Feb 2017 08:09:27 +0000</pubDate>
				<category><![CDATA[Guides & Tutorials]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[video]]></category>
		<guid isPermaLink="false">http://www.ocfreaks.com/?p=2586</guid>

					<description><![CDATA[<p>An in-depth Guide/Tutorial explaining all the x264 intricacies and advanced settings offered in handbrake advanced tab. The settings in this tab are for those who like to tweak and fine tune the encoder's settings for the video.</p>
<p>The post <a href="https://www.ocfreaks.com/handbrake-tutorial-part-2-x264-advanced-encoding-compression-settings-guide/">Handbrake Tutorial Part 2: x264 Advanced Encoding &#038; Compression Settings Guide</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="spaced tocpostimage">
<img decoding="async" class="aligncenter compact" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_part2_x264/hbx264.jpg" alt="x264 in Handbrake" height="256px" width="256px">
</div>
<p class="compact" style="clear: left; float:left">Some of you might find it odd that I made a separate post to talk about the settings in the Advanced tab of Handbrake. But rest assured, there’s a damn good reason why I chose to do so. The first tutorial was targeted at beginners. In essence, I’d say that the first tutorial was 80% handbrake and 20% some general info about videos and encoding. This tutorial would be about 20% Handbrake and 80% x264 video encoding and compression, as you need to know a fair bit about how x264 encodes video to completely understand the options in this tab.</p>
<div class="toc_container"><span class="toc_title">Table of Contents</span></p>
<div class="toc">
<ol class="toc_list">
<li class="toc_text"><a href="#x264_Video_Encoding" title="x264 Video Encoding"><span>1. </span><span>x264 Video Encoding</span></a></li>
<ol class="toc_list">
<li class="toc_text"><a href="#Eliminating_Redundancies" title="Eliminating Redundancies"><span>1.1. </span><span>Eliminating Redundancies</span></a></li>
<li class="toc_text"><a href="#Rate_Factor_vs_Quantization_Parameter" title="Rate Factor vs Quantization Parameter"><span>1.2. </span><span>Rate Factor vs Quantization Parameter</span></a></li>
</ol>
<li class="toc_text"><a href="#Advanced_Tab" title="Advanced Tab"><span>2. </span><span>Advanced Tab</span></a></li>
<ol class="toc_list">
<li class="toc_text"><a href="#Encoding" title="Encoding"><span>2.1. </span><span>Encoding</span></a></li>
<ol class="toc_list">
<li class="toc_text"><a href="#Reference_Frames" title="Reference Frames"><span>2.1.1. </span><span>Reference Frames</span></a></li>
<li class="toc_text"><a href="#Maximum_B_Frames" title="Maximum B Frames"><span>2.1.2. </span><span>Maximum B Frames</span></a></li>
<li class="toc_text"><a href="#Pyramidal_B_Frames" title="Pyramidal B Frames"><span>2.1.3. </span><span>Pyramidal B Frames</span></a></li>
<li class="toc_text"><a href="#Weighted_P_Frames" title="Weighted P Frames"><span>2.1.4. </span><span>Weighted P Frames</span></a></li>
<li class="toc_text"><a href="#8x8_Transform" title="8x8 Transform"><span>2.1.5. </span><span>8&#215;8 Transform</span></a></li>
<li class="toc_text"><a href="#CABAC" title="CABAC"><span>2.1.6. </span><span>CABAC</span></a></li>
</ol>
<li class="toc_text"><a href="#Analysis" title="Analysis"><span>2.2. </span><span>Analysis</span></a></li>
<ol class="toc_list">
<li class="toc_text"><a href="#Adaptive_B_Frames" title="Adaptive B Frames"><span>2.2.1. </span><span>Adaptive B Frames</span></a></li>
<li class="toc_text"><a href="#Adaptive_Direct_Mode" title="Adaptive Direct Mode"><span>2.2.2. </span><span>Adaptive Direct Mode</span></a></li>
<li class="toc_text"><a href="#Subpixel_Motion_Est(subme)" title="Subpixel Motion Est(subme)"><span>2.2.3. </span><span>Subpixel Motion Est(subme)</span></a></li>
<li class="toc_text"><a href="#Motion_Est_Method" title="Motion Est Method"><span>2.2.4. </span><span>Motion Est Method</span></a></li>
<li class="toc_text"><a href="#Motion_Est_Range(merange)" title="Motion Est Range(merange)"><span>2.2.5. </span><span>Motion Est Range(merange)</span></a></li>
<li class="toc_text"><a href="#Partition_Type" title="Partition Type"><span>2.2.6. </span><span>Partition Type</span></a></li>
<li class="toc_text"><a href="#Trellis" title="Trellis"><span>2.2.7. </span><span>Trellis</span></a></li>
</ol>
<li class="toc_text"><a href="#Psychovisual" title="Psychovisual"><span>2.3. </span><span>Psychovisual</span></a></li>
<ol class="toc_list">
<li class="toc_text"><a href="#No_DCT_Decimate" title="No DCT Decimate"><span>2.3.1. </span><span>No DCT Decimate</span></a></li>
<li class="toc_text"><a href="#Adaptive_Quant_Strength" title="Adaptive Quant Strength"><span>2.3.2. </span><span>Adaptive Quant Strength</span></a></li>
<li class="toc_text"><a href="#Psychovisual_Rate_Distortion" title="Psychovisual Rate Distortion"><span>2.3.3. </span><span>Psychovisual Rate Distortion</span></a></li>
<li class="toc_text"><a href="#Psychovisual_Trellis" title="Psychovisual Trellis"><span>2.3.4. </span><span>Psychovisual Trellis</span></a></li>
<li class="toc_text"><a href="#Deblocking" title="Deblocking"><span>2.3.5. </span><span>Deblocking</span></a></li>
</ol>
</ol>
<li class="toc_text"><a href="#Closing_Notes" title="Closing Notes"><span>3. </span><span>Closing Notes</span></a></li>
</ol>
</div>
</div>
<p class="compact">Before going any further, let me make this clear; most users won’t need to mess around with these settings. The settings in this tab are just for those few users who like to tweak and fine tune the encoder&#8217;s settings for the video. You can get a decent output without using this tab.</p>
<div class="special sp_blue notestar spaced">
<strong>Note:</strong> I highly recommend you to go through my article on<a href="https://www.ocfreaks.com/beginners-guide-tutorial-video-redundancies/" target="_blank"> Video Redundancies </a>. I&#8217;ve written it as a precursor to this tutorial.
</div>
<h2 class="shead" style="padding-top: 30px; margin-bottom: 20px;"><span id="x264_Video_Encoding">x264 Video Encoding</span></h2>
<p class="compact">x264 is, as of now, the most popular and widely regarded as the best video encoder out there. No other encoder comes close to it in terms of quality at a given bitrate, and it is compatible with most devices too. Let us see now what it is that makes this codec so good.</p>
<h3 class="msize" style="padding-top: 5px; text-decoration: underline"><span id="Eliminating_Redundancies">Eliminating Redundancies</span></h3>
<p class="compact">To those who dont know the various redundancies that exist in a video and why eliminating them is important, check out: <a href="https://www.ocfreaks.com/beginners-guide-tutorial-video-redundancies/" target="_blank"> Video Redundancies </a>.</p>
<p class="compact">To eliminate spatial and temporal redundancies, each <a href="https://www.ocfreaks.com/handbrake-complete-tutorial-part-1-transcode-compress-videos/#Modulus" target="_blank"><strong>macroblock</strong></a> in a frame is scanned first to identify the redundant information. These redundant information are then predicted by using various algorithms and are replaced by the <strong>&#8220;predicted</strong>&#8221; blocks, which ultimately results in a much smaller file size. Two kinds of prediction are used by x264 to predict the macroblocks in a frame:</p>
<div class="highlight spaced">
<ol class="emplist">
<li class="spaced"><b>Intra Frame Prediction:</b> Macroblocks are predicted by using previously encoded data in the <strong>current frame</strong>. This is used for eliminating <strong>spatial redundancies</strong>. A prediction for the current block is formed from the previously encoded neighbouring blocks.
</li>
<li>
<p class="nl"><b>Inter Frame Prediction:</b> Macroblocks are predicted by using previously encoded data in the <strong>neighbouring frames</strong>. This is used for eliminating <strong>temporal redundancies</strong>. It is also known as <strong>Motion Estimation</strong>. This prediction is done by scanning the corresponding block that is already encoded in the neighbouring frames. The similar blocks are considered to be the <strong>static</strong> part of the scene(the &#8220;background&#8221;), while the differing blocks are collectively considered to be the <strong>active</strong>(&#8220;moving&#8221;) part in the scene. The output is then, a video that is comprised of <strong>reference frames</strong>, which contains the static and active parts, and <strong>predicted frames</strong> which consists of the moving parts overlaid on the background to recreate the scene, frame by frame.</p>
<p class="compact">So basically, what happens here is that the static parts in the scene are copied as it is from the reference frame to the predicted frame. And for the active parts, a <strong>motion vector</strong> is calculated to change their position from that of the reference frame to that of the predicted frame. This process is called <strong>Motion Compensation</strong>. So, the predicted frame, in this sense, directly or indirectly depends on the reference frame, and would take up much less space than what it would if the entire frame was stored.</p>
</li>
</ol>
</div>
<p class="compact">H.264 standard defines 3 types of frames that can be used by the codec. These are:</p>
<div class="highlight spaced">
<ol class="emplist">
<li class="spaced"><b>I Frame:</b> I frame (Intra Frame) is nothing but the frame copied as it is from the source. It is completely independent of other frames in the video stream, and can be decoded without reference from the other frames. The frame is encoded by using only <strong>Intra Frame Prediction</strong>. The more the number of I frames in the video, the better the quality, but the lower the compression. I frames are used in H.264 in the start of the video file or in a rapid scene change.</li>
<li class="spaced"><b>P Frame:</b> P Frames(Predicted Frames) are frames that are dependent on previous I or P frames. These frames only hold the information about the moving part in the scene, by using <strong>Inter Frame Prediction</strong>. On an average, it can be said to contain about 50% the information contained on an I frame.</li>
<li><b>B Frame:</b> B Frames(Bidirectional Predicted Frames) are frames that are dependent on both previous as well as future I and P frames. These frames, similar to P frames, only hold the information about the moving part in the scene. On an average, it can be said to contain about 50% the information contained on a P frame.</li>
</ol>
</div>
<p class="compact">The way the encoder arranges these frames together is called <strong>GOP(Group Of Pictures)</strong>, starting with the I frame at the beginning. This, in turn is made up of <strong>mini GOPs</strong> beginning with a P/B frame.  Now, consider an I frame to be of size x, a P frame 0.5x, and B frame 0.25x. For the following GOPs:</p>
<p class="compact">IIII: Size=4x<br />
IPPP: Size=2.5x<br />
IBBP: Size=2x</p>
<p class="compact">The advantages of using predicted frames are quite evident from the above example.</p>
<div class="special sp_blue notestar spaced">
<b>Note:</b> As B frames need both previous and future frames as reference, the order of encoding for the third GOP in the above example would actually be: IPBB. After the I and P frames are encoded, the B frames would be encoded and put in between them. It should also be noted that many devices have a limitation on the maximum number of B frames that can be used(since decoding of B frames require a lot of computational power). Regardless of all these, the beginning of a GOP will always be signalled by an I frame.
</div>
<p class="compact">Once the predicted frames are formed (by either Intra or Inter prediction), each block in it is subtracted from the ones in the actual frame to form the <strong>residual block</strong>. These residual blocks are then transformed using either order 4 or order 8 <strong>integer transform</strong> to output a stream of coefficients for each block. The <strong>transformed coefficients</strong> are then <strong>quantized</strong>, ie, scaled by a value obtained from the <strong>Quantization Parameter</strong>(QP). The basic idea is to reduce the value of the coefficient as much as possible. The QP defines by what extent each block is to be compressed. Higher QP values mean more compression but lower quality, and lower values mean less compression but higher quality. The quantized blocks are then <strong>entropy coded</strong> to finally obtain the output video file. This is a form of lossless compression method that is done at the end, to eliminate the coding redundancies.</p>
<h3 class="msize" style="padding-top: 5px; text-decoration: underline"><span id="Rate_Factor_vs_Quantization_Parameter">Rate Factor vs Quantization Parameter</span></h3>
<p class="compact">One difference that you can observe when encoding videos (in Handbrake) using x264 in Constant Quality mode is that; while all other codecs will offer you a<strong> QP (Quantization Parameter)</strong> Slider, x264(and x265) will offer you an <strong>RF (Rate Factor)</strong> Slider. There is quite an inherent difference between the two.</p>
<p class="compact">Constant Quality encoding can be achieved by two ways:</p>
<div class="highlight spaced">
<ol class="emplist">
<li class="spaced">
<p class="nl"><b>Constant Quantization Parameter (CQP):</b> In this method, constant quality is achieved by compressing every frame of the same type by the same amount, ie, a constant QP is maintained for the entire video. So, if the QP slider is kept at 24, it will remain 24 for the entire video.</p>
<p class="compact">The QP slider scale is linear, and the output filesize would change linearly with the QP value.</p>
</li>
<li class="spaced">
<p class="nl"><b>Constant Rate Factor (CRF):</b> In this method, the QP is not kept constant throughout the video, but will be variable. Thus, different frames are compressed by different amounts, depending on the amount of detail and motion on the frame. CRF takes advantage of the simple fact that the eye perceives more detail in stationary objects than in moving objects. So, it applies more compression for fast motion scenes, and less compression for still scenes. Due to this, the output video will appear to be much more detailed. So, if the RF slider is kept at 24, then the QP might range from around 26-18.</p>
<p class="compact">The RF slider scale is <strong>logarithmic</strong>, and the output filesize would change <strong>exponentially</strong> with deviation of the RF value.</p>
</li>
</ol>
</div>
<p class="compact">So, which of these is better? Obviously CRF, as it can distribute bits in a much more efficient way than CQP.</p>
<h2 class="shead" style="padding-top: 30px; margin-bottom: 20px;"><span id="Advanced_Tab">Advanced Tab</span></h2>
<p class="compact">The settings within this tab are unlocked by checking the <strong><em>&#8220;Use Advanced Tab instead&#8221;</em></strong> option in the Video tab. These settings allow you to fine tune your video by adjusting the various conversion parameters of the x264 codec. This tab is further subdivided into three sections: <strong><em>Encoding</em></strong>, <strong><em>Analysis</em></strong>, and <strong><em>Psychovisual</em></strong>.</p>
<div class="spaced image">
<img decoding="async" class="aligncenter compact" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_part2_x264/handbrake_advanced_tab.jpg" alt="Handbrake Advanced Tab" /><br />
<i>Handbrake Advanced Tab</i>
</div>
<h3 class="msize" style="padding-top: 5px; text-decoration: underline"><span id="Encoding">Encoding</span></h3>
<p class="compact">The <strong><em>Encoding</em></strong> section deals with <strong>video compression</strong>. It offers various ways by which your video bitrate could be further reduced.</p>
<h4 class="psize il"><span id="Reference_Frames">Reference Frames: </span></h4>
<p class="il np">This setting specifies the maximum number of frames each P frame can use as a reference. The higher this value, the better the compression. But it must be noted that many devices have limitations on the maximum number of reference frames that can be used. So, unless your sure what this value is, keep it at default(3).</p>
<div class="vspacer_25px"></div>
<h4 class="psize il"><span id="Maximum_B_Frames">Maximum B frames: </span></h4>
<p class="il np">This setting allows you to set the maximum number of successive B frames that can be encoded, after which an I or P frame has to follow for reference.</p>
<div class="vspacer_25px"></div>
<h4 class="psize il"><span id="Pyramidal_B_Frames">Pyramidal B frames: </span></h4>
<p class="il nl">Enabling this setting allows the B frames to be used as reference for other B frames wherever possible, thereby increasing compression. Options of None, Normal and Strict are provided. </p>
<ul class="np">
<li><em>None</em>: B frames are not used as reference.</li>
<li><em>Strict</em>: One B frame per mini GOP can be used as reference</li>
<li><em>Normal</em>: Numerous B frames per mini GOP can be used as reference.</li>
</ul>
<h4 class="psize il"><span id="Weighted_P_Frames">Weighted P Frames: </span></h4>
<p class="il np">Enabling this option allows the encoder to detect fades in reference frames, and assign it a particular weight. If this is OFF, the encoder will be unable to see the similarity between frames in cases where a frame is simply lighter or darker from the previous frame, as the entire frame is changing. Turning this ON can improve compression in such cases.</p>
<div class="vspacer_25px"></div>
<h4 class="psize il"><span id="8x8_Transform">8&#215;8 Transform: </span></h4>
<p class="il np">Enabling this option allows the use of 8&#215;8 blocks, rather than the normal 16&#215;16 blocks, for prediction. This can improve compression by quite a lot(at least 5%).</p>
<div class="vspacer_25px"></div>
<h4 class="psize il"><span id="CABAC">CABAC: </span></h4>
<p class="il nl">After quantization, the data stream has to be encoded. x264 offers two methods to achieve this: <strong>CABAC(Context Adaptive Binary Arithmetic Coding)</strong> and <strong>CAVLC(Context Adaptive Variable Length Coding)</strong>. CABAC offers better compression, but requires more processing power to encode and decode than CAVLC. CAVLC, on the other hand, offers inferior compression, but requires less processing power to encode and decode than CABAC.</p>
<p class="np">To turn ON CABAC encoding, tick the &#8220;CABAC&#8221; checkbox. Unchecking it will use CAVLC encoding, by default.</p>
<div class="vspacer_25px"></div>
<h3 class="msize" style="padding-top: 5px; text-decoration: underline"><span id="Analysis">Analysis</span></h3>
<p class="compact">This section contains settings using which you can control how x264 analyzes the source video.</p>
<h4 class="psize il"><span id="Adaptive_B_Frames">Adaptive B frames: </span></h4>
<p class="il nl">Using the options in this setting, you can control how x264 makes the decision to use a B frame.</p>
<ul class="np">
<li><em>OFF</em>: B frames will be placed in a fixed pattern.</li>
<li><em>Fast</em>: x264 can decide how many B frames to use depending on the complexity of the scene, but the decisions made are suboptimal.</li>
<li><em>Optimal</em>: x264 makes an optimal decision on when B frames are to be used. When using a higher number of Maximum B frames with Pyramidal B Frames, it is recommended to use this setting.</li>
</ul>
<h4 class="psize il"><span id="Adaptive_Direct_Mode">Adaptive Direct Mode: </span></h4>
<p class="il nl">This setting specifies how motion vectors are calculated for each block. Calculating motion vectors for every block is a CPU intensive and time consuming process. x264 has a few tricks up it&#8217;s sleeve for this.</p>
<ul class="np">
<li><em>None</em>: Adaptive Direct Mode is disabled. Motion Vectors have to be calculated for each block.</li>
<li><em>Spatial</em>: Motion vectors from the neighbouring blocks are used for the current block. This can significantly reduce the encoding time.</li>
<li><em>Temporal</em>: The current block is compared with the matched block in a P frame within the GOP. Using this, the motion vector is estimated rather than calculating it for each block.</li>
<li><em>Automatic</em>: x264 automatically chooses whether to use Spatial or Temporal for each block.</li>
</ul>
<h4 class="psize il"><span id="Subpixel_Motion_Est(subme)">Subpixel Motion Est(subme): </span></h4>
<p class="il nl">One of the things that make x264 far superior to other codecs is it&#8217;s amazing Motion Compensation capabilities. x264 even supports estimating the motion of a block by a non integer number of pixels, which is called Subpixel Motion Estimation. The advantages that this offers are quite obvious.</p>
<ul class="np">
<li><em>SAD(Sum of Absolute Differences)</em>: In this, the absolute differences between the pixels in the current block and the corresponding pixels in the block to be compared are taken, and are then added to obtain an SAD value. The block which gives the lowest SAD value will be the considered to be the block using which the motion vector will be calculated. This method can be used either with no Subpixel Motion Estimation(<strong><em>subme 0</em></strong>), or with one iteration of Quarter Pixel precision(<strong><em>subme 1</em></strong>).</li>
<li><em>SATD (Sum of Absolute Transformed Differences)</em>:Similar to SAD, with the only difference being that the differences of each pixel is frequency transformed before being added. Although this is much slower than SAD, it gives a much better prediction. This method can be used with two iterations of Quarter Pixel precision(<strong><em>subme 2</em></strong>), one iteration of Half Pixel precision interpolated to give quarter pixel precision(<strong><em>subme 3</em></strong>), always with Quarter Pixel precision(<strong><em>subme 4</em></strong>) and with Quarter Pixel precision + Bidirectional Motion Estimation(<strong><em>subme 5</em></strong>).</li>
<li><em>RD(Rate Distortion)</em>: The disadvantage of using SAD/SATD is that, many a time, the number of bits used for representing a sample would be more than what is actually needed. This could drastically increase the output file size, especially when using Quarter Pixel Precision.<br />
RD rectifies this issue by measuring the distortion D and the the number of bits R required for each decision, and comparing these with a cost function to make the mode decision. This can be used in either I/P frames(<strong><em>subme 6</em></strong>) or in all frames(<strong><em>subme 7</em></strong>).</li>
<li><em>RD Refine</em>: In this setting, RD is used to refine both motion vectors and mode decisions. This again, can be used in either I/P frames(<strong><em>subme 8</em></strong>) or in all frames(<strong><em>subme 9</em></strong>). This  is slower than normal RD, but more efficient.</li>
<li><em>QPRD(Quarter Pixel Rate Distortion)</em>: This setting does an RD optimization on some quarter pixels using a hexagonal search(<strong><em>subme 10</em></strong>). First, the SATD is checked. If this is found to be above the  threshold value, then the RD process is skipped. If the SATD is below the threshold value, then RD is used. This process much slower, and requires <strong><em>trellis</em></strong> to be set at 2 and <strong><em>Adaptive Quant Strength</em></strong> > 0.</li>
</ul>
<h4 class="psize il"><span id="Motion_Est_Method">Motion Est Method: </span></h4>
<p class="il nl">x264 has a variety of search patterns for estimating how each block of pixels have moved in successive frames.</p>
<div class="highlight np">
<p class="nl">Key:</p>
<p><a href="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_part2_x264/key.png" target="_blank"><img decoding="async" class="compact" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_part2_x264/key.png" alt="Key" height="90px" width="566px"></a></p>
<ul class="emplist">
<li>
<p class="nl"><em>Diamond</em>:<br />Pattern:</p>
<div><a href="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_part2_x264/diamond.png" target="_blank"><img decoding="async" style="margin-bottom: 5px; margin-left: 20px" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_part2_x264/diamond.png" alt="Diamond Pattern" height="90px" width="90px"></a></div>
<p class="compact">Searches similar pixels in a Diamond pattern. This is the fastest method, however the results obtained are the most inferior.</p>
</li>
<li>
<p class="nl"><em>Hexagon</em>:<br />Pattern:</p>
<div><a href="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_part2_x264/hexagon.png" target="_blank"><img decoding="async" style="margin-bottom: 5px; margin-left: 20px" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_part2_x264/hexagon.png" alt="Hexagon Pattern" height="150px" width="150px"></a></div>
<p class="compact">Searches similar pixels in a Hexagon pattern. Slower than Diamond search, but produces much better results.</p>
</li>
<li>
<p class="nl"><em>Exhaustive</em>:<br />Pattern:</p>
<div><a href="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_part2_x264/exhaustive.png" target="_blank"><img decoding="async" style="margin-bottom: 5px; margin-left: 20px" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_part2_x264/exhaustive.png" alt="Exhaustive Pattern" height="150px" width="150px"></a></div>
<p class="compact">Searches similar pixels in a wide area(directly given by the Motion Est Range) surrounding the current pixel. This is an extremely slow pattern, and in most cases, the compression gain offered by this is just not worth it.</p>
</li>
<li>
<p class="compact"><em>Transformed Exhaustive</em>: It is similar to exhaustive, but is slightly better and slower.</p>
</li>
<li>
<p class="compact"><em>Uneven Multi Hexagon</em>: This makes use of five different search patterns; Unsymmetrical cross search, Small rectangular full search, Uneven Multi Hexagon grid search, Extended Hexagon based search and Diamond search. Based on the complexity of the scene, x264 will choose one or multiple of these patterns to estimate motion. Like exhaustive, the range of this search is directly controlled by the Motion Est Range. This is slower than Hexagon search(faster than Exhaustive), but gives much better results in scenes with complex motion.</p>
</li>
</ul>
</div>
<h4 class="psize il"><span id="Motion_Est_Range(merange)">Motion Est Range(merange): </span></h4>
<p class="il np">This value specifies the maximum range in pixels that the encoder searches for a match. For Diamond and Hexagon pattern, this value ranges from 4-16. For Uneven Multi Hexagon and Exhaustive, this value can be extended beyond 16, which can be particularly useful for high motion scenes.</p>
<div class="vspacer_25px"></div>
<h4 class="psize il"><span id="Partition_Type">Partition Type: </span></h4>
<p class="il nl">Each macroblock is broken down to form prediction blocks by the x264 encoder. There are 6 possible ways by which this can be done;</p>
<ul class="nl">
<li>Intra Macroblock: 16&#215;16, 8&#215;8</li>
<li>Inter Macroblock: 16&#215;16, 16&#215;8, 8&#215;16, 8&#215;8</li>
<li>The 8&#215;8 blocks can further be broken down into even smaller blocks.</li>
</ul>
<p class="nl">Each of these partitions are then represented using separate motion vectors. This partitioning is called mode.</p>
<p class="nl">A macroblock with less partitions would require lesser motion vectors to represent its motion. However, these motion vectors might not accurately represent the motion, resulting in a large error and hence encoding the error would require more bits. Similarly, more partitions would require more motion vectors to represent the motion information and fewer bits to encode the residual error.</p>
<p class="nl">The mode selection for each macroblock is one of the steps which contributes to x264s ability to give a great quality output at a low bitrate, but it is a time consuming process, especially if more macroblocks are partitioned.</p>
<p class="np">By using the options in this setting, you can control how many macroblocks the encoder will partition. Options of <strong><em>Most</em></strong>, <strong><em>None</em></strong> ,<strong><em>Some</em></strong> and <strong><em>All</em></strong> are provided.</p>
<h4 class="psize il"><span id="Trellis">Trellis: </span></h4>
<p class="il np">Enabling this setting allows x264 to use trellis quantization algorithm for rounding off the transformed coefficients, which can improve compression by a bit. CABAC must be enabled to use this. You can choose to use this either for encoding only or always(for both analysis and encoding). Choosing always can hit your encoding speed.</p>
<div class="vspacer_25px"></div>
<h3 class="msize" style="padding-top: 5px; text-decoration: underline"><span id="Psychovisual">Psychovisual</span></h3>
<p class="compact">Using the settings in this section, you can control the extent to which the encoder will remove psychovisual redundancies.</p>
<h4 class="psize il"><span id="No_DCT_Decimate">No DCT Decimate: </span></h4>
<p class="il np">DCT Decimation allows the x264 encoder to skip encoding any of the blocks which it views as redundant information. These blocks are the not written to the output file, effectively reducing the bitrate. Checking this option will prevent x264 from skipping such blocks. This is useful if you want to preserve the grain in your videos, which are otherwise removed by DCT decimation.</p>
<div class="vspacer_25px"></div>
<h4 class="psize il"><span id="Adaptive_Quant_Strength">Adaptive Quant Strength: </span></h4>
<p class="il nl">Adaptive Quantization is the process of using a different value quantizer for each block. As x264 uses CRF for constant quality(in Handbrake), this setting can be used to control how x264 distributes bits between the flat areas and the complex areas in the frames.</p>
<p class="np">Higher values(>1) means more bits are allocated to the flats than to the complex areas in a frame, effectively reducing the banding artifacts, but causing some ringing artifacts. Lower Values(<1) means more bits are allocated to the edges in a frame, effectively reducing the ringing artifacts, but causing some banding artifacts.</p>
<div class="spaced image">
<a href="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_part2_x264/ringing_and_banding.jpg" target="_blank"><img decoding="async" class="aligncenter compact" src="https://www.ocfreaks.com/imgs/guide_tutorial/handbrake_part2_x264/ringing_and_banding.jpg" alt="Ringing and Banding Artifacts" height="674px" width="674px"></a><i>Ringing Artifacts: In the edges of the circle.<br />
Banding Artifacts: Discontinuities in the Gradient inside the circle and in the background.</i>
</div>
<h4 class="psize il"><span id="Psychovisual_Rate_Distortion">Psychovisual Rate Distortion: </span></h4>
<p class="il np">This setting adjusts the tradeoff between detail retention and actual video quality(the way the computer sees it). Higher values tend to retain the finer details(grain) at the expense of some loss in quality(undesirable blocking artifacts). The encoded video will thus, appear sharper and more detailed as compared to what it would have been if this was set to 0. To use this, subme should be 6 or higher.</p>
<div class="vspacer_25px"></div>
<h4 class="psize il"><span id="Psychovisual_Trellis">Psychovisual Trellis: </span></h4>
<p class="il np">This setting can be used to improve the sharpness and retain details by varying the strength function of the trellis quantization algorithm. The slider works similar to the Rate Distortion Slider. Higher values bias the finer details over the quality.</p>
<div class="vspacer_25px"></div>
<h4 class="psize il"><span id="Deblocking">Deblocking: </span></h4>
<p class="il np">Does the same thing as the Deblocking Filter in the &#8220;Filters&#8221; tab, but in a much better way. There are two parameters that you could give as input to x264&#8217;s deblocking filter: Alpha and Beta. Alpha value control the amount of deblocking to be applied; higher values would give a softer image. Beta value is the threshold value with which the block is first compared before it is deblocked.</p>
<div class="vspacer_25px"></div>
<div class="special sp_blue notestar spaced">
<b>Note:</b> The Preset and Tune values in the &#8220;Video&#8221; tab work by altering the Advanced x264 settings, and could be used as an alternative if you are intimidated by these settings.
</div>
<h2 style="padding-top: 30px; margin-bottom: 20px;"><span id="Closing_Notes">Closing Notes</span></h2>
<p class="compact">Well, thats all there is to encoding videos using Handbrake. Always make it a practise to encode a preview first and try playing it on your intended device. Video encoding does take a lot of time, and you wouldn&#8217;t want to be that fool who spends hours encoding the entire video just to find that it doesn&#8217;t work on your device.</p>
<p class="compact">Apart from that, have fun encoding! Hope you found this tutorial helpful.</p>
<p>The post <a href="https://www.ocfreaks.com/handbrake-tutorial-part-2-x264-advanced-encoding-compression-settings-guide/">Handbrake Tutorial Part 2: x264 Advanced Encoding &#038; Compression Settings Guide</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ocfreaks.com/handbrake-tutorial-part-2-x264-advanced-encoding-compression-settings-guide/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2586</post-id>	</item>
		<item>
		<title>3.5mm Earphone Connector Compatibility Issue</title>
		<link>https://www.ocfreaks.com/3-5mm-earphone-connector-compatibility-issue/</link>
					<comments>https://www.ocfreaks.com/3-5mm-earphone-connector-compatibility-issue/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Saby D'silva]]></dc:creator>
		<pubDate>Mon, 23 Jan 2017 14:34:42 +0000</pubDate>
				<category><![CDATA[Guides & Tutorials]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[earphones]]></category>
		<category><![CDATA[guide]]></category>
		<guid isPermaLink="false">http://www.ocfreaks.com/?p=2581</guid>

					<description><![CDATA[<p>An insight into the different types of 3.5mm earphone connector, and what causes certain 3.5mm connector earphones to be incompatible with some devices even when using the same socket. This might be an eye opener for some of you guys!</p>
<p>The post <a href="https://www.ocfreaks.com/3-5mm-earphone-connector-compatibility-issue/">3.5mm Earphone Connector Compatibility Issue</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="spaced image">
<img fetchpriority="high" decoding="async" class="aligncenter compact disappear appear" src="https://www.ocfreaks.com/imgs/guide_tutorial/3.5mm_earphone_jack_compatibility/title.jpg" width="600" height="365" alt="3.5mm Connector">
</div>
<p class="compact" style="padding-top: 10px;">Quite often you might have come across a pair of earphones that is incompatible with your device. But why is this so, even when the plug fits perfectly in the socket? Buying new earphones is a ritual that most of us have to go through once in a few months or so. Choosing the right pair of buds is a hard enough affair as it is, and such problems simply add to our woes. With this guide, you&#8217;ll come to know the reason for these incompatibilities, how you can choose the correct earphone when buying online and how you could (possibly) make incompatible earphones work on your device.</p>
<h2 class="shead" style="padding-top: 15px; margin-bottom: 20px;">The 3.5mm Earphone Connector (aka Audio Jack)</h2>
<p class="compact">Most modern phones come with 3.5 mm sockets, and earphones for these are available in plenty. But this is just half the story. The root of the incompatibility lies in the lack of proper standardisation in the 3.5mm connector.</p>
<p class="np">There are two types of 3.5 mm connectors that could come with stereo earphones:</p>
<h3 class="msize">TRS(Tip-Ring-Sleeve) Connector:</h3>
<p class="compact">Also known as Three Pin Connector or Three Conductor Connector. These are used when the earphones either don&#8217;t come with an inline mic, or when the mic uses a connector separate from that of the Audio Out. PCs and mp3 players commonly use TRS sockets.</p>
<div class="spaced image">
<img decoding="async" class="aligncenter compact disappear appear" src="https://www.ocfreaks.com/imgs/guide_tutorial/3.5mm_earphone_jack_compatibility/trs.jpg" width="384" height="450" alt="TRS Connector" style="border:solid #666 1px;"><i>TRS Connector</i>
</div>
<p class="compact">For 3 pin TRS connectors in stereo earphones, the connections are pretty much standard:</p>
<div class="spaced image">
<img decoding="async" class="aligncenter compact disappear appear" src="https://www.ocfreaks.com/imgs/guide_tutorial/3.5mm_earphone_jack_compatibility/trs_conn.jpg" width="384" height="450" alt="TRS Connections" style="border:solid #666 1px;"><i>TRS Connections</i>
</div>
<h3 class="msize">TRRS(Tip-Ring-Ring-Sleeve) Connector:</h3>
<p class="compact">Also known as Four Pin Connector or Four Conductor Connector. These are used when the Mic and Audio Out are provided in a single connector. Most phones use TRRS connectors as it is quite compact, since it eliminates the need of a separate connector for the Mic.</p>
<div class="spaced image">
<img class="aligncenter compact disappear appear" src=
"https://www.ocfreaks.com/imgs/guide_tutorial/3.5mm_earphone_jack_compatibility/trrs.jpg" width="384" height="450" alt="TRRS Connector" style="border:solid #666 1px;"><i>TRRS Connector</i>
</div>
<p class="compact">Now, in the case of 4 pin TRRS connectors, there are two differing standards by which connections could be made:</p>
<h4 class="psize il">OMTP:</h4>
<p class="il nl">This was the original standard for TRRS connectors developed by Nokia. OMTP sockets could commonly be seen in old Nokia and Samsung Phones and Legacy Xperias.</p>
<div class="spaced image">
<img loading="lazy" decoding="async" class="aligncenter compact disappear appear" src="https://www.ocfreaks.com/imgs/guide_tutorial/3.5mm_earphone_jack_compatibility/trrs_omtp_conn.jpg" width="384" height="450" alt="TRRS OMTP Connections" style="border:solid #666 1px;"><i>TRRS OMTP Connections</i>
</div>
<h4 class="psize il">CTIA:</h4>
<p class="il nl">This is at present, more commonly seen standard than OMTP. CTIA sockets are used in HTC, Samsung, Sony, LG and most other android phones, Lumia and iPhones (well, before 7. A few, ahem, &#8220;brilliant&#8221; engineers at Apple decided it&#8217;d be a great idea to drop the 3.5 mm audio socket and use their proprietary Lightning port as the audio connector. But that&#8217;s a completely different story and I wont be rambling much about that here).</p>
<div class="spaced image">
<img loading="lazy" decoding="async" class="aligncenter compact disappear appear" src="https://www.ocfreaks.com/imgs/guide_tutorial/3.5mm_earphone_jack_compatibility/trrs_ctia_conn.jpg" width="384" height="450" alt="TRRS CTIA Connections" style="border:solid #666 1px;"><i>TRRS CTIA Connections</i>
</div>
<h3 class="msize" style="padding-top: 15px;">OMTP Earphones on a CTIA Socket / CTIA Earphones on an OMTP Socket :</h3>
<p class="compact">Due to the difference in position of the Ground and Mic contacts, OMTP earphones wont work in CTIA sockets, and vice versa. Now, heres the icing on the cake: Most manufacturers dont specify the standard used in their earphones. Well, isn&#8217;t that just great?!?!</p>
<p class="compact">One way you could check if a particular earphone is compatible with your device is is by checking the compatibility list. For example; If the Earphone manufacturer says &#8220;for iPhones&#8221;, then it uses CTIA standard. If the earphones are made for Samsung devices, then again it uses CTIA standard. If the earphones are for Legacy Xperia devices or old Nokia Phones, then it uses OMTP standard.</p>
<p class="compact">If you have already purchased earphones that are incompatible with your device, what can I say ? Sucks to be you.</p>
<p class="compact">Just Kidding ;-). One way you could possibly make it work is by purchasing an adapter.</p>
<div class="spaced image">
<a href="https://www.ocfreaks.com/imgs/guide_tutorial/3.5mm_earphone_jack_compatibility/omtp_to_ctia.jpg" target="_blank"><img class="aligncenter compact disappear appear" src=
"https://www.ocfreaks.com/imgs/guide_tutorial/3.5mm_earphone_jack_compatibility/omtp_to_ctia.jpg" width="600" alt="OMTP to CTIA/CTIA to OMTP Adapter" style="border:solid #666 1px;"></a><i>OMTP to CTIA/CTIA to OMTP Adapter</i>
</div>
<p class="compact">Such an adapter can convert an OMTP earphone to CTIA as well as a CTIA earphone to OMTP. These are a bit hard to find for cheap, but are well worth the price if it works.</p>
<h3 class="msize" style="padding-top: 15px;">TRRS Earphones on a TRS Socket / TRS Earphones on a TRRS Socket :</h3>
<p class="compact">3 pin TRS Earphones should be compatible with devices using 4 pin TRRS sockets, as the Ground pin would be connected to the ground contact of the Socket anyways. The same goes for 4 pin TRRS Earphones on a 3 pin TRS socket.</p>
<div class="compact image">
<img loading="lazy" decoding="async" class="aligncenter compact disappear appear" src="https://www.ocfreaks.com/imgs/guide_tutorial/3.5mm_earphone_jack_compatibility/3pp_to_4ps.jpg" width="405" height="450" alt="TRS connector in TRRS socket" style="border:solid #666 1px;"><i>TRS connector in TRRS socket</i>
</div>
<div class="spaced image">
<img class="aligncenter compact disappear appear" src=
"https://www.ocfreaks.com/imgs/guide_tutorial/3.5mm_earphone_jack_compatibility/4pp_to_3ps.jpg" width="405" height="450" alt="TRRS connector in TRS socket" style="border:solid #666 1px;"><i>TRRS connector in TRS socket</i>
</div>
<p class="compact">However, if these dont work, or if you get a garbled audio, it would most likely be due to improper contact between the plug and socket conductors.</p>
<div class="spaced image">
<img loading="lazy" decoding="async" class="aligncenter compact disappear appear" src="https://www.ocfreaks.com/imgs/guide_tutorial/3.5mm_earphone_jack_compatibility/4pp_to_3ps_inc.jpg" width="405" height="450" alt="Improper Contact between TRRS Plug and TRS Socket" style="border:solid #666 1px;"><i>Improper Contact between TRRS Plug and TRS Socket</i>
</div>
<p class="compact">As can be seen the contacts in the socket will connect with the insulator when the plug is completely inserted in the socket. Another possibility is that the contact touches two of the pins. This is also the reason why the earphones appear to work when you slightly remove the plug.</p>
<p class="compact">To make these work, you could try using an adapter with a TRRS female and TRS male connector (4 pin to 3 pin adapter, for TRRS plug &#8211; TRS Socket incompatibility) or with a TRS female and TRRS male connector (3 pin to 4 pin adapter, for TRS plug &#8211; TRRS Socket incompatibility), depending on your requirements.</p>
<p>The post <a href="https://www.ocfreaks.com/3-5mm-earphone-connector-compatibility-issue/">3.5mm Earphone Connector Compatibility Issue</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ocfreaks.com/3-5mm-earphone-connector-compatibility-issue/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2581</post-id>	</item>
		<item>
		<title>Beginners Guide to Video Redundancies</title>
		<link>https://www.ocfreaks.com/beginners-guide-tutorial-video-redundancies/</link>
					<comments>https://www.ocfreaks.com/beginners-guide-tutorial-video-redundancies/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Saby D'silva]]></dc:creator>
		<pubDate>Fri, 20 Jan 2017 16:10:40 +0000</pubDate>
				<category><![CDATA[Guides & Tutorials]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[video]]></category>
		<guid isPermaLink="false">http://www.ocfreaks.com/?p=2574</guid>

					<description><![CDATA[<p>A brief guide detailing the various video redundancies for beginners.</p>
<p>The post <a href="https://www.ocfreaks.com/beginners-guide-tutorial-video-redundancies/">Beginners Guide to Video Redundancies</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="spaced image">
<img decoding="async" class="aligncenter compact" src="https://www.ocfreaks.com/imgs/guide_tutorial/video_redundancies/title.jpg" alt="Video Redundancies" height="300px" width="300px">
</div>
<p class="compact">In this article, I will explain to you about the various video redundancies and why eliminating them is of utmost importance and the first thing programmers tend to focus on when making a codec.</p>
<div class="special sp_blue notestar spaced">
<b>Note:</b> This article is meant to be a precursor to my tutorial: <a href="https://www.ocfreaks.com/handbrake-tutorial-part-2-x264-advanced-encoding-compression-settings-guide/">Handbrake Tutorial Part 2: x264 Advanced Encoding &#038; Compression Settings Guide</a>. Prior knowledge of this is a MUST to fully grasp the Handbrake Advanced/x264 Settings.
</div>
<p class="compact">First lets go into what a redundancy is. In simple terms, Redundancy is the amount of useless data that exists in a specific information. &#8220;Useless&#8221;, here, is an extremely subjective term, and what I actually mean to say is though the data does contribute to the information, the contribution itself is so insignificant that reducing or eliminating it wont have any adverse effects.</p>
<p class="compact">Those coming here from my <a href="https://www.ocfreaks.com/handbrake-complete-tutorial-part-1-transcode-compress-videos/" target="_blank">Handbrake Complete Tutorial Part 1: How to Transcode &#038; Compress Videos</a> article might remember how most video codecs process each frame of the video in terms of <a href="https://www.ocfreaks.com/handbrake-complete-tutorial-part-1-transcode-compress-videos/#Modulus" target="_blank"><strong>macroblocks</strong></a>. Basically, there are four kinds of redundancies that could exist in a lossless raw video:</p>
<ol class="emplist">
<li class="spaced"><b>Spatial Redundancies:</b> Spatial Video Redundancies are the similarities between the <strong>surrounding macroblocks</strong>. For example, consider the frame shown below:</li>
<div class="spaced image" style="padding-right:20px;">
<a href="https://www.ocfreaks.com/imgs/guide_tutorial/video_redundancies/sr.jpg" target="_blank"><img decoding="async" class="aligncenter compact" src="https://www.ocfreaks.com/imgs/guide_tutorial/video_redundancies/sr.jpg" alt="Spatial Redundancies" height="367px" width="625px"></a><i>Spatial Redundancies: The field and the sky, which makes up most of the frame; have largely monotonous hues.</i>
</div>
<li class="spaced"><b>Temporal Redundancies:</b> Temporal Video Redundancies are the similarities in <strong>successive frames</strong>. For example, consider the frames shown below:</li>
<div class="compact image" style="padding-right:20px;">
<a href="https://www.ocfreaks.com/imgs/guide_tutorial/video_redundancies/tr1.jpg" target="_blank"><img decoding="async" class="aligncenter compact" src="https://www.ocfreaks.com/imgs/guide_tutorial/video_redundancies/tr1.jpg" alt="Temporal Redundancies 1" height="367px" width="625px"></a><i>[FRAME: 1]</i>
</div>
<div class="compact image" style="padding-right:20px;">
<a href="https://www.ocfreaks.com/imgs/guide_tutorial/video_redundancies/tr2.jpg" target="_blank"><img decoding="async" class="aligncenter compact" src="https://www.ocfreaks.com/imgs/guide_tutorial/video_redundancies/tr2.jpg" alt="Temporal Redundancies 2" height="367px" width="625px"></a><i>[FRAME: 2]</i>
</div>
<div class="compact image" style="padding-right:20px;">
<a href="https://www.ocfreaks.com/imgs/guide_tutorial/video_redundancies/tr3.jpg" target="_blank"><img decoding="async" class="aligncenter compact" src="https://www.ocfreaks.com/imgs/guide_tutorial/video_redundancies/tr3.jpg" alt="Temporal Redundancies 3" height="367px" width="625px"></a><i>[FRAME: 3]</i>
</div>
<div class="spaced image" style="padding-right:20px;">
<a href="https://www.ocfreaks.com/imgs/guide_tutorial/video_redundancies/tr4.jpg" target="_blank"><img decoding="async" class="aligncenter compact" src="https://www.ocfreaks.com/imgs/guide_tutorial/video_redundancies/tr4.jpg" alt="Temporal Redundancies 4" height="367px" width="625px"></a><i>[FRAME: 4]<br />Temporal Redundancies: In these frames, only the car is moving. The rest of the frame(the background) is stationary. So, there is no need to transmit this information in all the frames.</i>
</div>
<li class="spaced"><b>Psychovisual Redundancies:</b> Psychovisual Video Redundancies exist due to the fact that the human eye is not equally sensitive to all visual information. So by eliminating the parts to which the eye is less sensitive, the frame can be compressed without a much noticeable quality loss.</li>
<li><b>Coding Redundancies:</b> In an uncompressed raw video, each pixel in a frame is usually encoded to a <strong>fixed length</strong>. This results in a file that would be much bigger than what is actually required, as the same length is used for each pixel in all the frames, regardless of whether it is required or not. This is called coding redundancy, and can be eliminated by using <strong>Variable Length Coding</strong> schemes. To see (albeit a crude example) how coding redundancies can be reduced, consider an 8bit 5x5px greyscale image, with the grey levels of the series of pixels going as;<br />&nbsp;<br />
<b>120, 120, 120, 120, 120, 119, 119, 119, 119, 119, 118, 118, 118, 118, 117, 117, 117, 115, 115, 115</b><br />&nbsp;<br />
This could be represented as is, in which case a total of 160 bits would be required. Or, it could be represented much more efficiently as follows:<br />&nbsp;<br />
<b>5.120, 5.119, 4.118, 3.117, 3.115</b><br />&nbsp;<br />
This is the basic principle of Run Length Encoding (RLE), one of the oldest and simplest encoding schemes.
</li>
</ol>
<p class="compact">How these redundancies are processed and eliminated is one of the defining factors of a Codecs overall efficiency and performance.</p>
<p class="np">Eliminating redundancies is extremely important, especially in the case of videos. This is because of the ridiculously high amount of redundant data that can exist in it. Consider a scenario where you have 86400 images averaging 350 KB per image(really not an inconceivable size for an image of that resolution). A 24fps video made out of that many images would be of around 3GB (for 30 mins). Let that sink in. Also in videos, you really wont see much of a difference between consecutive frames. So, all that data being used to represent it is, as I stated above, &#8220;Useless&#8221;!</p>
<p>The post <a href="https://www.ocfreaks.com/beginners-guide-tutorial-video-redundancies/">Beginners Guide to Video Redundancies</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ocfreaks.com/beginners-guide-tutorial-video-redundancies/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2574</post-id>	</item>
		<item>
		<title>Guide to Image Compression and Optimization for the WEB Using IrfanView</title>
		<link>https://www.ocfreaks.com/guide-tutorial-to-image-compression-and-optimization/</link>
					<comments>https://www.ocfreaks.com/guide-tutorial-to-image-compression-and-optimization/?noamp=mobile#comments</comments>
		
		<dc:creator><![CDATA[Umang Gajera]]></dc:creator>
		<pubDate>Sun, 10 Jun 2012 17:58:21 +0000</pubDate>
				<category><![CDATA[Guides & Tutorials]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[tutorial]]></category>
		<guid isPermaLink="false">http://www.ocfreaks.com/?p=241</guid>

					<description><![CDATA[<p>Introduction One of the concern these days for &#8220;Pics&#8221; is its image quality and size when uploading them to web. Obviously we all need and buy camera which gives best quality within our budget constraints. Most of the digital cameras these days are quite cheap now and provide good quality for the money. Of what [&#8230;]</p>
<p>The post <a href="https://www.ocfreaks.com/guide-tutorial-to-image-compression-and-optimization/">Guide to Image Compression and Optimization for the WEB Using IrfanView</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><!--pagetitle:Introduction--></p>
<div class="justify">
<span class="shead"><span class="sheadin">Introduction</span></span><br />
One of the concern these days for &#8220;Pics&#8221; is its image quality and size when uploading them to web. Obviously we all need and buy camera which gives best quality within our budget constraints. Most of the digital cameras these days are quite cheap now and provide good quality for the money. Of what I know .. 8-16 MegaPixel cameras are quite common these days and most of us already know that as Megapixels of a camera increases the size of the image in terms of the resolution while in terms storage space it does not increase much because cameras these days are getting smarter to support fair amount of JPEG compression while taking shots. These &#8220;sizes&#8221; of the images are just too big for the web and if its like 3 to 8MB+ its gonna take a good amount of time to download it and if there are more images then that adds up to a good amount of download time. We also cant assume every one having 2mbps+ connection speeds .. like say if you wanna send some of your birthday pics to you cousins email and if your cousin doesn&#8217;t have a decent connection speed then its gonna take a very long for him to download and even worse if he uses MB based internet plans. Also for many other reasons too the RAW images from the cameras must be compressed in terms of both resolution and size without visible loss in images. This is possible because images tend to have certain types of redundancies i.e duplicated/repetitive information. Removal or encoding of these redundancies can lead to following types of compression :</p>
<ol>
<li><strong>Lossless compression : </strong>Here the information, as present in original images, is kept intact and the original image can be reconstructed &#8220;as it is&#8221; after decompression.</li>
<li>
<strong>Lossy Compression :</strong> Here some of the information present in original image is permanently lost and the decompressed(reconstructed) image is a close approximation of the original image.</li>
</ol>
<p>As suggested in literature there are 3 basic types of redundancies in Images:</p>
<ol>
<li><strong>Phsycovisual Redundancy</strong></li>
<li><strong>Coding Redundancy</strong></li>
<li><strong>Interpixel Redundancy</strong></li>
</ol>
<p>Now, Lets go through each of the redundancy mentioned above.</p>
<h4>Phsycovisual Redundancy:</h4>
<p>Achieving very good compression ratios for Natural Images is possible because these type images contain a very good amount of phsycovisiual redundancies i.e information in the images to which our eyes are least sensitive which simply means that information of this sort can be simply removed from the images and we would&#8217;nt notice it 99% of the time .. unless we zoom too much. In this the following fact is exploited : <strong><em>Human eye is less sensitive to higher frequencies and more sensitive to lower frequencies in the visual spectrum.</em></strong></p>
<h4>Coding Redundancy:</h4>
<p>In all of the images we can group pixels as per their intensities or gray-levels. Certain type of intensities are more frequent than others or simply certain pixel colors are more than others and can be grouped to encode this repetition in a way in which &#8211; the pixels which occur more are assigned shorter codewords and those which occur less frequently code words are bigger. The entire images is represented using these codewords. Obviously since we have grouped the pixels the space required to represent a codeword will be much less than the individual pixels. Since here we encode the repetitive information , none of the information is permanently lost which leads to lossless compression of images but the compression ratio is not good many times but is indeed acceptable.Example of this is the famous Huffman coding , Arithmetic coding etc.</p>
<h4>Interpixel Redundancy:</h4>
<p>This redundancy exists for the fact that adjacent pixels are correlated; which is to say that adjacent pixels have similar intensities (most of the times) and hence we can predict the intensity of a pixel from its neighbors. Usually Image is transformed into frequency domain from spatial domain to remove Interpixel Redundancies. Examples are the famous Fourier-Transform , Discrete cosine Transform (DCT) used in JPEG , Walsh-Hadamard Transform , etc.. Out of these DCT is a better option and is used as a standard for achieving Lossy Image compression in JPEG Compression technique. DCT is lossy because after transforming the Image to frequency domain the values High Frequency components are rounded-off which results in a permanent loss of information. </p>
<div class="snippet_darkred"><strong>Note :</strong> Removal of Phsycovisual &#038; Interpixel Redundancies is usually permanent and hence it leads to Lossy compression of Images while that in the case of Coding redundancies gives lossless compression since here the repeated codes are encoded and not actually removed. </div>
<h4>Widely used Image File Formats on Internet:</h4>
<p>Some of the Most widely used File Format on web are :<br />
1. JPG (JPEG &#8211; Joint Photographic Experts Group)<br />
2. PNG (Portable Network Graphics)<br />
3. GIF (Graphics Interchange FileFormat originally developed by CompuServe)</p>
<p>I generally use JPG for Images taken using a Camera since it gives best results for such kind of Images.</p>
<p>The storage space required for Images can be reduced by :</p>
<ul>
<li>1. Reducing resolution of the image </li>
<li>2. Converting to a suitable fileformat (lossy/lossless) </li>
<li>3. Encoding the image information (lossless)</li>
<li>4. Reducing the image quality (lossy) like reducing the color space and some other techiques as well..</li>
</ul>
<p>We shall use a combination of methods as mentioned above. Now lets actually see how do we compress(permanently hence lossy) the image till a point where its easy to exchange images on Internet.The software that I frequently use for processing Raw Camera Images is <strong>IrfanView</strong> which is free to use. </p>
<div class="highlight">
<h4>Cameras and Images used for this Guide :</h4>
<p>1. <strong>Olympus FE-170 6 Megapixel Camera</strong> :<br />
<em style="color:#fff;margin-left:30px;">Images -> olympus_1.jpg to olympus_6.jpg</em></p>
<p>2. <strong>Canon EOS 1000D 10.1 Megapixel Camera</strong> :<br />
<em style="color:#fff;margin-left:30px;">Images -> canon_1.jpg to canon_3.jpg</em></p>
<p>3. <strong>Nokia N73 ME 3.2 Megapixel</strong> :<br />
<em style="color:#fff;margin-left:30px;">Images -> n73_1.jpg to n73_2.jpg</em></p>
<p>4. <strong>Fujifilm FinePix HS20EXR 16 Megapixel Camera</strong> :<br />
<em style="color:#fff;margin-left:30px;">Images -> fujifilm_1.jpg to fujifilm_3.jpg</em></p>
<hr />
<h4>How do I download Original Images ? (Links below)</h4>
<p>1. Links to Original Images taken from Olympus FE-170 :<br />
<em style="color:#fff;margin-left:30px;"><a href="https://www.ocfreaks.com/forums/attachment.php?attachmentid=962&amp;d=1339349480">Olympus_6Mpix_1.rar</a></em><br />
<em style="color:#fff;margin-left:30px;"><a href="/forums/attachment.php?attachmentid=963&amp;d=1339349599">Olympus_6Mpix_2.rar</a> </em></p>
<p>2. Link to Original Images taken from Canon EOS 1000D :<br />
<em style="color:#fff;margin-left:30px;"><a href="https://www.ocfreaks.com/forums/attachment.php?attachmentid=957&amp;d=1339346578">Canon_EOS_1000D.rar</a> </em></p>
<p>3. Link to Original Images taken using Nokia n73 :<br />
<em style="color:#fff;margin-left:30px;"><a href="https://www.ocfreaks.com/forums/attachment.php?attachmentid=959&amp;d=1339346689">Nokia_N73_ME_3.2Mpix.rar</a></em></p>
<p>4. Link to Original Images taken using Fujifilm FinePix HS20EXR :<br />
<em style="color:#fff;margin-left:30px;"><a href="https://www.ocfreaks.com/forums/attachment.php?attachmentid=958&amp;d=1339346671">Fujifilm_FinePix_HS20EXR_16Mpix.rar</a></em></p>
<hr />
<h4>How do I download Processed Images ? </h4>
<p><strong>1.</strong> To download the processed Images as done in PART I and PART II of this guide just click on the Image(Thumbnail) shown.</p>
<p><strong>2. </strong>To download the Thumbnails as generated in PART III Right-Click on the any thumbnail in PART I or II and Save it as Image &#8211; since Thumbnails are used Inline in this Guide(Post). Clicking on the thumbnails will lead you to the corresponding processed file in PART I or II. The thumbnails used in this guide were generated with the same method as mentioned in PART III.
</div>
<p><strong>My Assumption : I assume you will be using this Guide to optimize Images taken from Camera/Mobile and not computer generated images (CGIs) .. though this guide is fairly applicable for CGIs as well. </strong></p>
<h4> Compression Ratio Basics:</h4>
<p>Of what I&#8217;ve studied in Literature there can be 2 possible methods to calculate Compression Ratios.</p>
<div class="highlight">
Method 1:<br />
<center><strong>Compression Ratio % = [(Output Size) / ( Input Size)] x 100;</strong><br />
[Lower Values mean Higher/Better Compression]<br />
</center></p>
<p>Method 2:<br />
<center><strong>Compression Ratio % = [(Input Size &#8211; Output Size) / (Input Size)] x 100;</strong><br />
[Higher Values mean Higher/Better Compression] </center></p>
<div class="snippet_darkred"><strong>In this Guide I&#8217;ve Used 2nd Method , Hence Higher Values means better Compression Ratio.</strong></div>
</div>
<div class="vspacer_15px"> </div>
</div>
<p>The post <a href="https://www.ocfreaks.com/guide-tutorial-to-image-compression-and-optimization/">Guide to Image Compression and Optimization for the WEB Using IrfanView</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ocfreaks.com/guide-tutorial-to-image-compression-and-optimization/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">241</post-id>	</item>
		<item>
		<title>Overclocking Guide for Intel LGA1156 Platform CPUs</title>
		<link>https://www.ocfreaks.com/overclocking-guide-for-intel-lga1156-platform-cpus/</link>
					<comments>https://www.ocfreaks.com/overclocking-guide-for-intel-lga1156-platform-cpus/?noamp=mobile#comments</comments>
		
		<dc:creator><![CDATA[Gaurav Bharadwaj ( Aka : ghost_z )]]></dc:creator>
		<pubDate>Mon, 19 Mar 2012 16:31:32 +0000</pubDate>
				<category><![CDATA[Guides & Tutorials]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[overclocking]]></category>
		<guid isPermaLink="false">http://www.ocfreaks.com/?p=33</guid>

					<description><![CDATA[<p>LGA 1156 CPU Overclocking guide.</p>
<p>The post <a href="https://www.ocfreaks.com/overclocking-guide-for-intel-lga1156-platform-cpus/">Overclocking Guide for Intel LGA1156 Platform CPUs</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><a href="https://www.ocfreaks.com/overclocking-guide-for-intel-lga1156-platform-cpus/intel-7/" rel="attachment wp-att-34"><img loading="lazy" decoding="async" class="size-thumbnail wp-image-34 aligncenter" title="Intel-7" src="https://www.ocfreaks.com/wp-content/uploads/2012/03/Intel-7-180x180.jpg" alt="" width="180" height="180" srcset="https://www.ocfreaks.com/wp-content/uploads/2012/03/Intel-7-180x180.jpg 180w, https://www.ocfreaks.com/wp-content/uploads/2012/03/Intel-7-300x300.jpg 300w, https://www.ocfreaks.com/wp-content/uploads/2012/03/Intel-7-150x150.jpg 150w, https://www.ocfreaks.com/wp-content/uploads/2012/03/Intel-7.jpg 320w" sizes="(max-width: 180px) 100vw, 180px" /></a><br />
<span class="shead"><span class="sheadin">Introduction</span></span></p>
<p>LGA1156 Platform was released way back in 2009 just 1 year after the release of LGA1366 Platform.</p>
<p>The main differences between lga1156 and lga1366 are as follows:</p>
<ol>
<li>Elimination of northbridge in lga 1156.</li>
<li>Only dual channel memory support.</li>
<li>Better turbo mode on lga1156.</li>
<li>Lower tdp of i7&#8217;s on lga1156(95watt opposed to 130 watt in 1366).</li>
</ol>
<p><span class="shead"><span class="sheadin">This the list of cpu&#8217;s that belong to this platform</span></span></p>
<p>Core i3(Clarkdale)Dual cores with ht but no turbo:</p>
<ul>
<li>-i3 530</li>
<li>-i3 540</li>
</ul>
<p>Core i5(Clarkdale) Dual cores with HT and turbo:</p>
<ul>
<li>-i5 650</li>
<li>-i5 660</li>
<li>-i5 661</li>
<li>-i5 670</li>
</ul>
<p>Core i5(Lynfield) Quad cores with turbo but no HT:</p>
<ul>
<li>-i5 750</li>
<li>-i5 750</li>
</ul>
<p>Core i7(Lynfield) Quad cores with ht and turbo:</p>
<ul>
<li>-i7 860</li>
<li>-i7 870</li>
<li>-i7 875k</li>
<li>-i7 880</li>
</ul>
<p><span class="shead"><span class="sheadin">The chipsets supported are:</span></span></p>
<ul>
<li>P55&#8211;Mainly for core i7 and i5 lynfield versions,although you could run i3 and other i5&#8217;s too but you won&#8217;t be able to utilize the on cpu graphics unit.</li>
<li>H55&#8211;Mainly for non lynfield i5&#8217;s and i3&#8217;s as it supports on cpu graphics unit.</li>
<li>Two More chipsets are available but they are not much different,H57 and Q57.</li>
</ul>
<p>This concludes the intro.</p>
<div class="caution"><strong>Disclaimer:</strong> Although i guarantee that the info and method stated here are safe and correct,i will not be held responsible for any ocing adventure gone wrong.</div>
<div class="vspacer"></div>
<p><span class="shead"><span class="sheadin">Setting Up Your System</span></span></p>
<ol>
<li>Goto bios(Press F10/Del/F2 at startup) and set everything at default then restart your pc.</li>
<li>Again goto bios and disable all power saving features,c-states etc ,.. then set all voltages from auto to normal in the bios except the PCH(discussed later), save settings and exit bios.</li>
<li>Disable or remove any unnecessary usb devices PNP devices that you don&#8217;t need.</li>
<li>Make sure you have adequate cooling and a good cpu cooler(advisable for system safety not mandatory).</li>
<li>Make sure you have a good cpu cooler installed before going for heavy overclocking(Eg. cooler master hyper 212+ evo)</li>
</ol>
<p><span class="shead"><span class="sheadin">Softwares/Utilities Required</span></span></p>
<p>1) <strong>Core Temp</strong>&#8211;Used to measure CPU temps.</p>
<p><a href="http://www.alcpu.com/CoreTemp/" target="_blank">http://www.alcpu.com/CoreTemp/</a></p>
<p><img decoding="async" src="http://i.imgur.com/cnTxg.png" alt="" border="0" /></p>
<p>2) <strong>HWMonitor</strong>&#8211;This gives temp and voltage info for the whole system including motherboard PCH temp.</p>
<p><a href="http://www.cpuid.com/softwares/hwmonitor.html" target="_blank">http://www.cpuid.com/softwares/hwmonitor.html</a></p>
<p><img decoding="async" src="http://i.imgur.com/oBid6.jpg" alt="" border="0" /></p>
<p>3) <strong>CPU-Z</strong>&#8211;Used for getting memory and cpu specific detailed info.</p>
<p><a href="http://www.cpuid.com/softwares/cpu-z.html" target="_blank">http://www.cpuid.com/softwares/cpu-z.html</a></p>
<p><img decoding="async" src="http://i.imgur.com/25Mjb.jpg" alt="" border="0" /></p>
<p>4) <strong>Prime95</strong>&#8211;A time tested and very good stability tester for cpu&#8217;s of any make and brand.</p>
<p><a href="http://www.overclock.net/t/137251/prime95" target="_blank">http://www.overclock.net/t/137251/prime95</a></p>
<p><img decoding="async" src="http://i.imgur.com/TnEpi.jpg" alt="" border="0" /></p>
<p>5) <strong>IBT</strong>(Intel Burn Test)&#8211;Includes linpack test which is apparently used by intel too for testing the processors.</p>
<p>This is better than Prime 95 as it takes much less time to find stability issues in the system.</p>
<p><a href="http://downloads.guru3d.com/IntelBurnTest-v2.3-download-2047.html" target="_blank">http://downloads.guru3d.com/IntelBur&#8230;load-2047.html</a></p>
<p><img decoding="async" src="http://i.imgur.com/50uCg.png" alt="" border="0" /></p>
<p>6) <strong>MEMTEST86+</strong>&#8211;Used to test the memory stability.</p>
<p><a href="http://www.memtest.org/" target="_blank">http://www.memtest.org/</a></p>
<p><img decoding="async" src="http://i.imgur.com/0ecBm.jpg" alt="" /></p>
<p>&nbsp;</p>
<div class="highlight_rcb_lite">
<p><strong>Understanding Some Basic Stuff:</strong></p>
<p style="padding-left: 30px;"><strong>Base Clock</strong>&#8211;This is your systems/motherboards primary frequency and essentially controls all other frequencies in the system.Also called(and depicted as in the bios) as bclk.</p>
<p style="padding-left: 30px;"><strong>Multiplier</strong>&#8211;its a mathematical function which when multiplied by the bclk or Base Clock gives us a desired frequency for some component.For Eg: CPU Frequency,Memory Frequency.</p>
<p style="padding-left: 30px;"><strong>CPU Frequency</strong>&#8211;This value denotes the speed/frequency of the processor which is the product of bclk and cpu multiplier.</p>
<p style="padding-left: 30px;"><strong>QPI Link</strong>&#8211;This value is directly dependent and proportional to the baseclock this is the alternative to fsb on lga1156 and its more efficient.By increasing it you not only increase the stability of the pc but also increase the bandwidth between cpu and memory.</p>
<p style="padding-left: 30px;"><strong>Memory Latency/Timings</strong>&#8211;This stated the wasted clock cycles in a particular memory configuration,the lower they are the better.</p>
<p><strong>Important Voltages:</strong></p>
<p style="padding-left: 30px;"><strong>VCORE</strong>&#8211;This is the amount of voltage given to the processor,very very important for ocing.</p>
<p>Well established safe limits&#8211;0-1.4volts.(although this may vary system wise and a lot of trial and error is required).</p>
<p style="padding-left: 30px;"><strong>QPI/VTT</strong>&#8211;This is the amount of voltage provided to the IMC(integrated memory controller) for stabilizing the qpi link,again very very important for ocing.</p>
<p>Well established safe limits&#8211;1.1-1.25volts.(although this may vary system wise and a lot of trial and error is required).</p>
<p style="padding-left: 30px;"><strong>DRAM/VDIMM</strong>&#8211;This is the amount of voltage given to the memory dimms.</p>
<p>Well established safe limits&#8211;1.5-1.65volts.(although this may vary system wise and a lot of trial and error is required).</p>
<p style="padding-left: 30px;"><strong>PCH</strong>&#8211;This is the amount of voltage given to the motherboard controller hub.This is basically responsible for communicating with different devices connected to motherboard except the GPU and CPU.</p>
</div>
<p>Well established safe limits&#8211;Its better to leave this at auto.(This setting can easily damage your board and components and do very less for ocing so its better left on at auto,sometimes when ocing beyond 4ghz+ and if your cpu is not stable this might help,no guarantees though).</p>
<div class="note"><strong>NOTE(IMP)</strong>: You should always keep in mind before ocing to not increase the DRAM/VDIMM voltage 0.5 volts over the QPI/VTT voltage.For Eg: If your QPI/VTT voltage is set to 1.1 then you should not increase the DRAM/VDIMM voltage beyond 1.6 volt.Not following this restriction can lead to a damaged cpu.</div>
<div class="vspacer"></div>
<div class="shead"><span class="sheadin">Some Basic Rules Before Moving On</span></div>
<p>1) Don&#8217;t set a target in mind,ocing is a recursive process,there is no guarantee you will achieve your desired overclock.</p>
<p>2) If you know your mother board is weak then don&#8217;t take the bclk too high,rather increase CPU multiplier as much as you can to achieve the desired overclock.</p>
<p>3) If you know your mother board can take the heat then its always better for stability reasons to decrease your CPU multiplier as low as you can and increase the bclk to achieve ocing.</p>
<p>4) Before increasing the bclk set the CPU multiplier as low as possible and set the PCI frequency as auto.</p>
<p>5) Decrease the memory multiplier before hand too because when you start ocing through bclk every other clocks/frequencies in the system will also rise.</p>
<div class="note"><strong>NOTE:</strong> Basically we are lowering all system multipliers and frequencies before increasing bclk for compensating the increase which they would have due to increase in bclk,think of it as a precautionary measure and increasing stability.Set the PCI Frequency to auto as it will remain at 100 then.</div>
<div class="vspacer"></div>
<p><span class="shead"><span class="sheadin">Finally Overclocking</span></span></p>
<div class="note"><strong>NOTE:</strong> Never use non bios/Window/O.S. based overclocking tools.</div>
<p>1) After reading the previously mentioned rules and setting up the bios multipliers and frequencies, goto Bios and start increasing bclk in steps of 5 or 10(if you are confident).Save settings then again enter bios.</p>
<p>2) Now after reentering bios check 3 frequencies every time you increase the bclk:</p>
<ol>
<li>CPU Frequency.</li>
<li>Memory Frequency.</li>
<li>PCI Frequency(although it is set to auto,doesn&#8217;t hurt to check for yourself to be extra sure).</li>
</ol>
<p>If everything is fine then move on to next step.</p>
<p>3) Save bios settings and exit then boot up windows,start cpuz and core temp and hwmonitor,let them run in the background.</p>
<p>4) Start Prime95 or IBT whichever you trust or like(imo ibt/linx are better):</p>
<div class="note">&#8212;&#8212;&#8212;&#8212;In case you chose Prime95</div>
<ol>
<li>Run it for at least 6 hours and check for errors or bsod&#8217;s or any decripency in system behaviour.</li>
<li>If you get any error/bsod then you might need to review your bios setting and try increasing vcore/qpi voltage a bit.</li>
<li>If you did not get any error then congratulations you have done your first successfull overclock.</li>
</ol>
<div class="note">&#8212;&#8212;&#8212;&#8212;In case you chose IBT</div>
<ol>
<li>Set the run times to 20(even 10 will do,but to be extra sure),and run it and then see for any errors bsod&#8217;s and any decripency in system behaviour.</li>
<li>If you get any error/bsod then you might need to review your bios setting and try increasing vcore/qpi voltage a bit.</li>
<li>If you did not get any error then congratulations you have done your first successfull overclock.</li>
</ol>
<p>5) Do steps 1-4 again and again till you stabilize the system(keeping voltage under safe range as stated by me in voltage section) and achieve your desired overclock.</p>
<p>6) In case your pc stops booting reset cmos by removing the battery in the motherboard and keep it out for 5 minutes and then put it back in and reboot.If your system still does not start it means something has gone kaput.</p>
<p>7) If you encounter step 6,its highly likely that either your power supply or motherboard were not upto the task or you have been overenthusiastic and pushed your system too hard.</p>
<p>This concludes ocing section.</p>
<p><span class="shead"><span class="sheadin">End Notes</span></span></p>
<div class="note">
<p>Common BSOD&#8217;S/BCCODES</p>
<p>0x101 = increase vcore.</p>
<p>0x124 = increase/decrease vcore or QPI/VTT&#8230;have to test to see which one it is.</p>
<p>0x0A = unstable RAM/IMC, increase QPI first, if that doesn&#8217;t work increase vcore.</p>
<p>0x1E = increase vcore.</p>
<p>0x3B = increase vcore.</p>
<p>0xD1 = QPI/VTT, increase/decrease as necessary.</p>
<p>0x9C = QPI/VTT most likely, but increasing vcore has helped in some instances.</p>
<p>0x50 = RAM timings/Frequency or uncore multi unstable, increase RAM voltage or adjust QPI/VTT, or lower uncore if you&#8217;re higher than 2x.</p>
<p>0x116 = Low IOH (NB) voltage, GPU issue (most common when running multi-GPU/overclocking GPU).</p>
<p>0x00000109 = Not enough or too Much memory voltage.</p>
<p>0x7E = System Drivers issue.</p>
<p>0x24 = Disk corruption (Did you OC the PCI-E bus?).</p>
<p>0XC2 = Some s/w and/or driver related BSOD.</p>
</div>
<p>This concludes the guide.</p>
<p>The post <a href="https://www.ocfreaks.com/overclocking-guide-for-intel-lga1156-platform-cpus/">Overclocking Guide for Intel LGA1156 Platform CPUs</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ocfreaks.com/overclocking-guide-for-intel-lga1156-platform-cpus/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">33</post-id>	</item>
		<item>
		<title>Legacy Intel LGA 775 / AMD AMx CPU Overclocking Guide</title>
		<link>https://www.ocfreaks.com/legacy-intel-lga-775-amd-am2-overclocking-guide/</link>
					<comments>https://www.ocfreaks.com/legacy-intel-lga-775-amd-am2-overclocking-guide/?noamp=mobile#comments</comments>
		
		<dc:creator><![CDATA[Umang Gajera]]></dc:creator>
		<pubDate>Mon, 19 Mar 2012 16:24:45 +0000</pubDate>
				<category><![CDATA[Guides & Tutorials]]></category>
		<category><![CDATA[AMD]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[overclocking]]></category>
		<guid isPermaLink="false">http://www.ocfreaks.com/?p=67</guid>

					<description><![CDATA[<p>Before I start the core just keep in mind &#8211; what the acronyms below mean(Just in case you are a complete noob like me ): &#8211; OCing = OverClocking &#8211; Northbridge = NB = MCH &#8211; Mobo = Motherboard &#8211; Proccy = Processor Legacy Intel LGA 775 Overclocking Basically Front Side Bus (FSB) is set [&#8230;]</p>
<p>The post <a href="https://www.ocfreaks.com/legacy-intel-lga-775-amd-am2-overclocking-guide/">Legacy Intel LGA 775 / AMD AMx CPU Overclocking Guide</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Before I start the core just keep in mind &#8211; what the acronyms below mean(Just in case you are a complete noob like me ):</p>
<div class="highlight_rcb_lite">
<ul>
<li>&#8211; OCing = OverClocking</li>
<li>&#8211; Northbridge = NB = MCH</li>
<li>&#8211; Mobo = Motherboard</li>
<li>&#8211; Proccy = Processor</li>
</ul>
</div>
<p><span class="shead"><span class="sheadin">Legacy Intel LGA 775 Overclocking</span></span></p>
<p>Basically Front Side Bus (FSB) is set of wires i.e. a Bus that connects CPU to the “Northbridge(Chipset)”.By the way &#8211; Intel also calls the Northbridge as “Memory Controller Hub” or MCH for short.</p>
<p>Wait … what is the Northbridge in the first place?</p>
<div class="note">Hmm… If CPU is the brain of our computer then the Northbrigde(Chipset) is the Heart of your computer. The Northbridge is the bigger chip of the 2 in the chipset &#8211; the other being the southbridge. The Northbridge is the gateway/door for the CPU to access and control all the components inside the PC. If the Northbridge fails then the bridge between the CPU and other computer components breaks which renders the CPU a complete etched-silicon crap!</div>
<p>Now back to where I was …</p>
<p>This FSB is the address and data bus which the CPU uses. The CPU interacts with all the other components of the computer through the FSB via the Northbridge. Since the Northbridge is so central to all the connections in the computer &#8211; increasing the FSB will also increase the speed at which other components interact with the Northbridge which in turn will increase the system performance. Overclocking the FSB may be a little tricky for someone new because the base clock rate differs from the effective(actual) clock rate which is termed as ‘Quad-Pumping’ by Intel.</p>
<p>On systems that support Intel processors the FSB is Quad Pumped which can be stated as :</p>
<div class="highlight_rcb_lite"><strong>Quad Pumped FSB (QFSB) = 4 x Base FSB</strong></div>
<p>Hence for eg. a system running at 1333 MHz FSB has a base FSB frequency of 333 MHz.</p>
<p>One of the key factors that makes FSB the first choice to be overclocked is that the CPU’s speed is determined by the Base FSB which is then multiplied by the CPU Multiplier which sets the operating frequency of the CPU.This relation of proportionality between the CPU and FSB frequency gives an instant CPU speed boost when the FSB is increased given that the multiplier remains the same.</p>
<p>The formula is given as :</p>
<div class="highlight_rcb_lite"><strong>CPU Speed = Base FSB x CPU Multiplier</strong></div>
<p>The CPU multiplier is also referred to as CPU to FSB ratio in some BIOSes &#8211; its logical because if you divide CPU frequency with FSB freq what we get is the CPU Multiplier.</p>
<div class="highlight_rcb_lite"><strong>CPU Multiplier = CPU Speed : Base FSB</strong></div>
<p>Lets take an example of Q9300 which has native FSB of 1333 MHz (Quad Pumped) and Multiplier ‘Top-Locked’ to 7.5</p>
<div class="highlight_rcb_lite">Now Base FSB = 333 MHz hence ,<br />
CPU speed = 333 x 7.5 = 2.5 GHz which is the stock speed for Q9300</div>
<p><strong>Native Processor FSB</strong> is the default FSB which is used to generate the CPU frequency. Each processor has its own predefined default FSB. When every thing is set to default &#8211; i.e. no Overclocking &#8211; the CPU dictates the Northbrigde that it wants to work at the default CPU FSB.</p>
<p>When is comes to FSB we are mainly concerned with max FSB supported by the motherboard and the native FSB of the processor. The Q9xx0 series Quads from Intel may have the edge of being 45nm based and slightly faster than the 65nm based Q6×00 series Quads. But the 45nm Quads have higher native FSB of 1333 MHz which makes it difficult to overclock beyond a limit and it even gets worse for quads like Q9300 which has the multiplier at 7.5 max. Consider today’s p35 , x38 , p45 , x48 chipset based motherboards which can be OCed to 1600MHz easily but not quite beyond 2000 MHz i.e. a Base FSB of 500 MHz is limit for the current generation chipsets. Now with Q9300 the ‘max possible (can be pushed more)’ overclock will be = 500 x 7.5 = 3.75 GHz which does not make it suitable for Overclocking because such a high FSB will tax both the chipset and also the RAM to maintain good FSB : DRAM ratios [ill explain RAM OCing in next Article].</p>
<p>On the other hand lets consider Q6600 which has 1066MHz with multiplier of 9 max. With Q6600 the ‘max possible’ OC will be = 500 x 9 = 4.5 GHz which some have reached. I remember that the Tom’s Hardware team from France managed to push Q6600 up to 5 GHz on liquid nitrogen. Due to this relation between the Base FSB and the CPU Multiplier the CPU having native FSB less then the max FSB supported by the motherboard has a more Overclocking head room than a CPU have native FSB same as the max FSB of the motherboard.</p>
<p>In our consideration of Q9300 and Q6600 I would go with Q6600 because its more Overclockable and will not tax the chipset with extreme high FSB as with Q9300. But on the other side the main advantage of Q9300 is the higher FSB itself. Since the native FSB of the processor dictates the default FSB at which the system will run having higher default FSB will make system run fast due to higher FSB. But the down fall is that further OC is possible from the default FSB , hence more the head room more is the Overclockability.</p>
<p><span class="shead"><span class="sheadin"> AMD With HTT </span></span></p>
<p>On AMD systems the bus used to interface the CPU with Northbridge uses HyperTransport Technology (HTT) which was earlier called Lighting Data Transport (LDT). This is similar to FSB on Intel systems which uses Assisted/Advanced Gunning Transreceiver Logic (AGTL+). On AMD systems the bus speed is the base HT speed from which we get the HT Link speed.</p>
<p>Here’s the formula :</p>
<div class="highlight_rcb_lite"><strong>HT Link freq = Base HT x HT(LDT) Multiplier</strong></div>
<p>Usually the HT multiplier swing is limited between 1 and 5(max).<br />
So if we have bus speed of 200 MHz and HT multiplier set to 5x then our HT link speed will be : <strong>200 x 5 = 1000 MHz </strong>HT Link</p>
<p>The HT link speed is used to get actual data rate of the system bus. Since HTT can transfer data twice per clock pulse (Double Data Rate) the effective can be calculated as :</p>
<div class="highlight_rcb_lite"><strong>HT Link x 2 (DDR) = Effective Bus Data Rate</strong></div>
<p>In our case we have: <strong>1000 MHz x 2 = 2000 MHz</strong> Effective Bus Data Rate</p>
<p>As on Intel systems the CPU speed here is also obtained by multiplying the CPU Multiplier with the bus speed (Base HT) which is as follows :</p>
<div class="highlight_rcb_lite"><strong>CPU speed = Base HT x CPU Multiplier</strong></div>
<p>Lets say we have an AMD X2 5000+ which has its multiplier set to 13 . Hence in our case the CPU would be : <strong>200 x 13 = 2600 MHz = 2.6 GHz</strong></p>
<p>The post <a href="https://www.ocfreaks.com/legacy-intel-lga-775-amd-am2-overclocking-guide/">Legacy Intel LGA 775 / AMD AMx CPU Overclocking Guide</a> appeared first on <a href="https://www.ocfreaks.com">OCFreaks!</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ocfreaks.com/legacy-intel-lga-775-amd-am2-overclocking-guide/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">67</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

Page Caching using Disk: Enhanced 

Served from: www.ocfreaks.com @ 2026-03-05 10:24:08 by W3 Total Cache
-->