<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://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:2014:05:02</title>
        <description></description>
        <link>https://baszerr.eu/</link>
        <lastBuildDate>Sat, 02 May 2026 10:19:38 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://baszerr.eu/lib/exe/fetch.php?media=wiki:dokuwiki.svg</url>
            <title>BaSzErr</title>
            <link>https://baszerr.eu/</link>
        </image>
        <item>
            <title>failing_disk</title>
            <link>https://baszerr.eu/doku.php?id=blog:2014:05:02:failing_disk</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;failing_disk&quot;&gt;2014-05-02 - failing disk&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
some time ago my sister started to complain about her laptop working slow and freezing often, at random moments, for a few seconds. a bit of testing shown no (known) viruses, next to none CPU load and next to none extra I/O (well – it was windows, by let&amp;#039;s say it was close enough to zero). after some time i decided to run a disk scan, using &lt;a href=&quot;http://www.softpedia.com/get/System/Hard-Disk-Utils/HDD-Scan.shtml&quot; class=&quot;urlextern&quot; title=&quot;http://www.softpedia.com/get/System/Hard-Disk-Utils/HDD-Scan.shtml&quot; rel=&quot;ugc nofollow&quot;&gt;hdd scan&lt;/a&gt;. plot of reading speed vs. position on disk looked like this:
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://baszerr.eu/lib/exe/detail.php?id=blog%3A2014%3A05%3A02%3Afailing_disk&amp;amp;media=blog:2014:05:02:old_drive.png&quot; class=&quot;media&quot; title=&quot;blog:2014:05:02:old_drive.png&quot;&gt;&lt;img src=&quot;https://baszerr.eu/lib/exe/fetch.php?media=blog:2014:05:02:old_drive.png&quot; class=&quot;media&quot; loading=&quot;lazy&quot; title=&quot;reading speed plot - old drive&quot; alt=&quot;reading speed plot - old drive&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
there are clearly locations on the disk, that do not work well – transfer drops there significantly. around 3/4 of the way i dropped to a nearly zero. clearly disk was dying.
&lt;/p&gt;

&lt;p&gt;
the funny thing is how it is happening. “regular” disks have extra logic that tries to correct errors along the way: move failing sectors, correct corrupted data, mark bad blocks… from the user point of view all of this results in a performance drop, up to a “random freezes” point. this might be nice/acceptable for regular user, as one just want&amp;#039;s be able to copy her data out of a dying surface.
&lt;/p&gt;

&lt;p&gt;
this is however a pain in the neck when you have a &lt;a href=&quot;https://en.wikipedia.org/wiki/RAID&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/RAID&quot;&gt;RAID&lt;/a&gt; (non-0 RAID, to be precise) on your computer. having the same data on more than one disk means fail-fast is the best approach. if disk cannot read something, it should just mark block as dead, report an error and let RAID controller read required data from other (usually still operational) disk. this is the tactics so called “RAID edition” disks have. the problem is their price, which is usually ~2-4x more expensive than “regular” ones. funny part is having an extra (error-correcting) logic, means lower price. ;)
&lt;/p&gt;

&lt;p&gt;
any way, after buying a new drive plot came back to normal:
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://baszerr.eu/lib/exe/detail.php?id=blog%3A2014%3A05%3A02%3Afailing_disk&amp;amp;media=blog:2014:05:02:new_drive.jpg&quot; class=&quot;media&quot; title=&quot;blog:2014:05:02:new_drive.jpg&quot;&gt;&lt;img src=&quot;https://baszerr.eu/lib/exe/fetch.php?media=blog:2014:05:02:new_drive.jpg&quot; class=&quot;media&quot; loading=&quot;lazy&quot; title=&quot;reading speed plot - new drive&quot; alt=&quot;reading speed plot - new drive&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
the new disk looks (more-less) healthy. though both disks had the same capacity, new one is significantly faster. from the plot one can also see this is clearly a rotary-plate drive, as reading speed decreases while moving towards end of disk pace (i.e. center of the disk). this happens due to non-uniform sectors density in each cylinder, that increases both capacity and speed, while moving away from the center of the disk (&lt;a href=&quot;https://en.wikipedia.org/wiki/Cylinder-head-sector&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/Cylinder-head-sector&quot;&gt;physical CHS&lt;/a&gt; is a thing of the past for decades now).
&lt;/p&gt;

&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 15 Jun 2021 20:08:55 +0000</pubDate>
        </item>
        <item>
            <title>spi_atmega64_a</title>
            <link>https://baszerr.eu/doku.php?id=blog:2014:05:02:spi_atmega64_a</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;spi_atmega64_a&quot;&gt;2014-05-02 - SPI@ATmega64(A)&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
while doing an AVR-based project with friends, we decided to switch from ATmega169 to ATmega64A, which has 4x more program memory and is easier accessible on retail market. after soldering µC on our prototype board we were unable to flash it. 4 ppl checked the schema twice to see if SPI is connected to proper MISO, MOSI, SCK and reset pins. cable has been checked… and then one of friends found an interesting post on the net, saying that SPI from programming ATmega64(A) should be connected to PE0 and PE1, instead of PB2 and PB3, as pinout suggest:
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://baszerr.eu/lib/exe/detail.php?id=blog%3A2014%3A05%3A02%3Aspi_atmega64_a&amp;amp;media=blog:2014:05:02:atmega_64a_pinout.png&quot; class=&quot;media&quot; title=&quot;blog:2014:05:02:atmega_64a_pinout.png&quot;&gt;&lt;img src=&quot;https://baszerr.eu/lib/exe/fetch.php?w=500&amp;amp;tok=799079&amp;amp;media=blog:2014:05:02:atmega_64a_pinout.png&quot; class=&quot;media&quot; loading=&quot;lazy&quot; title=&quot;pinout for ATmega64A&quot; alt=&quot;pinout for ATmega64A&quot; width=&quot;500&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
a bug this big in a datasheet? at first i though this might be a matter of a bootloader – PE0 and PE1 cab be used by USART0, after all. after having a quick look at an &lt;a href=&quot;http://www.atmel.com/Images/Atmel-8160-8-bit-AVR-Microcontroller-ATmega64A-datasheet.pdf&quot; class=&quot;urlextern&quot; title=&quot;http://www.atmel.com/Images/Atmel-8160-8-bit-AVR-Microcontroller-ATmega64A-datasheet.pdf&quot; rel=&quot;ugc nofollow&quot;&gt;ATmega64A datasheet&lt;/a&gt;, section 28.8 resolved a mystery:
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://baszerr.eu/lib/exe/detail.php?id=blog%3A2014%3A05%3A02%3Aspi_atmega64_a&amp;amp;media=blog:2014:05:02:spi_programming_atmega64a.png&quot; class=&quot;media&quot; title=&quot;blog:2014:05:02:spi_programming_atmega64a.png&quot;&gt;&lt;img src=&quot;https://baszerr.eu/lib/exe/fetch.php?w=500&amp;amp;tok=c1127a&amp;amp;media=blog:2014:05:02:spi_programming_atmega64a.png&quot; class=&quot;media&quot; loading=&quot;lazy&quot; title=&quot;SPI for programming -- proper connection&quot; alt=&quot;SPI for programming -- proper connection&quot; width=&quot;500&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
quoting:
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;Even though the SPI Programming interface re-uses the SPI I/O module, there is one important difference: The
MOSI/MISO pins that are mapped to PB2 and PB3 in the SPI I/O module are not used in the Programming interface.
Instead, PE0 and PE1 are used for data in SPI Programming mode as shown in Table 28-13.&lt;/pre&gt;

&lt;p&gt;
so this is a feature, not a bug, after all… how obvious and how convenient! looking though forums shows that many ppl fall into this trap around the world. despite this is tricky, this is not the way it is done in other popular AVRs, like ATmega8, ATtiny13 and others, i had worked with before.
&lt;/p&gt;

&lt;p&gt;
&lt;em&gt;The nice thing about standards is that you have so many to choose from.&lt;/em&gt; &lt;br/&gt;

– &lt;a href=&quot;https://en.wikipedia.org/wiki/Andrew S. Tanenbaum&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/Andrew S. Tanenbaum&quot;&gt;Andrew S. Tanenbaum&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 15 Jun 2021 20:08:55 +0000</pubDate>
        </item>
    </channel>
</rss>
