{"id":3133,"date":"2025-01-04T13:58:38","date_gmt":"2025-01-04T13:58:38","guid":{"rendered":"https:\/\/blog.embeddedexpert.io\/?p=3133"},"modified":"2025-01-04T13:58:40","modified_gmt":"2025-01-04T13:58:40","slug":"creating-a-library-for-pca9685-pwm-module-part-1-getting-the-required-information","status":"publish","type":"post","link":"https:\/\/blog.embeddedexpert.io\/?p=3133","title":{"rendered":"Creating a Library for PCA9685 PWM module Part 1: Getting the Required Information"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/39110e75-9027-44da-9e8c-2647503bff70.webp\" alt=\"\" class=\"wp-image-3134\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/39110e75-9027-44da-9e8c-2647503bff70.webp 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/39110e75-9027-44da-9e8c-2647503bff70-300x300.webp 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/39110e75-9027-44da-9e8c-2647503bff70-150x150.webp 150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/39110e75-9027-44da-9e8c-2647503bff70-768x768.webp 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/39110e75-9027-44da-9e8c-2647503bff70-750x750.webp 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/39110e75-9027-44da-9e8c-2647503bff70-400x400.webp 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/39110e75-9027-44da-9e8c-2647503bff70-250x250.webp 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>In this guide, we shall see how to build a library to PCF9685.<\/p>\n\n\n\n<p>In this guide, we shall cover the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Introduction.<\/li>\n\n\n\n<li>Getting the datasheet.<\/li>\n\n\n\n<li>Gathering the information.<\/li>\n\n\n\n<li>Connection.<\/li>\n\n\n\n<li>STM32CubeIDE setup.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Introduction:<\/h2>\n\n\n\n<p>The PCA9685 is a versatile 16-channel, 12-bit PWM controller widely used in applications requiring precise control of servos, LEDs, or other devices. It communicates via the I2C protocol and can independently control up to 16 outputs with a resolution of 12 bits. This makes it ideal for robotics, lighting, and general automation tasks. The module simplifies PWM generation, freeing up the microcontroller for other tasks.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Getting the Datasheet:<\/h2>\n\n\n\n<p>To work effectively with the PCA9685, it is essential to refer to its datasheet. The datasheet provides detailed information on the module&#8217;s features, registers, and electrical characteristics. You can download the datasheet from the official NXP website or from reliable electronics documentation repositories. Familiarize yourself with the following sections:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Pin Description<\/strong>: To understand the purpose of each pin.<\/li>\n\n\n\n<li><strong>Register Map<\/strong>: For configuring and controlling the module.<\/li>\n\n\n\n<li><strong>Electrical Characteristics<\/strong>: To ensure compatibility with your STM32 microcontroller.<\/li>\n<\/ul>\n\n\n\n<p>You can get the datasheet from <a href=\"https:\/\/cdn-shop.adafruit.com\/datasheets\/PCA9685.pdf\" data-type=\"link\" data-id=\"https:\/\/cdn-shop.adafruit.com\/datasheets\/PCA9685.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. Gathering the Information:<\/h2>\n\n\n\n<p>From the datasheet, we can the find the following data:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"775\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-40-27-1024x775.jpg\" alt=\"\" class=\"wp-image-3135\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-40-27-1024x775.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-40-27-300x227.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-40-27-768x581.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-40-27-1536x1162.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-40-27-2048x1549.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-40-27-1150x870.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-40-27-750x567.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-40-27-400x303.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-40-27-250x189.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Block Diagram:<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"723\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-42-56-1024x723.jpg\" alt=\"\" class=\"wp-image-3136\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-42-56-1024x723.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-42-56-300x212.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-42-56-768x542.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-42-56-1536x1085.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-42-56-1150x812.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-42-56-750x530.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-42-56-400x282.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-42-56-250x177.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-42-56.jpg 1926w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Feel free to dig deeper into the datasheet for more details.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. Connection:<\/h2>\n\n\n\n<p>The connection of the module as following:<\/p>\n\n\n\n<p>Since the board used in this guide is STM32F411RE Nucleo-64.<\/p>\n\n\n\n<p>The board features Arduino Uno pinout, D14 and D15 features I2C pins as shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"609\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-18-16-1024x609.jpg\" alt=\"\" class=\"wp-image-2936\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-18-16-1024x609.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-18-16-300x179.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-18-16-768x457.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-18-16-1536x914.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-18-16-2048x1219.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-18-16-1150x684.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-18-16-750x446.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-18-16-400x238.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-18-16-250x149.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>These pins can be found in the pinout in the user manual of STM32 Nucleo-64 boards (MB1136) as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"508\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-17-28-1024x508.jpg\" alt=\"\" class=\"wp-image-2937\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-17-28-1024x508.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-17-28-300x149.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-17-28-768x381.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-17-28-1536x762.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-17-28-2048x1015.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-17-28-1150x570.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-17-28-750x372.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-17-28-400x198.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-17-28-250x124.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PB8(D15) is SCL which is Serial Clock.<\/li>\n\n\n\n<li>PB9(D14) is SDA which is Serial Data.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"801\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-48-32-1024x801.jpg\" alt=\"\" class=\"wp-image-3137\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-48-32-1024x801.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-48-32-300x235.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-48-32-768x601.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-48-32-1536x1201.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-48-32-2048x1602.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-48-32-1150x899.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-48-32-750x587.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-48-32-400x313.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-48-32-250x196.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>PCA9685<\/td><td>STM32F411 Nucleo-64<\/td><\/tr><tr><td>Vcc<\/td><td>5V<\/td><\/tr><tr><td>GND<\/td><td>GND<\/td><\/tr><tr><td>SDA<\/td><td>PB9<\/td><\/tr><tr><td>SCL<\/td><td>PB8<\/td><\/tr><tr><td>OE<\/td><td>PA0<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">5. STM32CubeIDE Setup:<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>Open STM32CubeIDE after selecting the workspace and create new project as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"355\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-1024x355.jpg\" alt=\"\" class=\"wp-image-2940\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-1024x355.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-300x104.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-768x266.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-1536x532.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-2048x709.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-1150x398.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-750x260.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-400x139.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-250x87.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Select the MCU:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"832\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-1024x832.jpg\" alt=\"\" class=\"wp-image-2941\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-1024x832.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-300x244.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-768x624.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-1536x1248.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-2048x1664.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-1150x934.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-750x609.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-400x325.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-250x203.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Give the project a name:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"813\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-55-33-813x1024.jpg\" alt=\"\" class=\"wp-image-3138\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-55-33-813x1024.jpg 813w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-55-33-238x300.jpg 238w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-55-33-768x968.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-55-33-750x945.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-55-33-400x504.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-55-33-250x315.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-55-33.jpg 984w\" sizes=\"(max-width: 813px) 100vw, 813px\" \/><\/figure>\n\n\n\n<p>Make sure the Targeted Project Type is STM32Cube, Language is C and binary type is Executable.<\/p>\n\n\n\n<p>After that, set PB8 and PB9 for I2C1 or I2C3, here we shall use I2C1 as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"849\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-57-05-1024x849.jpg\" alt=\"\" class=\"wp-image-3139\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-57-05-1024x849.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-57-05-300x249.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-57-05-768x637.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-57-05-1536x1274.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-57-05-1150x954.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-57-05-750x622.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-57-05-400x332.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-57-05-250x207.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/01\/2025-01-04_16-57-05.jpg 1982w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Also, set PA0 as GPIO output.<\/p>\n\n\n\n<p>Next Enable I2C1 as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"918\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-42-25-1024x918.jpg\" alt=\"\" class=\"wp-image-2945\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-42-25-1024x918.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-42-25-300x269.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-42-25-768x688.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-42-25-1150x1031.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-42-25-750x672.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-42-25-400x359.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-42-25-250x224.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-42-25.jpg 1504w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>From parameter Settings of I2C1 enable the fast mode as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"865\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/12\/2024-12-29_07-17-08-865x1024.jpg\" alt=\"\" class=\"wp-image-3123\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/12\/2024-12-29_07-17-08-865x1024.jpg 865w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/12\/2024-12-29_07-17-08-254x300.jpg 254w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/12\/2024-12-29_07-17-08-768x909.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/12\/2024-12-29_07-17-08-750x887.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/12\/2024-12-29_07-17-08-400x473.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/12\/2024-12-29_07-17-08-250x296.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/12\/2024-12-29_07-17-08.jpg 1146w\" sizes=\"(max-width: 865px) 100vw, 865px\" \/><\/figure>\n\n\n\n<p>From Clock Configuration tab, set the frequency to maximum of 100MHz as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"495\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-44-17-1024x495.jpg\" alt=\"\" class=\"wp-image-2948\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-44-17-1024x495.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-44-17-300x145.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-44-17-768x371.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-44-17-1536x742.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-44-17-2048x989.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-44-17-1150x555.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-44-17-750x362.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-44-17-400x193.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-44-17-250x121.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>From Project Manager tab, select Code Generation and enable Generate peripheral initialization as pair of .c\/.h files per peripheral as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"363\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-1024x363.jpg\" alt=\"\" class=\"wp-image-2949\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-1024x363.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-300x106.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-768x273.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-1536x545.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-2048x727.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-1150x408.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-750x266.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-400x142.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-250x89.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Thats all for the configuration.<\/p>\n\n\n\n<p>Save the project and this will generate the project.<\/p>\n\n\n\n<p>In part 2, we start developing the library.<\/p>\n\n\n\n<p>Happy coding\u00a0\ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, we shall see how to build a library to PCF9685. In this guide, we shall cover the following: 1. Introduction: The PCA9685 is a versatile 16-channel, 12-bit PWM controller widely used in applications requiring precise control of servos, LEDs, or other devices. It communicates via the I2C protocol and can independently control [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,11,12],"tags":[],"class_list":["post-3133","post","type-post","status-publish","format-standard","hentry","category-embedded-systems","category-peripheral-drivers","category-stm32"],"_links":{"self":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/3133"}],"collection":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3133"}],"version-history":[{"count":1,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/3133\/revisions"}],"predecessor-version":[{"id":3140,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/3133\/revisions\/3140"}],"wp:attachment":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}