{"id":3990,"date":"2020-12-01T09:28:56","date_gmt":"2020-12-01T09:28:56","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=3990"},"modified":"2023-09-05T16:06:08","modified_gmt":"2023-09-05T10:36:08","slug":"stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/","title":{"rendered":"STM32 I2C Lecture 12:  I2C Serial clock settings with explanations"},"content":{"rendered":"<div class=\"boldgrid-section\" style=\"background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"container\">\n<div class=\"row\" style=\"padding-top: 50px; padding-bottom: 50px;\">\n<div class=\"col-md-1 col-sm-12 col-xs-12 col-lg-1\">\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"col-md-10 col-sm-12 col-xs-12 col-lg-10\">\n<h1 class=\"\" style=\"text-align: center; border-width: 0px; font-size: 35px; line-height: 60px;\"><span style=\"color: #000080;\">I2C Serial clock settings with Explanations<\/span><\/h1>\n<div class=\"row bg-editor-hr-wrap\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<p>&nbsp;<\/p>\n<div class=\"bg-hr bg-hr-16\" style=\"border-style: solid; border-width: 0px 0px 3px; color: rgba(11, 34, 151, 0.9); margin-top: -25px;\"><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<div class=\"row bg-editor-hr-wrap\">\n<hr>\n<\/div>\n<p>&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In this article, let\u2019s discuss the various settings that should be done to get the desired serial clock out of the I2C peripheral.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Observe the first line of the I2C old trace shown in Figure 1. Here the first line is a serial clock, and it is the standard mode with around 100kHz.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_4001\" aria-describedby=\"caption-attachment-4001\" style=\"width: 666px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-4001\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2020\/11\/Figure-1-3.png\" alt=\"I2C Serial clock settings with Explanations\" width=\"666\" height=\"352\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3.png 1909w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3-768x406.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3-1024x541.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3-600x317.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3-120x63.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3-500x264.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3-400x211.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3-800x423.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3-1200x634.png 1200w\" sizes=\"(max-width: 666px) 100vw, 666px\" \/><figcaption id=\"caption-attachment-4001\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. Serial clock line of the I2C old trace.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The CR2 and CCR registers must be configured to get the desired clock in the stm32f4x I2C peripheral. CR2 and CCR registers are used to control the I2C serial clock settings and other I2C timings like setup time and hold time.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In the I2C_CR2 register, look into the FREQ field or frequency field shown in Figure 2. It stores the information about the APB bus to which the I2C peripheral is connected. That means the value of the APB bus clock of the microcontroller is written in this field.<\/span><\/p>\n<figure id=\"attachment_4002\" aria-describedby=\"caption-attachment-4002\" style=\"width: 687px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-4002\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2020\/11\/Figure-2-2.png\" alt=\"I2C Serial clock settings with Explanations\" width=\"687\" height=\"144\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-2-2.png 1773w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-2-2-300x63.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-2-2-768x161.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-2-2-1024x214.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-2-2-600x126.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-2-2-120x25.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-2-2-500x105.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-2-2-200x42.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-2-2-400x84.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-2-2-800x167.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-2-2-1200x251.png 1200w\" sizes=\"(max-width: 687px) 100vw, 687px\" \/><figcaption id=\"caption-attachment-4002\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. I2C_CR2 register.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Look at the FREQ field of the CR2 register in Figure 3. It says that peripheral clock frequency. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The FREQ bit must be configured with a clock frequency of the APB bus where the I2C peripheral is connected. This field is initialized by using one of the values among 0b000010 to 0b110010.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\"> I2C hardware uses FREQ information to derive its various I2C related timing details according to the specification.&nbsp; So, configuring this field is very important. Just write the value of the APB clock frequency to this field.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_4003\" aria-describedby=\"caption-attachment-4003\" style=\"width: 689px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-4003\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2020\/11\/Figure-3-2.png\" alt=\"I2C Serial clock settings with Explanations\" width=\"689\" height=\"334\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-3-2.png 1388w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-3-2-300x145.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-3-2-768x372.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-3-2-1024x497.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-3-2-600x291.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-3-2-120x58.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-3-2-500x242.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-3-2-200x97.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-3-2-400x194.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-3-2-800x388.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-3-2-1200x582.png 1200w\" sizes=\"(max-width: 689px) 100vw, 689px\" \/><figcaption id=\"caption-attachment-4003\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. FREQ field of the CR2 register<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For example, The internal HSI with 16MHz is used if the I2C peripherals are connected to the APB1 bus. Therefore, the APB1 will be 16MHz. Now load the CR2_FREQ with value 16, and this information will be used by the I2C peripheral, and then with the help of CRC settings, it can produce different frequencies of the serial clock, as shown in Figure 4.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_4004\" aria-describedby=\"caption-attachment-4004\" style=\"width: 706px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4004\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2020\/11\/Figure-4-2.png\" alt=\"I2C Serial clock settings with Explanations\" width=\"706\" height=\"375\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-4-2.png 1915w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-4-2-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-4-2-768x408.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-4-2-1024x544.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-4-2-600x319.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-4-2-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-4-2-500x266.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-4-2-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-4-2-400x212.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-4-2-800x425.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-4-2-1200x637.png 1200w\" sizes=\"(max-width: 706px) 100vw, 706px\" \/><figcaption id=\"caption-attachment-4004\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. Block diagram for producing different frequencies of serial clock<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Next, configure the CCR field of the I2C_CCR register. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now, let\u2019s understand the things that have to be done in the CCR field if the application demands to run in standard mode with a serial clock of 100kHz and APB1 clock (PCLK1) 16MHz. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">A couple of steps should be followed to generate the 100kHz of the serial clock in this case.<\/span><\/p>\n<ol class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li><span style=\"color: #000000;\"><span style=\"font-weight: bold; color: #993366;\">Configure the mode in CCR register:<\/span> Select the I2C mode in the 15th-bit position of the CCR register. The mode can be either standard mode or fast mode. In this example, it is the standard mode.<\/span><\/li>\n<li><span style=\"color: #000000;\"><span style=\"color: #993366;\"><strong>Program FREQ field of CR2 with the value of PCLK1:<\/strong><\/span><span style=\"font-weight: 400;\"> The value of PCLK1 is given, which is 16MHz. Now, program the value 16 into the FREQ field of the CR2 register shown in Figure 2.<\/span><\/span><\/li>\n<li><span style=\"color: #000000;\"><span style=\"color: #993366;\"><strong>Calculate and program CCR value in CCR field of CCR register:<\/strong><\/span> <span style=\"font-weight: 400;\">There is a CCR field in the CCR register, as shown in Figure 5. The steps for calculating the CCR value is given in the reference manual. Since the application demands to run in standard mode, the formula is as shown in Figure 6.<\/span><\/span><\/li>\n<\/ol>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_4005\" aria-describedby=\"caption-attachment-4005\" style=\"width: 707px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-4005\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2020\/11\/Figure-5-1.png\" alt=\"\" width=\"707\" height=\"80\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-5-1.png 1300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-5-1-300x34.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-5-1-768x87.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-5-1-1024x116.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-5-1-600x68.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-5-1-120x14.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-5-1-500x57.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-5-1-200x23.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-5-1-400x45.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-5-1-800x90.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-5-1-1200x136.png 1200w\" sizes=\"(max-width: 707px) 100vw, 707px\" \/><figcaption id=\"caption-attachment-4005\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 5. CCR field of CCR register<\/span><\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<figure id=\"attachment_4006\" aria-describedby=\"caption-attachment-4006\" style=\"width: 271px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4006\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2020\/11\/Figure-6-1.png\" alt=\"\" width=\"271\" height=\"99\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-6-1.png 271w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-6-1-120x44.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-6-1-200x73.png 200w\" sizes=\"(max-width: 271px) 100vw, 271px\" \/><figcaption id=\"caption-attachment-4006\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 6. Formula for calculating CCR in standard mode.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Now let\u2019s calculate the CCR. The application requires a serial clock of 100kHz, which means the period of the clock will be 10 microseconds. If you consider the duty cycle of 50%, T<\/span><span style=\"font-weight: 400;\">high<\/span><span style=\"font-weight: 400;\"> will be 5 microseconds, and T<\/span><span style=\"font-weight: 400;\">low<\/span><span style=\"font-weight: 400;\"> will be 5 microseconds. Substitute these values in the first formula of Figure 6.<\/span><\/span><\/p>\n<p class=\"\" style=\"text-align: center; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">5 x 10 <\/span><span style=\"font-weight: 400;\">-6 <\/span><span style=\"font-weight: 400;\">= CCR x Time period of the APB1 clock<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">The time period of the APB1 clock is 16MHz. When you convert it to time, it will be 62.5 x <\/span><span style=\"font-weight: 400;\">10 <\/span><span style=\"font-weight: 400;\">-9<\/span><span style=\"font-weight: 400;\">.<\/span><\/span><\/p>\n<p class=\"\" style=\"text-align: center; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">5 x 10 <\/span><span style=\"font-weight: 400;\">-6 <\/span><span style=\"font-weight: 400;\">= CCR x <\/span><span style=\"font-weight: 400;\">62.5 x <\/span><span style=\"font-weight: 400;\">10 <\/span><span style=\"font-weight: 400;\">-9<\/span><\/span><\/p>\n<p class=\"\" style=\"text-align: center; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">CCR = (5 \/ 62.5) x 1000<\/span><\/p>\n<p class=\"\" style=\"text-align: center; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">= 80 (or 0x50 hex)&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">So, program value 80 into the CCR field of the CCR register. Therefore, to generate the serial clock of 100kHz, configure 16 in the FREQ field and 80 in the CCR field.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now, let\u2019s see another example for fast mode. In FM mode, generate an SCL frequency of 200kHz and APB1 clock (PCLK1) is 16MHz.<\/span><\/p>\n<p class=\"\" style=\"padding-left: 1.9em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"color: #993366;\"><strong>1.Configure the mode in CCR register:<\/strong> <\/span><span style=\"font-weight: 400;\">Select the I2C mode in the 15th-bit position of the CCR register. The mode can be either standard mode or fast mode. In this example, it is the standard mode.<\/span><\/span><\/p>\n<p class=\"\" style=\"padding-left: 1.9em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"color: #993366;\"><strong>2. Select the duty cycle of fast mode SCL in CCR register:<\/strong> <\/span><span style=\"font-weight: 400;\">While working in the fast mode, it is necessary to configure the duty cycle of the serial clock. When the mode is the fast mode, there are two possible duty cycles, as shown in Figure 7.<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<div class=\"mceTemp\"><\/div>\n<figure id=\"attachment_4007\" aria-describedby=\"caption-attachment-4007\" style=\"width: 707px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-4007\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2020\/11\/Figure-7-1.png\" alt=\"\" width=\"707\" height=\"377\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-7-1.png 931w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-7-1-300x160.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-7-1-768x409.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-7-1-600x320.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-7-1-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-7-1-500x266.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-7-1-200x107.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-7-1-400x213.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-7-1-800x426.png 800w\" sizes=\"(max-width: 707px) 100vw, 707px\" \/><figcaption id=\"caption-attachment-4007\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 7. Types of duty cycles for standard and fast mode.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">In STM32f4x I2C peripheral, in standard mode, T<\/span><span style=\"font-weight: 400;\">low<\/span><span style=\"font-weight: 400;\"> may be equal to T<\/span><span style=\"font-weight: 400;\">high<\/span><span style=\"font-weight: 400;\">, which means the duty cycle will be 50%.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">But in the fast mode, there are two options (Figure 7). In option 1, T<\/span><span style=\"font-weight: 400;\">low<\/span><span style=\"font-weight: 400;\"> will be twice the T<\/span><span style=\"font-weight: 400;\">high<\/span><span style=\"font-weight: 400;\">, and in option 2, T<\/span><span style=\"font-weight: 400;\">low<\/span><span style=\"font-weight: 400;\"> is 1.8 times the T<\/span><span style=\"font-weight: 400;\">high<\/span><span style=\"font-weight: 400;\">. So, in the fast mode, one among these two duty cycles is selected.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">There are recommended values for T<\/span><span style=\"font-weight: 400;\">high<\/span><span style=\"font-weight: 400;\"> and T<\/span><span style=\"font-weight: 400;\">low<\/span><span style=\"font-weight: 400;\"> of the serial clock in the specification document, as shown in Figure 8.<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_4008\" aria-describedby=\"caption-attachment-4008\" style=\"width: 732px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-4008\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2020\/11\/Figure-8.png\" alt=\"\" width=\"732\" height=\"394\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-8.png 936w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-8-300x162.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-8-768x414.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-8-600x323.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-8-120x65.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-8-500x269.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-8-200x108.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-8-400x215.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-8-800x431.png 800w\" sizes=\"(max-width: 732px) 100vw, 732px\" \/><figcaption id=\"caption-attachment-4008\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 8. Recommended values for Thigh and Tlow in the specification document.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Here T<\/span><span style=\"font-weight: 400;\">low<\/span><span style=\"font-weight: 400;\"> means the low period of the serial clock, and T<\/span><span style=\"font-weight: 400;\">high<\/span><span style=\"font-weight: 400;\"> is the high period of the serial clock.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">In the standard communication mode, the minimum requirement for the T<\/span><span style=\"font-weight: 400;\">low<\/span><span style=\"font-weight: 400;\"> is 4.7 microseconds, and for T<\/span><span style=\"font-weight: 400;\">high<\/span><span style=\"font-weight: 400;\">, it is 4 microseconds. In the fast mode, the minimum requirement for the T<\/span><span style=\"font-weight: 400;\">low<\/span><span style=\"font-weight: 400;\"> is 1.3 microseconds, and for T<\/span><span style=\"font-weight: 400;\">high<\/span><span style=\"font-weight: 400;\">, it is 0.6 microseconds.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">For example, if you are using standard mode with a 50% duty cycle at 100kHz, both T<\/span><span style=\"font-weight: 400;\">low<\/span><span style=\"font-weight: 400;\"> and T<\/span><span style=\"font-weight: 400;\">high<\/span><span style=\"font-weight: 400;\"> will be 5 microseconds and indeed meet the standard mode&#8217;s minimum requirement.&nbsp;<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">In the CCR register, the 14th bit is a duty (Figure 9), used to configure the duty cycle. Remember that when the mode is the fast mode, if duty = 0, then the T<\/span><span style=\"font-weight: 400;\">low<\/span><span style=\"font-weight: 400;\"> will be twice the T<\/span><span style=\"font-weight: 400;\">high<\/span><span style=\"font-weight: 400;\">, and if duty = 1, then the maximum serial clock speed in the fast mode is 400kHz (Figure 9). So, the duty must be 1 to achieve the maximum serial clock speed of 400kHz, which means T<\/span><span style=\"font-weight: 400;\">low<\/span><span style=\"font-weight: 400;\"> is approximately equal to 1.8 times the T<\/span><span style=\"font-weight: 400;\">high<\/span><span style=\"font-weight: 400;\">.<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_4009\" aria-describedby=\"caption-attachment-4009\" style=\"width: 713px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4009\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2020\/11\/Figure-9.png\" alt=\"I2C Serial clock settings with Explanations\" width=\"713\" height=\"460\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-9.png 1271w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-9-300x194.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-9-768x495.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-9-1024x661.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-9-600x387.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-9-120x77.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-9-500x323.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-9-200x129.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-9-400x258.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-9-800x516.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-9-1200x774.png 1200w\" sizes=\"(max-width: 713px) 100vw, 713px\" \/><figcaption id=\"caption-attachment-4009\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 9. CCR register\u2019s duty bit.<\/span><\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p class=\"\" style=\"padding-left: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"color: #993366;\"><strong>3<\/strong><b>.&nbsp;<\/b><strong>Program FREQ field of CR2 with the value of PCLK1<\/strong><b>:<\/b><\/span><span style=\"font-weight: 400;\"> The value of PCLK1 is given, which is 16MHz. Now, program the value 16 into the FREQ field of the CR2 register.<\/span><\/span><\/p>\n<p class=\"\" style=\"padding-left: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"color: #993366;\"><strong>4<\/strong><\/span><b><span style=\"color: #993366;\">. Calculate and program CCR value in CCR field of CCR register:<\/span> <\/b><span style=\"font-weight: 400;\">The steps for calculating the CCR value is given in the reference manual. Since the application is in fast mode, the formula is as shown in Figure 10.<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_4010\" aria-describedby=\"caption-attachment-4010\" style=\"width: 652px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4010\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2020\/11\/Figure-10.png\" alt=\"\" width=\"652\" height=\"316\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-10.png 652w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-10-300x145.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-10-600x291.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-10-120x58.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-10-500x242.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-10-200x97.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-10-400x194.png 400w\" sizes=\"(max-width: 652px) 100vw, 652px\" \/><figcaption id=\"caption-attachment-4010\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 10. Figure 6. Formula for calculating CCR in fast mode.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"text-align: center; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Add the T<\/span><span style=\"font-weight: 400;\">high<\/span> <span style=\"font-weight: 400;\">and T<\/span><span style=\"font-weight: 400;\">low <\/span><span style=\"font-weight: 400;\">equations for Duty = 0<\/span><\/span><\/p>\n<p class=\"\" style=\"text-align: center; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">T<\/span><span style=\"font-weight: 400;\">high<\/span> <span style=\"font-weight: 400;\">+ T<\/span><span style=\"font-weight: 400;\">low <\/span><span style=\"font-weight: 400;\">= 3 x CCR x TPCLK1<\/span><\/span><\/p>\n<p class=\"\" style=\"text-align: center; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">(5 x 10 <\/span><span style=\"font-weight: 400;\">-6<\/span><span style=\"font-weight: 400;\">) \/ (3 x 62.5 x 10 <\/span><span style=\"font-weight: 400;\">-9<\/span><span style=\"font-weight: 400;\">) = CCR<\/span><\/span><\/p>\n<p class=\"\" style=\"text-align: center; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">CCR = 26<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">So, program the value 26 to the CCR register.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">If Duty = 1, then the divider factor will be 25 instead of 3.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">This is about the serial clock settings. These are all the settings you have to remember in order to produce different values of the serial clock.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">In the following article, let&#8217;s see<\/span> <span style=\"color: #0000ff;\"><a style=\"color: #0000ff; text-decoration: underline;\" href=\"http:\/\/fastbitlab.com\/stm32-i2c-lecture-13-clock-stretching\/\" target=\"_blank\" rel=\"noopener\">Clock Stretching<\/a>.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><b>FastBit Embedded Brain Academy Courses,<\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 28px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">Click here:<\/span><span style=\"color: #0000ff;\">&nbsp;<\/span><span style=\"color: #0000ff;\"><a style=\"color: #0000ff; text-decoration: underline;\" href=\"http:\/\/fastbitlab.com\/course1\" target=\"_blank\" rel=\"noopener\">https:\/\/fastbitlab.com\/course1<\/a><\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; I2C Serial clock settings with Explanations &nbsp; &nbsp; &nbsp; In this article, let\u2019s discuss the various settings that should be done to get the desired serial clock out of the I2C peripheral. Observe the first line of the I2C old trace shown in Figure 1. Here the first line is a serial clock, and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4001,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[8],"tags":[23],"class_list":["post-3990","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-stm32-i2c-lectures","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>STM32 I2C Lecture 12: I2C Serial clock settings with explanations<\/title>\n<meta name=\"description\" content=\"Learn how to configure and calculate I2C serial clock settings for various modes, including standard and fast mode. Explore the crucial steps\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"STM32 I2C Lecture 12: I2C Serial clock settings with explanations\" \/>\n<meta property=\"og:description\" content=\"Learn how to configure and calculate I2C serial clock settings for various modes, including standard and fast mode. Explore the crucial steps\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/\" \/>\n<meta property=\"og:site_name\" content=\"FastBit EBA\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/fastbiteba\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-01T09:28:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-05T10:36:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1909\" \/>\n\t<meta property=\"og:image:height\" content=\"1009\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"FastBitLab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:site\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FastBitLab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"STM32 I2C Lecture 12: I2C Serial clock settings with explanations\",\"datePublished\":\"2020-12-01T09:28:56+00:00\",\"dateModified\":\"2023-09-05T10:36:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\\\/\"},\"wordCount\":1346,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/Figure-1-3.png\",\"keywords\":[\"STM32 I2C Lectures\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\\\/\",\"name\":\"STM32 I2C Lecture 12: I2C Serial clock settings with explanations\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/Figure-1-3.png\",\"datePublished\":\"2020-12-01T09:28:56+00:00\",\"dateModified\":\"2023-09-05T10:36:08+00:00\",\"description\":\"Learn how to configure and calculate I2C serial clock settings for various modes, including standard and fast mode. Explore the crucial steps\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/Figure-1-3.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/Figure-1-3.png\",\"width\":1909,\"height\":1009,\"caption\":\"Figure 1. Serial clock line of the I2C old trace.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"STM32 I2C Lecture 12: I2C Serial clock settings with explanations\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"name\":\"FastBit EBA\",\"description\":\"Your Online Academy of Embedded Systems\",\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\",\"name\":\"FastBit EBA\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"width\":640,\"height\":640,\"caption\":\"FastBit EBA\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/fastbiteba\\\/\",\"https:\\\/\\\/x.com\\\/fastbiteba\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/fastbit-embedded-brain-academy-b3167b124\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCa1REBV9hyrzGp2mjJCagBg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\",\"name\":\"FastBitLab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"caption\":\"FastBitLab\"},\"description\":\"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"STM32 I2C Lecture 12: I2C Serial clock settings with explanations","description":"Learn how to configure and calculate I2C serial clock settings for various modes, including standard and fast mode. Explore the crucial steps","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/","og_locale":"en_US","og_type":"article","og_title":"STM32 I2C Lecture 12: I2C Serial clock settings with explanations","og_description":"Learn how to configure and calculate I2C serial clock settings for various modes, including standard and fast mode. Explore the crucial steps","og_url":"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2020-12-01T09:28:56+00:00","article_modified_time":"2023-09-05T10:36:08+00:00","og_image":[{"width":1909,"height":1009,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3.png","type":"image\/png"}],"author":"FastBitLab","twitter_card":"summary_large_image","twitter_creator":"@fastbiteba","twitter_site":"@fastbiteba","twitter_misc":{"Written by":"FastBitLab","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"STM32 I2C Lecture 12: I2C Serial clock settings with explanations","datePublished":"2020-12-01T09:28:56+00:00","dateModified":"2023-09-05T10:36:08+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/"},"wordCount":1346,"commentCount":2,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3.png","keywords":["STM32 I2C Lectures"],"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/","url":"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/","name":"STM32 I2C Lecture 12: I2C Serial clock settings with explanations","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3.png","datePublished":"2020-12-01T09:28:56+00:00","dateModified":"2023-09-05T10:36:08+00:00","description":"Learn how to configure and calculate I2C serial clock settings for various modes, including standard and fast mode. Explore the crucial steps","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2020\/11\/Figure-1-3.png","width":1909,"height":1009,"caption":"Figure 1. Serial clock line of the I2C old trace."},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/stm32-i2c-lecture-12-i2c-serial-clock-settings-with-explanations\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"STM32 I2C Lecture 12: I2C Serial clock settings with explanations"}]},{"@type":"WebSite","@id":"https:\/\/fastbitlab.com\/blog\/#website","url":"https:\/\/fastbitlab.com\/blog\/","name":"FastBit EBA","description":"Your Online Academy of Embedded Systems","publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fastbitlab.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fastbitlab.com\/blog\/#organization","name":"FastBit EBA","url":"https:\/\/fastbitlab.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","width":640,"height":640,"caption":"FastBit EBA"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/fastbiteba\/","https:\/\/x.com\/fastbiteba","https:\/\/www.linkedin.com\/in\/fastbit-embedded-brain-academy-b3167b124\/","https:\/\/www.youtube.com\/channel\/UCa1REBV9hyrzGp2mjJCagBg"]},{"@type":"Person","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d","name":"FastBitLab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","caption":"FastBitLab"},"description":"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries."}]}},"_links":{"self":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/3990","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/comments?post=3990"}],"version-history":[{"count":5,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/3990\/revisions"}],"predecessor-version":[{"id":12523,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/3990\/revisions\/12523"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/4001"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=3990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=3990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=3990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}