{"id":5245,"date":"2026-08-03T12:12:21","date_gmt":"2026-08-03T12:12:21","guid":{"rendered":"https:\/\/test.pcbdesignlab.com\/?p=5245"},"modified":"2026-09-13T12:15:42","modified_gmt":"2026-09-13T12:15:42","slug":"spi-communication-protocol","status":"publish","type":"post","link":"https:\/\/www.pcbdesignlab.com\/es\/spi-communication-protocol\/","title":{"rendered":"Protocolo de comunicaci\u00f3n SPI explicado para principiantes"},"content":{"rendered":"<p>SPI looks simple: a clock, data out, data in, and a chip select. That simplicity is why flash, ADCs, and displays still speak it. It is also why a 40 MHz route with long stubs becomes an intermittent boot bug that looks like firmware.<\/p>\n<p>If your flash, ADC, or display link only fails at speed, at cold, or after the enclosure goes on, start with clock integrity and chip-select geometry before rewriting init tables. When the pin count grows into dual or quad data, continue in <a href=\"\/es\/qspi-communication-protocol\/\">QSPI<\/a>. For the wider bus-selection context, see the <a href=\"\/es\/guia-de-interfaces-de-comunicacion-pcb\/\">gu\u00eda de interfaces de comunicaci\u00f3n<\/a>.<\/p>\n<h2>Lines, Modes, and What Firmware Must Match<\/h2>\n<p>SCLK times the shift. MOSI carries master to slave data. MISO returns slave to master data. CS selects a target. Mode numbers encode CPOL and CPHA: idle clock level and which edge samples data. Master and slave must agree or bits look almost right and still fail CRC.<\/p>\n<p>Multiple slaves need either separate CS lines or carefully designed daisy chains. Separate CS is clearer electrically. Shared data lines still need SI discipline.<\/p>\n<h2>PCB Layout Habits That Keep SPI Honest<\/h2>\n<p>Route SCLK as a timing-critical edge. Avoid unnecessary stubs and layer hops. Keep MOSI\/MISO length reasonable relative to the clock timing budget. Provide a continuous reference under the group.<\/p>\n<p>Series resistors near the driver can damp ringing on SCLK and data. Place them with intent; a resistor at the wrong end of a long line is a different circuit. CS should not snake through connectors as an afterthought if it glitches during power sequence.<\/p>\n<table>\n<thead>\n<tr>\n<td>Net<\/td>\n<td>Priority<\/td>\n<td>Error com\u00fan<\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>SCLK<\/td>\n<td>Edge integrity<\/td>\n<td>Long unterminated branch to a debug header<\/td>\n<\/tr>\n<tr>\n<td>MOSI\/MISO<\/td>\n<td>Timing vs clock<\/td>\n<td>Huge length skew at high MHz<\/td>\n<\/tr>\n<tr>\n<td>CS<\/td>\n<td>Clean select<\/td>\n<td>Floating during reset, slow RC tails<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote><p>If SPI only fails at cold temperature or long cables inside a product shell, believe SI before rewriting the driver again.<\/p><\/blockquote>\n<h2>Timing Budgets, Pulls, and Idle Levels<\/h2>\n<p>Datasheets specify setup and hold relative to clock edges. Path delay, series damping, and receiver thresholds eat that budget. Leaving MISO floating when no slave is selected can pick up noise; define idle behavior.<\/p>\n<p>Boot straps and multi-function pins sometimes glitch SPI flash at power-up. Hold CS inactive through reset until rails and clocks are valid.<\/p>\n<h2>Power Sequencing and Multi-Slave Bring-Up<\/h2>\n<p>Unpowered slaves on a live SPI bus can clamp lines through ESD diodes and distort edges for everyone. If devices sit on switched rails, isolate or sequence so the bus is not back-powered.<\/p>\n<p>Stagger initialization when several slaves share timing margins. A noisy display init burst should not land on top of a marginal flash verify without proof the copper can stand both.<\/p>\n<h2>Debug Without Lying to Yourself<\/h2>\n<p>Use a short ground on the scope. Check SCLK amplitude and ring at the slave pin, not only at the MCU ball. Logic analyzers sample thresholds that may not match your IO level. A capture that looks perfect can still be marginal on silicon.<\/p>\n<p>If failures are temperature-only, re-scope at temperature. Buffer delays and threshold shifts move setup margins even when room-temperature captures look pretty.<\/p>\n<h2>Chip Select Timing and Multi-Device Fairness<\/h2>\n<p>CS must meet setup and hold around the clock stream and must not glitch during deep sleep transitions. A slow RC on CS can deselect late and clip the last bits. A floating CS during programming fixtures can select two devices at once.<\/p>\n<p>When several devices share a master, budget the idle time and the drive strength under simultaneous input loads on MISO. Weak masters with many inputs hanging on the return data line can fail only when all devices are stuffed.<\/p>\n<p>Daisy-chain configurations need end-to-end timing analysis. They are not a free CS pin saver if the chain is long and fast.<\/p>\n<h2>SI Checks at the Speed You Ship<\/h2>\n<p>Prove margins at the production clock, not only at a friendly bring-up divider. Temperature and voltage corners move thresholds. If you only test at room temperature on a short board, you have not tested the product.<\/p>\n<p>Watch host drive strength settings. Some MCUs default to fast edges that light EMI and ring into flash setup violations. Slowing the driver one notch can be a better fix than another firmware retry.<\/p>\n<h2>The Flash That Enumerated Only After the Enclosure Screws Went In<\/h2>\n<p>SPI NOR programmed clean on an open fixture and failed verify after the metal housing and ground screws went on. Software bisects looked random across temperature.<\/p>\n<p>SCLK at the flash pins with a short spring ground changed shape once the enclosure screws altered the return around a slot near the SPI group. The fixture had been kinder than the product.<\/p>\n<p>A clock branch to a debug header got shortened, damping moved to the driver launch, and returns under the SPI bundle were stitched. Flash mode and clock settings stayed put for an honest comparison in our logs.<\/p>\n<p>Verify yield settled on the production housing. In our notes, SPI still fails as a mechanical-electrical story when fixtures flatter the edge, so we keep a housing-on capture in the release pack.<\/p>\n<h2>Treat SPI as a Timed Signal Group<\/h2>\n<p>SPI es un protocolo sincronizado que requiere un maestro de reloj, no cuatro l\u00edneas GPIO que simplemente compartan conector. La integridad de SCLK, la definici\u00f3n de la selecci\u00f3n de chip mediante reset y la geometr\u00eda de retorno del grupo determinan si un flash verifica su funcionamiento tras el montaje del chasis. Los ajustes de modo en el firmware deben permanecer vinculados a las notas del esquem\u00e1tico para evitar que un cambio tard\u00edo de conector deje sin control un dispositivo que solo falla a alta velocidad o en condiciones de fr\u00edo. La cualificaci\u00f3n de un segundo proveedor de memorias flash requiere una lista de verificaci\u00f3n de temporizaciones y ciclos dummy, no solo la compatibilidad de la huella. Incluir una validaci\u00f3n con chasis ensamblado en el paquete de liberaci\u00f3n es obligatorio cuando los fixtures apoyan en el borde. El producto final es el \u00fanico juez v\u00e1lido, no la cama de pogo pins en abierto.<\/p>\n<h2>Need Help With Flaky SPI Flash or ADC Links?<\/h2>\n<p>Send clock rate, schematic, layout of the SPI group, and scope shots at the slave. We separate SI issues from init timing. Start with a <a href=\"\/es\/servicios\/diseno-de-placa-pcb\/\">Revisi\u00f3n de dise\u00f1o de PCB<\/a>.<\/p>\n<h2>Preguntas frecuentes<\/h2>\n<h3>What SPI speed is safe on a two-layer board?<\/h3>\n<p>It depends on length and topology. Many boards run a few MHz easily; tens of MHz need real SI care.<\/p>\n<h3>Do I need termination on SPI?<\/h3>\n<p>Often series damping is enough on short on-board links. Long lines may need more deliberate treatment.<\/p>\n<h3>Why does only one of three SPI sensors fail?<\/h3>\n<p>CS routing, stub length, shared timing margin, or that device timing corner.<\/p>\n<h3>Can I star-route SCLK to many devices?<\/h3>\n<p>Stars create stubs. Prefer short branches and controlled topology.<\/p>\n<h3>Should CS have a pull-up?<\/h3>\n<p>Usually yes to keep slaves deselected during reset, unless the design defines another idle plan.<\/p>\n<h2>Lectura relacionada<\/h2>\n<ul>\n<li><a href=\"\/es\/guia-de-interfaces-de-comunicacion-pcb\/\">Gu\u00eda de interfaces de comunicaci\u00f3n para PCB<\/a><\/li>\n<li><a href=\"\/es\/qspi-communication-protocol\/\">Protocolo de comunicaci\u00f3n QSPI<\/a><\/li>\n<li><a href=\"\/es\/resistencias-en-serie-en-lineas-de-senal\/\">Por qu\u00e9 usar resistencias en serie en las l\u00edneas de se\u00f1al<\/a><\/li>\n<li><a href=\"\/es\/how-to-check-clock-signal-on-pcb\/\">C\u00f3mo verificar la se\u00f1al de reloj en una PCB<\/a><\/li>\n<li><a href=\"\/es\/fundamentos-de-la-comunicacion-i2c\/\">Conceptos esenciales de comunicaci\u00f3n I2C<\/a><\/li>\n<li><a href=\"\/es\/por-que-diferentes-interfaces-de-comunicacion\/\">Por qu\u00e9 son necesarias diferentes interfaces de comunicaci\u00f3n<\/a><\/li>\n<li><a href=\"\/es\/protocolo-de-comunicacion-rs485\/\">Protocolo de comunicaci\u00f3n RS485<\/a><\/li>\n<li><a href=\"\/es\/lvds-voltage-standard-video-interface\/\">LVDS<\/a><\/li>\n<\/ul>\n<h2>Referencias<\/h2>\n<ol>\n<li>NXP Semiconductors \u2013 Especificaci\u00f3n y manual de usuario del bus I2C (UM10204): <a href=\"https:\/\/www.nxp.com\/docs\/en\/user-guide\/UM10204.pdf\" target=\"_blank\" rel=\"noopener\">https:\/\/www.nxp.com\/docs\/en\/user-guide\/UM10204.pdf<\/a><\/li>\n<li>Texas Instruments \u2013 Recursos de dise\u00f1o y aplicaci\u00f3n de RS-485: <a href=\"https:\/\/www.ti.com\/interface\/rs-485\/overview.html\" target=\"_blank\" rel=\"noopener\">https:\/\/www.ti.com\/interface\/rs-485\/overview.html<\/a><\/li>\n<li>Texas Instruments \u2013 Recursos de aplicaci\u00f3n y dise\u00f1o de LVDS: <a href=\"https:\/\/www.ti.com\/interface\/high-speed-serdes\/lvds-m-lvds-pecl\/overview.html\" target=\"_blank\" rel=\"noopener\">https:\/\/www.ti.com\/interface\/high-speed-serdes\/lvds-m-lvds-pecl\/overview.html<\/a><\/li>\n<li>JEDEC \u2013 Centro de est\u00e1ndares de memoria flash \/ serie: <a href=\"https:\/\/www.jedec.org\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.jedec.org\/<\/a><\/li>\n<li>IPC \u2013 Resumen de est\u00e1ndares de aceptaci\u00f3n y dise\u00f1o: <a href=\"https:\/\/www.ipc.org\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.ipc.org\/<\/a><\/li>\n<li>IEC \u2013 Comisi\u00f3n Electrot\u00e9cnica Internacional: <a href=\"https:\/\/www.iec.ch\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.iec.ch\/<\/a><\/li>\n<li>USB-IF \u2013 especificaciones (para contexto de pr\u00e1ctica de interfaz de alta velocidad): <a href=\"https:\/\/www.usb.org\/documents\" target=\"_blank\" rel=\"noopener\">https:\/\/www.usb.org\/documents<\/a><\/li>\n<li>Asociaci\u00f3n de Normas IEEE: <a href=\"https:\/\/standards.ieee.org\/\" target=\"_blank\" rel=\"noopener\">https:\/\/standards.ieee.org\/<\/a><\/li>\n<\/ol>","protected":false},"excerpt":{"rendered":"<p>SPI parece simple: reloj, salida de datos, entrada de datos, selecci\u00f3n de chip. Esa simplicidad es la raz\u00f3n por la que las memorias flash, los ADC y las pantallas todav\u00eda lo usan. Este art\u00edculo cubre los modos SPI, temporizaci\u00f3n, topolog\u00edas de m\u00faltiples esclavos, reglas de enrutado de PCB y errores comunes de puesta en marcha.<\/p>","protected":false},"author":1,"featured_media":5447,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"SPI Communication Protocol Explained for Beginners | PCBDesign Lab","rank_math_description":"SPI flash firmware extraction guide: read NOR flash with clips or chip-off, verify dumps, analyze images with Binwalk and restore devices.","rank_math_focus_keyword":"SPI communication","rank_math_robots":"","rank_math_canonical_url":"","rank_math_facebook_title":"","rank_math_facebook_description":"","rank_math_twitter_title":"","rank_math_twitter_description":"","_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"","_yoast_wpseo_focuskw":"","_yoast_wpseo_canonical":"","_yoast_wpseo_meta-robots-noindex":"","_yoast_wpseo_meta-robots-nofollow":"","_yoast_wpseo_opengraph-title":"","_yoast_wpseo_opengraph-description":"","_yoast_wpseo_twitter-title":"","_yoast_wpseo_twitter-description":"","_aioseo_title":"","_aioseo_description":"","_aioseo_keywords":"","_aioseo_robots_default":"","_aioseo_robots_noindex":"","_aioseo_og_title":"","_aioseo_og_description":"","_aioseo_twitter_title":"","_aioseo_twitter_description":"","aiosp_title":"","aiosp_description":"","aiosp_keywords":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_analysis_target_kw":"","_seopress_robots_canonical":"","_seopress_robots_index":"","_seopress_robots_follow":"","_seopress_social_fb_title":"","_seopress_social_fb_desc":"","_seopress_social_twitter_title":"","_seopress_social_twitter_desc":"","_genesis_title":"","_genesis_description":"","_genesis_canonical":"","_genesis_noindex":"","_genesis_nofollow":"","slim_seo":"","footnotes":""},"categories":[254],"tags":[412,410,257,411],"class_list":["post-5245","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-communication-interfaces","tag-chip-select-wiring","tag-spi-bus-protocol","tag-spi-communication","tag-spi-mode-timing"],"_links":{"self":[{"href":"https:\/\/www.pcbdesignlab.com\/es\/wp-json\/wp\/v2\/posts\/5245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pcbdesignlab.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pcbdesignlab.com\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pcbdesignlab.com\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pcbdesignlab.com\/es\/wp-json\/wp\/v2\/comments?post=5245"}],"version-history":[{"count":3,"href":"https:\/\/www.pcbdesignlab.com\/es\/wp-json\/wp\/v2\/posts\/5245\/revisions"}],"predecessor-version":[{"id":6634,"href":"https:\/\/www.pcbdesignlab.com\/es\/wp-json\/wp\/v2\/posts\/5245\/revisions\/6634"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pcbdesignlab.com\/es\/wp-json\/wp\/v2\/media\/5447"}],"wp:attachment":[{"href":"https:\/\/www.pcbdesignlab.com\/es\/wp-json\/wp\/v2\/media?parent=5245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pcbdesignlab.com\/es\/wp-json\/wp\/v2\/categories?post=5245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pcbdesignlab.com\/es\/wp-json\/wp\/v2\/tags?post=5245"}],"curies":[{"name":"bp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}