<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pl-pl">
<link rel="self" type="application/atom+xml" href="https://forum.atnel.pl/feed.php?f=4&amp;t=3311&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2013-06-12T14:04:17+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=4&amp;t=3311&amp;mode</id>
<entry>
<author><name><![CDATA[marekdor]]></name></author>
<updated>2013-06-12T14:04:17+01:00</updated>
<published>2013-06-12T14:04:17+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=3311&amp;p=39061#p39061</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=3311&amp;p=39061#p39061"/>
<title type="html"><![CDATA[Re: Zapis do pliku w FatFS, prośba o pomoc przy debugowaniu.]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=3311&amp;p=39061#p39061"><![CDATA[
Czy mógłbyś podesłać swoje biblioteki obsługi fata czyli pliki ff.c, ff.h, mmc.c ? Lub ogólnie cały projekt ?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1387">marekdor</a> — 12 cze 2013, o 14:04</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[PawelGaj]]></name></author>
<updated>2013-06-12T13:39:23+01:00</updated>
<published>2013-06-12T13:39:23+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=3311&amp;p=39056#p39056</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=3311&amp;p=39056#p39056"/>
<title type="html"><![CDATA[Re: Zapis do pliku w FatFS, prośba o pomoc przy debugowaniu.]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=3311&amp;p=39056#p39056"><![CDATA[
Zobacz jak ja to robię w moim datalogerze <img src="https://forum.atnel.pl/images/smilies/icon_e_wink.gif" alt=";)" title="Puszcza oko" /> : <!-- l --><a class="postlink-local" href="http://forum.atnel.pl/topic2972.html" >topic2972.html</a><!-- l --><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=784">PawelGaj</a> — 12 cze 2013, o 13:39</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[marekdor]]></name></author>
<updated>2013-06-12T12:22:45+01:00</updated>
<published>2013-06-12T12:22:45+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=3311&amp;p=39055#p39055</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=3311&amp;p=39055#p39055"/>
<title type="html"><![CDATA[Zapis do pliku w FatFS, prośba o pomoc przy debugowaniu.]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=3311&amp;p=39055#p39055"><![CDATA[
Witam. Walczę z implementacją biblioteki FatFS,<br />Mam już pewne postępy gdyż udaje mi się poprawnie czytać pliki. Niestety zapis się niepowodzi, i drogą żmudnych debugów doszedłem do pewnej jawnej sprzeczności w funkcji disk_write wywoływanej przez funkcję sync_window oto one:<br />[syntax=c]static FRESULT sync_window (<br />FATFS *fs/* File system object */<br />)<br />{<br />DWORD wsect;<br />UINT nf;<br /><br /><br />if (fs-&gt;wflag) {/* Write back the sector if it is dirty */<br />wsect = fs-&gt;winsect;/* Current sector number */<br />DEBUG_PRINT(&quot;fs-&gt;drv = %d, fs-&gt;win = %d, wsect=%d\r\n&quot;,fs-&gt;drv,fs-&gt;win,wsect);  <br /><br />if (disk_write(fs-&gt;drv, fs-&gt;win, wsect, 1) != RES_OK)  //z powyzszego debuga wynika ze pierwszy parametr (numer dysku to zero) a ostatni to na 'sztywno' 1<br />return FR_DISK_ERR;<br />fs-&gt;wflag = 0;<br />if (wsect &gt;= fs-&gt;fatbase &amp;&amp; wsect &lt; (fs-&gt;fatbase + fs-&gt;fsize)) {/* In FAT area? */<br />for (nf = fs-&gt;n_fats; nf &gt;= 2; nf--) {/* Reflect the change to all FAT copies */<br />wsect += fs-&gt;fsize;<br />disk_write(fs-&gt;drv, fs-&gt;win, wsect, 1);<br />}<br />}<br />}<br />return FR_OK;<br />}[/syntax]<br /><br />[syntax=c]#if _USE_WRITE<br />DRESULT disk_write (<br />BYTE pdrv,/* Physical drive nmuber (0) */<br />const BYTE *buff,/* Pointer to the data to be written */<br />DWORD sector,/* Start sector number (LBA) */<br />BYTE count/* Sector count (1..255) */<br />)<br />{<br />if (pdrv || !count) return RES_PARERR;//  tu funkcja wychodzi<br />DEBUG_PRINT(&quot;pdrv=%d count=%d\r\n&quot;,pdrv,count);<br />if (Stat &amp; STA_NOINIT) return RES_NOTRDY;<br />//DEBUG_PRINT(&quot;er2\r\n&quot;);<br />if (Stat &amp; STA_PROTECT) return RES_WRPRT;<br />//DEBUG_PRINT(&quot;er3\r\n&quot;);<br />if (!(CardType &amp; CT_BLOCK)) sector *= 512;/* Convert to byte address if needed */<br />//DEBUG_PRINT(&quot;d4\r\n&quot;);<br />if (count == 1) {/* Single block write */<br />if ((send_cmd(CMD24, sector) == 0)/* WRITE_BLOCK */<br />&amp;&amp; xmit_datablock(buff, 0xFE))<br />count = 0;<br />}<br />else {/* Multiple block write */<br />if (CardType &amp; CT_SDC) send_cmd(ACMD23, count);<br />if (send_cmd(CMD25, sector) == 0) {/* WRITE_MULTIPLE_BLOCK */<br />do {<br />if (!xmit_datablock(buff, 0xFC)) break;<br />buff += 512;<br />} while (--count);<br />if (!xmit_datablock(0, 0xFD))/* STOP_TRAN token */<br />count = 1;<br />}<br />}<br />//deselect();<br />DESELECT();<br /><br /><br />return count ? RES_ERROR : RES_OK;<br />}<br />#endif[/syntax]<br /><br />Pytanie mam do kogokolwiek, komu poprawnie udało się zaimplementować tę bibliotekę w trybie zapisu. Czy mógłby mi podpowiedziec jaka powinna być wartość pdrv ? 0 czy 1 ?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1387">marekdor</a> — 12 cze 2013, o 12:22</p><hr />
]]></content>
</entry>
</feed>