<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://www.baszerr.eu/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>BaSzErr - blog:2022:08:09</title>
        <description></description>
        <link>https://www.baszerr.eu/</link>
        <lastBuildDate>Wed, 06 May 2026 09:37:47 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://www.baszerr.eu/lib/exe/fetch.php?media=wiki:dokuwiki.svg</url>
            <title>BaSzErr</title>
            <link>https://www.baszerr.eu/</link>
        </image>
        <item>
            <title>2022-08-09_-_slowly_programming_slow_avrs</title>
            <link>https://www.baszerr.eu/doku.php?id=blog:2022:08:09:2022-08-09_-_slowly_programming_slow_avrs</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;slowly_programming_slow_avrs&quot;&gt;2022-08-09 - slowly programming slow AVRs&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
recently i&amp;#039;ve promised to my sons i&amp;#039;ll build them &lt;a href=&quot;https://github.com/el-bart/toy_satellite_model&quot; class=&quot;urlextern&quot; title=&quot;https://github.com/el-bart/toy_satellite_model&quot; rel=&quot;ugc nofollow&quot;&gt;solar-powered toy satellite&lt;/a&gt; to be “launched” form 3D-printed &lt;a href=&quot;https://github.com/el-bart/external_3d_prints/tree/master/Ariane_5&quot; class=&quot;urlextern&quot; title=&quot;https://github.com/el-bart/external_3d_prints/tree/master/Ariane_5&quot; rel=&quot;ugc nofollow&quot;&gt;Ariane 5 model rocket&lt;/a&gt;. i&amp;#039;ll write more on that once it&amp;#039;s finished.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;2022-08-09 - slowly programming slow AVRs&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;slowly_programming_slow_avrs&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:1,&amp;quot;range&amp;quot;:&amp;quot;1-359&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;genesis&quot;&gt;genesis&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
since the thing is solar-powered, it&amp;#039;s crucial to keep power usage as low as possible (step-up DC/DC losses + blinking LED are already eating up a lot), so i decided to go with &lt;a href=&quot;https://en.wikipedia.org/wiki/ATtiny microcontroller comparison chart&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/ATtiny microcontroller comparison chart&quot;&gt;ATtiny13&lt;/a&gt;&amp;#039;s lowest possible frequency – internal RC oscillator, running at 128kHz, with internal prescaler set to 8… ending up at 16kHz! :D felt awesome… until i&amp;#039;ve flashed fuse-bits to enable the oscillator and chip stopped responding.
&lt;/p&gt;

&lt;p&gt;
first i though i screwed up fuse bit values, and disabled serial programming (happened to me in the past). since this is SMD, i&amp;#039;d need to re-solder a new unit to make it working… instead i decided to drill down a bit and see what&amp;#039;s up. &lt;a href=&quot;https://www.engbedded.com/fusecalc/&quot; class=&quot;urlextern&quot; title=&quot;https://www.engbedded.com/fusecalc/&quot; rel=&quot;ugc nofollow&quot;&gt;AVR fuse calc&lt;/a&gt; confirmed i&amp;#039;ve set all the bits correctly (cross-checked with datasheet). then i came across a post on &lt;a href=&quot;https://www.logikdev.com/2011/02/15/reset-clock-fuse-bits-on-avr/&quot; class=&quot;urlextern&quot; title=&quot;https://www.logikdev.com/2011/02/15/reset-clock-fuse-bits-on-avr/&quot; rel=&quot;ugc nofollow&quot;&gt;how to reset fuse bits via programmer&lt;/a&gt;. long story short – you can reset fuses like this:
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;avrdude -P usb -c usbasp -p attiny13 -U lfuse:w:0x6A:m -U hfuse:w:0xFF:m -B 1kHz&lt;/pre&gt;

&lt;p&gt;
this is how i&amp;#039;ve learned there, that ISP programmer must run &lt;strong&gt;slower&lt;/strong&gt; than AVR it is programming, to make it work! in theory 1/4th speed should suffice. in practice 1/8th is stable enough to work. so in case of 16kHz clock, i need 2kHz ISP. i&amp;#039;m using AVR since some double-digit years and i was never aware of that. 8-/
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;genesis&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;genesis&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:2,&amp;quot;range&amp;quot;:&amp;quot;360-1823&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit3&quot; id=&quot;programming_the_programmer&quot;&gt;programming the programmer&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
anyway – i was almost there when i hit another issue – error from &lt;code&gt;avrdude&lt;/code&gt; (well – actually a warning, that should be an error):
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt; avrdude: set SCK frequency to 2000 Hz
 avrdude: warning: cannot set sck period. please check for usbasp firmware update.&lt;/pre&gt;

&lt;p&gt;
looks like my ISP programmer does not handle &lt;code&gt;SCK&lt;/code&gt; option thus i cannot slow down ISP… quick search on the internet reveled that this is indeed an issue with firmware version (as &lt;code&gt;avrdude&lt;/code&gt; suggested). i&amp;#039;ve ordered another one from the internet – one advertised that it already has a firmware with &lt;code&gt;SCK&lt;/code&gt; support… which 2 days later also turned out to be false!
&lt;/p&gt;

&lt;p&gt;
good news was that &lt;a href=&quot;https://blog.podkalicki.com/how-to-update-avr-usbasp-firmware-to-latest-version/&quot; class=&quot;urlextern&quot; title=&quot;https://blog.podkalicki.com/how-to-update-avr-usbasp-firmware-to-latest-version/&quot; rel=&quot;ugc nofollow&quot;&gt;the firmware can be updated&lt;/a&gt; when you have 2 AVR programmers, that i now happend to posses. quick soldering of &lt;code&gt;JP2&lt;/code&gt;, some cabling, then flashing:
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;wget https://www.fischl.de/usbasp/usbasp.2011-05-28.tar.gz
tar xzvf usbasp.2011-05-28.tar.gz 
avrdude -p atmega8 -P usb -c usbasp -U flash:w:bin/firmware/usbasp.atmega8.2011-05-28.hex:i&lt;/pre&gt;

&lt;p&gt;
and the issue is solved! i can now flash my code, to 16kHz running CPU! :D
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;# avrdude -P avrdoper -c usbasp -B 2kHz -p &amp;quot;attiny13&amp;quot; -U &amp;quot;flash:w:led_sat.bin&amp;quot;

avrdude: set SCK frequency to 2000 Hz
avrdude: AVR device initialized and ready to accept instructions
...&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;programming the programmer&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;programming_the_programmer&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:1,&amp;quot;secid&amp;quot;:3,&amp;quot;range&amp;quot;:&amp;quot;1824-3233&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit4&quot; id=&quot;final_notes&quot;&gt;final notes&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
after checking &lt;a href=&quot;https://www.fischl.de/usbasp/&quot; class=&quot;urlextern&quot; title=&quot;https://www.fischl.de/usbasp/&quot; rel=&quot;ugc nofollow&quot;&gt;USBasp homepage&lt;/a&gt;, what was striking to me, is that 11 yrs old firmware is still not being flashed to the newest ISP programmers on the market! it&amp;#039;s out there. it&amp;#039;s free. what&amp;#039;s the problem? i know these programmers are not that expensive (&amp;lt;6 EUR, inc. shipping), but still…
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;final notes&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;final_notes&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:3,&amp;quot;secid&amp;quot;:4,&amp;quot;range&amp;quot;:&amp;quot;3234-&amp;quot;} --&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sun, 21 Aug 2022 19:06:51 +0000</pubDate>
        </item>
    </channel>
</rss>
