<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by f9kill on Medium]]></title>
        <description><![CDATA[Stories by f9kill on Medium]]></description>
        <link>https://medium.com/@f9kill?source=rss-1b9d1bf8109f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by f9kill on Medium</title>
            <link>https://medium.com/@f9kill?source=rss-1b9d1bf8109f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 05:44:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@f9kill/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Gravando microcontrolador 8051 com USBasp e AVRdude no Linux]]></title>
            <link>https://medium.com/@f9kill/gravando-microcontrolador-8051-com-usbasp-e-avrdude-4e56b6ba29fe?source=rss-1b9d1bf8109f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e56b6ba29fe</guid>
            <category><![CDATA[8051-microcontroller]]></category>
            <category><![CDATA[avrdude]]></category>
            <category><![CDATA[usbasp]]></category>
            <dc:creator><![CDATA[f9kill]]></dc:creator>
            <pubDate>Sun, 30 Oct 2022 19:36:37 GMT</pubDate>
            <atom:updated>2022-10-30T19:41:09.685Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dtk7IjKOwkV3nfY_djZn5Q.jpeg" /></figure><p>Embora possa ser encontrado na internet vários exemplos do gravador USBasp gravando o microcontrolador 8051 como AT89S52, você pode ter uma surpresa caso compre um e tente fazer a gravação, porque normalmente esses gravadores veem com um firmware que não grava a série AT89Sxx. Porem é possível modifica-lo para esse propósito, de maneira relativamente simples.</p><p>Necessário:</p><ul><li>Gravador com suporte a ATmega8.</li><li>Firmware modificado para gravação do 8051. (<a href="https://github.com/f9kill/diversos/raw/main/firmware_atmega8.tar.gz">download</a>)</li></ul><p>Antes de gravar é necessário colocar um jumper no JP1 para poder fazer a gravação do firmware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2w87be70Mo6G5Qcqkl46dg.jpeg" /></figure><p>Para fazer a gravação do USBasp irei utilizar um clone dele conhecido como USBisp v2.0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lFIfG9G6KvTpbs651JZ2Aw.jpeg" /></figure><p>Depois de conectados o gravador ao computador, irei executar a gravação com o firmware modificado, através do AVRdude, com os seguintes comandos:</p><pre>avrdude -v -c usbasp -p atmega8 -b 19200 -u -U hfuse:w:0xc9:m -U lfuse:w:0xef:m</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*R2lde0OK1PjackC8u4SlRA.png" /></figure><pre>avrdude -v -c usbasp -p atmega8 -b 19200 -U flash:w:USB_MCS51s_avr_main.hex</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*NU1VnpG8Lp-YxmhyqCQWMw.png" /></figure><p>Com o firmware gravado o USBasp agora pode gravar os microcontroladores AT89Sxx com outros gravadores, porem o AVRdude não possui as configurações desses microcontroladores, sendo necessários coloca-las no arquivos de configuração.</p><p>Abra o arquivos de configuração<strong> <em>/etc/avrdude.conf </em></strong>com algum editor de texto e coloque a configuração abaixo perto dos outros <strong><em>defines</em></strong>.</p><pre>#define AT89START   0xE0<br>#define AT89S51	  0xE0<br>#define AT89S52	  0xE1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*AmUlmSoTgPFeJbp9ULTyGA.png" /></figure><p>E adicione essa parte da configuração no final do arquivo:</p><pre>#------------------------------------------------------------<br>  # AT89S51<br>  #------------------------------------------------------------<br>  part<br>      id               = &quot;8052&quot;;<br>      desc             = &quot;AT89S51&quot;;<br>      signature        = 0x1E 0x51 0x06;<br>      chip_erase_delay = 500000;<br>      pgm_enable       = &quot;1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1&quot;,<br>                         &quot;x x x x  x x x x    x x x x  x x x x&quot;;<br>  <br>      chip_erase       = &quot;1 0 1 0  1 1 0 0    1 0 0 x  x x x x&quot;,<br>                         &quot;x x x x  x x x x    x x x x  x x x x&quot;;<br>  <br>      timeout      = 200;<br>      stabdelay      = 100;<br>      cmdexedelay      = 25;<br>      synchloops      = 32;<br>      bytedelay      = 0;<br>      pollindex      = 3;<br>      pollvalue      = 0x53;<br>      predelay      = 1;<br>      postdelay      = 1;<br>      pollmethod      = 0;<br>  <br>      memory &quot;flash&quot;<br>          size            = 4096;<br>          paged           = no;<br>          min_write_delay = 4000;<br>          max_write_delay = 9000;<br>          readback_p1     = 0xff;<br>          readback_p2     = 0xff;<br>          read            = &quot;  0   0   1   0    0   0   0   0&quot;,<br>                            &quot;  x   x   x a12  a11 a10  a9  a8&quot;,<br>                            &quot; a7  a6  a5  a4   a3  a2  a1  a0&quot;,<br>                            &quot;  o   o   o   o    o   o   o   o&quot;;<br>  <br>          write           = &quot;  0   1   0   0    0   0   0   0&quot;,<br>                            &quot;  x   x   x a12  a11 a10  a9  a8&quot;,<br>                            &quot; a7  a6  a5  a4   a3  a2  a1  a0&quot;,<br>                            &quot;  i   i   i   i    i   i   i   i&quot;;<br>     mode      = 0x21;<br>     delay      = 12;<br>        ;<br>  <br>      memory &quot;signature&quot;<br>          size            = 3;<br>          read            = &quot;0  0  1  0   1  0  0  0   x  x  x  0   0  0 a1 a0&quot;,<br>                            &quot;0  0  0  0   0  0  0  0   o  o  o  o   o  o  o  o&quot;;<br>        ;<br>    ; <br>#------------------------------------------------------------<br># AT89S52<br>#------------------------------------------------------------<br>part<br>    id               = &quot;8052&quot;;<br>    desc             = &quot;AT89S52&quot;;<br>    signature        = 0x1E 0x52 0x06;<br>    chip_erase_delay = 500000;<br>    pgm_enable       = &quot;1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1&quot;,<br>                       &quot;x x x x  x x x x    x x x x  x x x x&quot;;<br><br>    chip_erase       = &quot;1 0 1 0  1 1 0 0    1 0 0 x  x x x x&quot;,<br>                       &quot;x x x x  x x x x    x x x x  x x x x&quot;;<br><br>    timeout      = 200;<br>    stabdelay      = 100;<br>    cmdexedelay      = 25;<br>    synchloops      = 32;<br>    bytedelay      = 0;<br>    pollindex      = 3;<br>    pollvalue      = 0x53;<br>    predelay      = 1;<br>    postdelay      = 1;<br>    pollmethod      = 0;<br><br>    memory &quot;flash&quot;<br>        size            = 8192;<br>        paged           = no;<br>        min_write_delay = 4000;<br>        max_write_delay = 9000;<br>        readback_p1     = 0xff;<br>        readback_p2     = 0xff;<br>        read            = &quot;  0   0   1   0    0   0   0   0&quot;,<br>                          &quot;  x   x   x a12  a11 a10  a9  a8&quot;,<br>                          &quot; a7  a6  a5  a4   a3  a2  a1  a0&quot;,<br>                          &quot;  o   o   o   o    o   o   o   o&quot;;<br><br>        write           = &quot;  0   1   0   0    0   0   0   0&quot;,<br>                          &quot;  x   x   x a12  a11 a10  a9  a8&quot;,<br>                          &quot; a7  a6  a5  a4   a3  a2  a1  a0&quot;,<br>                          &quot;  i   i   i   i    i   i   i   i&quot;;<br>   mode      = 0x21;<br>   delay      = 12;<br>      ;<br><br>    memory &quot;signature&quot;<br>        size            = 3;<br>        read            = &quot;0  0  1  0   1  0  0  0   x  x  x  0   0  0 a1 a0&quot;,<br>                          &quot;0  0  0  0   0  0  0  0   o  o  o  o   o  o  o  o&quot;;<br>      ;<br>  ; <br>#------------------------------------------------------------ <br># AT89S8253 <br>#------------------------------------------------------------ <br>part <br>    id               = &quot;8253&quot;; <br>    desc             = &quot;AT89S8253&quot;; <br>    chip_erase_delay = 20000; <br>    pgm_enable       = &quot;1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1&quot;, <br>                       &quot;x x x x  x x x x    x x x x  x x x x&quot;; <br><br>    chip_erase       = &quot;1 0 1 0  1 1 0 0    1 0 0 x  x x x x&quot;, <br>                       &quot;x x x x  x x x x    x x x x  x x x x&quot;; <br><br>    timeout      = 200; <br>    stabdelay      = 100; <br>    cmdexedelay      = 25; <br>    synchloops      = 32; <br>    bytedelay      = 0; <br>    pollindex      = 3; <br>    pollvalue      = 0x53; <br>    predelay      = 1; <br>    postdelay      = 1; <br>    pollmethod      = 0; <br><br>    memory &quot;flash&quot; <br>        size            = 12288; <br>        paged           = no; <br>        min_write_delay = 4000; <br>        max_write_delay = 9000; <br>        readback_p1     = 0xff; <br>        readback_p2     = 0xff; <br>        read            = &quot;  0   0   1   0    0   0   0   0&quot;, <br>                          &quot;  x   x a13 a12  a11 a10  a9  a8&quot;, <br>                          &quot; a7  a6  a5  a4   a3  a2  a1  a0&quot;, <br>                          &quot;  o   o   o   o    o   o   o   o&quot;; <br><br>        write           = &quot;  0   1   0   0    0   0   0   0&quot;, <br>                          &quot;  x   x a13 a12  a11 a10  a9  a8&quot;, <br>                          &quot; a7  a6  a5  a4   a3  a2  a1  a0&quot;, <br>                          &quot;  i   i   i   i    i   i   i   i&quot;; <br>   mode      = 0x21; <br>   delay      = 12; <br>      ; <br><br>    memory &quot;signature&quot; <br>        size            = 2; <br>        readback_p1     = 0x1E; <br>        readback_p2     = 0x73; <br>        read            = &quot;0  0  1  0   1  0  0  0   x  x  x  x   x  x  x  x&quot;, <br>                          &quot;x  x  1  1   0  0  0 a0   o  o  o  o   o  o  o  o&quot;; <br>      ; <br>  ;</pre><p>Pronto, feito isso você já poderá fazer a gravação do 8051 com AVRdude.</p><p>Para gravar o 8051, mais precisamente o AT89S52, eu utilizo a seguinte configuração:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gSF2e5-FU6WAgPeILCPV-g.png" /></figure><p><em>O jumper JP1 da imagem é necessário ser retirado quando for fazer a gravação e colocado depois para execução.</em></p><p>A ligação do USBasp com o 8051 é a seguinte:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*w6wYtZ9adlQZD2XwhN7zeQ.png" /></figure><p>Depois é só executar a gravação do programa:</p><pre>avrdude -v -c usbasp -p at89s52 -b 19200 -U flash:w:prog.hex:i</pre><p><strong>Referências:</strong></p><p>Arif Johar Taufiq. <strong>USB downloader untuk Microcontroller AT89Sxx S-series (AT89s51, AT89S52,…&amp; AVR microcontroller). </strong>2011. Disponível em: &lt;<a href="https://guru.technosains.com/USB-for-at89S-series-and-AVR-microcontroller.htm">https://guru.technosains.com/USB-for-at89S-series-and-AVR-microcontroller.htm</a>&gt;. Acessado em: 30 de outubro de 2022.</p><p>avrfreaks.net. <strong>Writing to a AT89S52 through a USBasp</strong>. 2010. Disponível em: &lt;<a href="https://www.avrfreaks.net/forum/writing-at89s52-through-usbasp">https://www.avrfreaks.net/forum/writing-at89s52-through-usbasp</a>&gt;. Acessado em: 30 de outubro de 2022.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e56b6ba29fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>