{"id":4323,"date":"2019-05-01T20:00:46","date_gmt":"2019-05-01T18:00:46","guid":{"rendered":"https:\/\/msalamon.pl\/?p=4323"},"modified":"2025-12-27T19:54:02","modified_gmt":"2025-12-27T18:54:02","slug":"no-more-gpio-multiplexing-max7219-in-action-part-1","status":"publish","type":"post","link":"https:\/\/msalamon.pl\/en\/no-more-gpio-multiplexing-max7219-in-action-part-1\/","title":{"rendered":"No More GPIO Multiplexing! MAX7219 in Action, Part 1"},"content":{"rendered":"\n<p>I remember how many years ago multiplexing an LED matrix was a nightmare for me. Geez\u2026 how badly I went through it. From today\u2019s perspective I don\u2019t understand my past self at all. It really isn\u2019t as difficult as it seemed to me back then. Today it\u2019s even simpler! We have specialized multiplexing chips designed for LED displays, and that\u2019s beautiful. Let\u2019s get cracking!<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Complete series of posts:<\/p>\n\n\n\n<p><a href=\"http:\/\/msalamon.pl\/nigdy-wiecej-multipleksowania-na-gpio-max7219-w-akcji-cz-1\/\">Never again multiplexing on GPIO! MAX7219 in action part 1<\/a><\/p>\n\n\n\n<p><a href=\"http:\/\/msalamon.pl\/nigdy-wiecej-multipleksowania-na-gpio-max7219-w-akcji-cz-2\/\">Never again multiplexing on GPIO! MAX7219 in action part 2<\/a><\/p>\n\n\n\n<p><a href=\"http:\/\/msalamon.pl\/nigdy-wiecej-multipleksowania-na-gpio-max7219-w-akcji-cz-3\/\">Never again multiplexing on GPIO! MAX7219 in action part 3<\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">MAX7219<\/h1>\n\n\n\n<p>One such chip is the MAX7129 (<a data-e-disable-page-transition=\"true\" class=\"download-link\" title=\"\" href=\"https:\/\/msalamon.pl\/download\/738\/?tmstv=1766859691\" rel=\"nofollow\" id=\"download-link-738\" data-redirect=\"false\"><br>MAX7219-MAX7221 Datasheet.pdf<\/a><br>) which I\u2019m discussing today. It\u2019s a chip that can control LED displays with a <strong>common cathode<\/strong>. It can handle <a href=\"https:\/\/sklep.msalamon.pl\/produkt\/max7219-wyswietlacz-7-segmentowy-8-cyfr\/?utm_source=blog&amp;utm_medium=article&amp;utm_campaign=max7219&amp;utm_content=Text\">8 seven-segment displays + dot<\/a>, i.e. a total of 64 LEDs. They don\u2019t necessarily have to be segment displays. They can also be 8\u00d78 matrices, as you\u2019ll see later. Interestingly, it has a built-in BCD decoder that can make working with the chip easier. It uses built-in RAM to remember what to display.<\/p>\n\n\n\n<p>We can talk to the chip via the SPI interface. The chip supports cascading, which allows connecting the ICs into long chains. This is a feature that enables large LED matrix sizes.<\/p>\n\n\n\n<p>Manufacturers in the Far East produce modules with the <a href=\"https:\/\/sklep.msalamon.pl\/produkt\/max7219-wyswietlacz-7-segmentowy-8-cyfr\/?utm_source=blog&amp;utm_medium=article&amp;utm_campaign=max7219&amp;utm_content=Text\">MAX7219<\/a> in versions with seven-segment displays and with 8\u00d78 matrices.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/sklep.msalamon.pl\/produkt\/max7219-wyswietlacz-7-segmentowy-8-cyfr\/?utm_source=blog&amp;utm_medium=banner&amp;utm_campaign=max7219&amp;utm_content=digits\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"341\" src=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2018\/09\/MAX7219_digits_baner-1024x341.jpg\" alt=\"\" class=\"wp-image-958\" srcset=\"https:\/\/msalamon.pl\/wp-content\/uploads\/2018\/09\/MAX7219_digits_baner-1024x341.jpg 1024w, https:\/\/msalamon.pl\/wp-content\/uploads\/2018\/09\/MAX7219_digits_baner-300x100.jpg 300w, https:\/\/msalamon.pl\/wp-content\/uploads\/2018\/09\/MAX7219_digits_baner-768x256.jpg 768w, https:\/\/msalamon.pl\/wp-content\/uploads\/2018\/09\/MAX7219_digits_baner-24x8.jpg 24w, https:\/\/msalamon.pl\/wp-content\/uploads\/2018\/09\/MAX7219_digits_baner-36x12.jpg 36w, https:\/\/msalamon.pl\/wp-content\/uploads\/2018\/09\/MAX7219_digits_baner-160x53.jpg 160w, https:\/\/msalamon.pl\/wp-content\/uploads\/2018\/09\/MAX7219_digits_baner.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Schematic and Cube<\/h2>\n\n\n\n<p>The modules supplied by Chinese manufacturers are very simple to connect. The board has pins on two sides. One side is the input, the other is the output for cascading. Since we can\u2019t read anything from the chip, the SPI connection and configuration will be in <em>Master Transmit Only<\/em> mode. Today an <a href=\"https:\/\/sklep.msalamon.pl\/produkt\/nucleo-l476rg\/?utm_source=blog&amp;utm_medium=article&amp;utm_campaign=jak-zaczac-z-stm32&amp;utm_content=Text\">STM32L476RG mounted on a Nucleo board<\/a> landed on my bench.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/sklep.msalamon.pl\/kategoria-produktu\/dev-boardy\/stm32-nucleo\/?utm_source=blog&amp;utm_medium=banner&amp;utm_campaign=max7219&amp;utm_content=nucleo\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"400\" src=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2020\/07\/Nucleo-64-baner.jpg\" alt=\"\" class=\"wp-image-1593\" srcset=\"https:\/\/msalamon.pl\/wp-content\/uploads\/2020\/07\/Nucleo-64-baner.jpg 1200w, https:\/\/msalamon.pl\/wp-content\/uploads\/2020\/07\/Nucleo-64-baner-300x100.jpg 300w, https:\/\/msalamon.pl\/wp-content\/uploads\/2020\/07\/Nucleo-64-baner-1024x341.jpg 1024w, https:\/\/msalamon.pl\/wp-content\/uploads\/2020\/07\/Nucleo-64-baner-768x256.jpg 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>The connection schematic looks like this:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_schematic.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"512\" src=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_schematic-1024x512.jpg\" alt=\"\" class=\"wp-image-740\" srcset=\"https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_schematic-1024x512.jpg 1024w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_schematic-300x150.jpg 300w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_schematic-768x384.jpg 768w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_schematic-24x12.jpg 24w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_schematic-36x18.jpg 36w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_schematic-160x80.jpg 160w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_schematic.jpg 1400w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_cubemx.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"658\" src=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_cubemx-1024x658.jpg\" alt=\"\" class=\"wp-image-741\" srcset=\"https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_cubemx-1024x658.jpg 1024w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_cubemx-300x193.jpg 300w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_cubemx-768x493.jpg 768w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_cubemx-24x15.jpg 24w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_cubemx-36x23.jpg 36w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_cubemx-125x80.jpg 125w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_digits_cubemx.jpg 1230w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>As usual, I set the MCU main clock to as much as the factory allows \u2013 80 MHz. It\u2019s quite convenient for testing single chips. The SPI prescaler will initially have a value of 64, which results in 1.25 MHz on the serial interface clock. The CS pin can be configured as <em>Software<\/em> or <em>Hardware<\/em>. We\u2019ll handle both cases.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Coding, coding, coding!<\/h2>\n\n\n\n<p>MAX7219 provides several configuration registers.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_register_map.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"252\" height=\"300\" src=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_register_map-252x300.jpg\" alt=\"\" class=\"wp-image-742\" srcset=\"https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_register_map-252x300.jpg 252w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_register_map-20x24.jpg 20w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_register_map-30x36.jpg 30w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_register_map-67x80.jpg 67w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/03\/max7219_register_map.jpg 579w\" sizes=\"auto, (max-width: 252px) 100vw, 252px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>What can we do with them? Besides the obvious Digit X registers, the others allow you to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Enter Shutdown mode \u2013 turn off the oscillator, blank the LEDs<\/li>\n\n\n\n<li>Change LED brightness by setting the duty cycle of the applied signal<\/li>\n\n\n\n<li>Set the scan limit \u2013 limit displaying up to the i-th digit<\/li>\n\n\n\n<li>Enable display test \u2013 all LEDs light at maximum brightness<\/li>\n<\/ul>\n\n\n\n<p>All these maneuvers are handled in my library via convenient enums.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">MAX7219_STATUS MAX7219_SetDecodeMode(uint8_t DeviceNumber, MAX7219_DecodeMode DecodeMode);\nMAX7219_STATUS MAX7219_SetIntensity(uint8_t DeviceNumber, uint8_t Intensity);\nMAX7219_STATUS MAX7219_SetScanLimit(uint8_t DeviceNumber, MAX7219_ScanLimit Limit);\nMAX7219_STATUS MAX7219_Shutdown(uint8_t DeviceNumber, MAX7219_ShutdownMode Shutdown);\nMAX7219_STATUS MAX7219_SetDisplayTest(uint8_t DeviceNumber, MAX7219_TestMode Enable);<\/pre>\n\n\n\n<p>The basic configuration is performed during initialization, to which, as is typical for me, you need to pass a pointer to SPI.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">MAX7219_STATUS MAX7219_Init(SPI_HandleTypeDef *hspi);<\/pre>\n\n\n\n<p>Alright, but there\u2019s also a \u2018register\u2019 called No-Op. As the name suggests, sending this to the chip causes no operation. What is it for? It\u2019s used for cascade mode, where data applied to DIN are then forwarded to DOUT.<\/p>\n\n\n\n<p>MAX7219 works like a shift register. Data written into it are latched when the CS signal returns to a high state. Then the last 16 bits that ended up in the register are the ones that determine the operation performed. I\u2019ll describe this in more detail when we get to the cascade.<\/p>\n\n\n\n<p>Setting a digit for a single chip is easy. You just need to send the selected value to the appropriate register. Keep in mind which decode setting is selected. If the <a href=\"https:\/\/sklep.msalamon.pl\/produkt\/max7219-wyswietlacz-7-segmentowy-8-cyfr\/?utm_source=blog&amp;utm_medium=article&amp;utm_campaign=max7219&amp;utm_content=Text\">MAX7219<\/a> is to decode BCD into the appropriate segments by itself, it suffices to send a number in the range 0\u00f79.<\/p>\n\n\n\n<p>However, I encourage you not to use the BCD decoder. Why? Because you can define more characters on the display. I prepared a list of letters that came to my mind and can be realized on 7-segments. Nothing stands in the way of adding your own.<\/p>\n\n\n\n<p>To set individual digits, use the function<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">MAX7219_STATUS MAX7219_SetDigit(uint8_t DeviceNumber, uint8_t Digit, uint8_t Value, uint8_t Dot);<\/pre>\n\n\n\n<p>Note that the numbering of <em>Digit<\/em> kind of starts from the end. Digit zero is on the right, and the seventh on the left. That\u2019s not very natural for us, but the display is physically connected that way to the chip\u2019s pins.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Printing<\/h3>\n\n\n\n<p>But is sending single characters convenient? Not really. It\u2019s much better to use something like <em>printf<\/em>. For this purpose I created a few helper functions.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">MAX7219_STATUS MAX7219_PutString(int Start, char *String);\nMAX7219_STATUS MAX7219_PutStringRightAdjust(char *String);\nMAX7219_STATUS MAX7219_PutStringLeftAdjust(char *String);\nMAX7219_STATUS MAX7219_PutStringCenterAdjust(char *String);<\/pre>\n\n\n\n<p>The first one writes a string starting from position <em>Start<\/em>. At this point I fixed the inhuman digit layout across the display and position zero is on the left. The function accepts all ASCII characters that I defined under their real codes. It\u2019s therefore easy to just write whatever you want. Characters that are not in the defined table are skipped.<\/p>\n\n\n\n<p>Alright, but what about the dot?! On seven-segment displays it\u2019s an integral part of the digit! That\u2019s right, and I prepared for that objection. Printing handles dots. When a dot appears as a character in the string, it is appended to the digit. Check yourself how it works.<\/p>\n\n\n\n<p>The other 3 functions are a little gimmick. They are intended to align the input string to the right, to the left, and to center it. Just like in text editors.<\/p>\n\n\n\n<p>All these functions support cascading, which I\u2019ll discuss in the next part of the post.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Operation<\/h2>\n\n\n\n<p>Another quick look at how it works. Let\u2019s first check how long it takes to display all eight digits.<\/p>\n\n\n\n<p>SCK 1.25 MHz<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_10MHz.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"203\" src=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_1_25MHz-1024x203.jpg\" alt=\"\" class=\"wp-image-867\" srcset=\"https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_1_25MHz-1024x203.jpg 1024w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_1_25MHz-300x59.jpg 300w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_1_25MHz-768x152.jpg 768w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_1_25MHz-1536x304.jpg 1536w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_1_25MHz-24x5.jpg 24w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_1_25MHz-36x7.jpg 36w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_1_25MHz-160x32.jpg 160w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_1_25MHz.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>SCK 2.5 MHz<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_10MHz.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"203\" src=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_2_5MHz-1024x203.jpg\" alt=\"\" class=\"wp-image-868\" srcset=\"https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_2_5MHz-1024x203.jpg 1024w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_2_5MHz-300x59.jpg 300w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_2_5MHz-768x152.jpg 768w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_2_5MHz-1536x304.jpg 1536w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_2_5MHz-24x5.jpg 24w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_2_5MHz-36x7.jpg 36w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_2_5MHz-160x32.jpg 160w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_2_5MHz.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>SCK 5 MHz<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_10MHz.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"203\" src=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_5MHz-1024x203.jpg\" alt=\"\" class=\"wp-image-869\" srcset=\"https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_5MHz-1024x203.jpg 1024w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_5MHz-300x59.jpg 300w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_5MHz-768x152.jpg 768w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_5MHz-1536x304.jpg 1536w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_5MHz-24x5.jpg 24w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_5MHz-36x7.jpg 36w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_5MHz-160x32.jpg 160w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_5MHz.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_10MHz.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"203\" src=\"http:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_10MHz-1024x203.jpg\" alt=\"\" class=\"wp-image-866\" srcset=\"https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_10MHz-1024x203.jpg 1024w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_10MHz-300x59.jpg 300w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_10MHz-768x152.jpg 768w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_10MHz-1536x304.jpg 1536w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_10MHz-24x5.jpg 24w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_10MHz-36x7.jpg 36w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_10MHz-160x32.jpg 160w, https:\/\/msalamon.pl\/wp-content\/uploads\/2019\/04\/max7219_digits_10MHz.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>SCK 10 MHz<\/p>\n\n\n\n<p>The results are as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>1.25 MHz \u2013 176 \u00b5s<\/li>\n\n\n\n<li>2.5 MHz \u2013 118 \u00b5s<\/li>\n\n\n\n<li>5 MHz \u2013 88 \u00b5s<\/li>\n\n\n\n<li>10 MHz \u2013 73 \u00b5s<\/li>\n<\/ul>\n\n\n\n<p>Unfortunately, the chip doesn\u2019t cooperate when it comes to overclocking. Above 10 MHz it starts showing garbage, so the value in the documentation really is the maximum.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p>As you can see, one may consider multiplexing on GPIO a thing of the past. Who would want to do it manually now? Perhaps in applications where the unit price of the device has to be pushed to the absolute limit. However, even then you should consider whether saving on the chip will really be more beneficial than saving the time needed to implement multiplexing.<\/p>\n\n\n\n<p>In the next part I will discuss building a cascade of <a href=\"https:\/\/sklep.msalamon.pl\/produkt\/max7219-wyswietlacz-7-segmentowy-8-cyfr\/?utm_source=blog&amp;utm_medium=article&amp;utm_campaign=max7219&amp;utm_content=Text\">MAX7219<\/a> chips.<\/p>\n\n\n\n<p>If you liked the seven-segment display module described today, you can buy it<a href=\"https:\/\/sklep.msalamon.pl\/produkt\/max7219-wyswietlacz-7-segmentowy-8-cyfr\/\"> in my store<\/a>.<\/p>\n\n\n\n<p>The full project together with the library can be found as usual on my GitHub: <a href=\"https:\/\/github.com\/lamik\/MAX7219_digits_STM32_HAL\" target=\"_blank\" rel=\"noopener\">link<\/a><\/p>\n\n\n\n<p><span>If you noticed any error, disagree with something, would like to add something important, or simply feel like discussing the topic, write a comment. Remember that the discussion should be polite and in accordance with the rules of the Polish language.<\/span><\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-left kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;left&quot;,&quot;id&quot;:&quot;4323&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;0&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;0&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;0&quot;,&quot;greet&quot;:&quot;&quot;,&quot;legend&quot;:&quot;0\\\/5 - (0 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;No More GPIO Multiplexing! MAX7219 in Action, Part 1&quot;,&quot;width&quot;:&quot;0&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 0px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 0px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 0px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 0px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 0px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 0px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 0px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 0px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 0px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 0px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 0px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 19.2px;\">\n            <span class=\"kksr-muted\"><\/span>\n    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>I remember how many years ago multiplexing an LED matrix was a nightmare for me. Geez\u2026 how badly I went through it. From today\u2019s perspective I don\u2019t understand my past self at all. It really isn\u2019t as difficult as it seemed to me back then. Today it\u2019s even simpler! We [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3172,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[160],"tags":[175,176,174,177],"class_list":["post-4323","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-stm32","tag-electronics","tag-programming","tag-stm32","tag-stm32cubemx"],"_links":{"self":[{"href":"https:\/\/msalamon.pl\/en\/wp-json\/wp\/v2\/posts\/4323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/msalamon.pl\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/msalamon.pl\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/msalamon.pl\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/msalamon.pl\/en\/wp-json\/wp\/v2\/comments?post=4323"}],"version-history":[{"count":3,"href":"https:\/\/msalamon.pl\/en\/wp-json\/wp\/v2\/posts\/4323\/revisions"}],"predecessor-version":[{"id":4434,"href":"https:\/\/msalamon.pl\/en\/wp-json\/wp\/v2\/posts\/4323\/revisions\/4434"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/msalamon.pl\/en\/wp-json\/wp\/v2\/media\/3172"}],"wp:attachment":[{"href":"https:\/\/msalamon.pl\/en\/wp-json\/wp\/v2\/media?parent=4323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/msalamon.pl\/en\/wp-json\/wp\/v2\/categories?post=4323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/msalamon.pl\/en\/wp-json\/wp\/v2\/tags?post=4323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}