<?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=5159&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2013-12-15T12:15:50+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=4&amp;t=5159&amp;mode</id>
<entry>
<author><name><![CDATA[Paul Dirac]]></name></author>
<updated>2013-12-15T12:15:50+01:00</updated>
<published>2013-12-15T12:15:50+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61243#p61243</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61243#p61243"/>
<title type="html"><![CDATA[Re: Petit FAT library]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61243#p61243"><![CDATA[
Sprawdzałem, nawet z rozszerzeniem nie otwiera istniejącego. Za to sprawdziłem czy otwiera istniejący folder: TAK, jesli nazwa mu sie zgadza to wchodzi do folderu, ale z otwraciem pliku juz nie.<br /><br />Nie może znależć pliku. Normalnie nie mam pomysłu<br /><br /><strong><span style="color: #808000">------------------------ [ Dodano po: 42 minutach ]</span></strong><br /><br />Błąd zlokalizowany. Może ktos kiedyś będzie miał identyczny problem, trzeba dodac do nazyw nazwe folderu z '/'. Poprawiona wersja:<br />[syntax=c]#include &lt;avr/io.h&gt;<br />#include &lt;stdio.h&gt;<br />#include &lt;util/delay.h&gt;<br />#include &lt;avr/pgmspace.h&gt;<br />#include &lt;string.h&gt;<br /><br />#include &quot;PetitFS/diskio.h&quot;<br />#include &quot;PetitFS/pff.h&quot;<br /><br />#include &quot;LCD/lcd.h&quot;<br />#include &quot;RS232/uart.h&quot;<br /><br />#define SCK PB7<br />#define MOSI PB5<br />#define SS PB4<br />#define MISO PB6<br /><br />#define CD (1&lt;&lt;PC2)<br /><br /><br />//char bufor_read_with_sd&#91;100&#93;;<br />char bufor_read_with_sd&#91;1&#93;;<br />char buf_write_on_sd&#91;&#93;=&quot;t&quot;;<br />volatile uint32_t line;<br />volatile uint32_t num_bajt_read_withs_sd;<br />volatile uint32_t num_sector=1;<br />volatile uint8_t flaga_read_null;<br />static WORD s1;<br /><br />void write_close(void);<br />/*-----------------------------------------------------------------------*/<br />/* Main                                                                  */<br />int main (void)<br />{<br />DDRA = 0xff;<br />PORTA = 0x00;<br /><br /><br />uint8_t res=0;<br />FATFS fs;/* File system object */<br />DIR dir;/* Directory object */<br />//FILINFO fno;/* File information */<br />static WORD position_ind_sector;<br /><br /><br />//PWR<br /> char TempStr&#91;20&#93;;<br /><br /> strcpy(TempStr,(const char*)&quot;1&quot;);<br /><br /><br /><br />//configuration for SPI<br />DDRB |= (1&lt;&lt;MOSI)|(1&lt;&lt;SCK)|(1&lt;&lt;SS);<br />DDRB &amp;= ~(1&lt;&lt;MISO);<br />PORTB |= (1&lt;&lt;SS);//mode SLAVE<br /><br />//PWR<br />DDRC |= (1&lt;&lt;PC3);//jako wyjście<br />PORTC &amp;= ~(1&lt;&lt;PC3);//stan niski<br /><br />PORTC |= CD;//CD<br /><br />SPCR |= (1&lt;&lt;SPE)|(1&lt;&lt;MSTR);<br />SPCR |= (1&lt;&lt;SPR1) | (1&lt;&lt;SPR0);<br /><br />uart_init(_UBRR);<br /><br />lcd_init();<br />lcd_locate(0,0);<br />stdout = &amp;mystdout;<br />printf(&quot;jest okey&quot;);<br />_delay_ms(1000);<br />lcd_clear();<br />if( !(PINC &amp; CD) )<br />{<br />while(disk_initialize());<br /><br />lcd_locate(0,0);<br />printf(&quot;OKEY1&quot;);<br /><br />while(pf_mount(&amp;fs));<br /><br />lcd_locate(0,0);<br />printf(&quot;OKEY2&quot;);<br /><br />while(pf_opendir(&amp;dir,&quot;test&quot;));<br /><br />lcd_locate(0,0);<br />printf(&quot;OKEY3&quot;);<br /><br /><br />//file extension in name file is neccesarry, example: 12.txt (no), only file txt and name: 12.<br />while(pf_open(&quot;test/test.txt&quot;));<br /><br />//while(pf_read(bufor_read_with_sd,1,&amp;position_ind_sector));<br />lcd_locate(3,0);<br />//lcd_str(bufor_read_with_sd);<br />lcd_str_P(PSTR(&quot;zapisano&quot;));<br /><br />//while(pf_read(bufor_read_with_sd,sizeof(bufor_read_with_sd),&amp;position_ind_sector));<br />//lcd_locate(2,0);<br />//lcd_str(bufor_read_with_sd);<br />//while(pf_read(bufor_read_with_sd,sizeof(bufor_read_with_sd),&amp;position_ind_sector));<br />//lcd_locate(3,0);<br />//lcd_str(bufor_read_with_sd);<br /><br />/*sei();<br />uart_puts_P(PSTR(&quot;OKEY\r\n&quot;));<br />uart_puts_P(PSTR(&quot;send_file...\r\n&quot;));<br />while(1)<br />{<br />while(pf_read(bufor_read_with_sd,100,&amp;position_ind_sector));<br />//while(disk_readp(bufor_read_with_sd,num_sector,0,512));<br />uart_puts(bufor_read_with_sd);<br />for(int i=0; i&lt;sizeof(bufor_read_with_sd) ; i++)<br />{<br />if(bufor_read_with_sd&#91;i&#93; == '\0')<br />{<br />flaga_read_null = 1;<br />break;<br />}<br />}<br />for(int i=0; i&lt;sizeof(bufor_read_with_sd) ; i++)<br />{<br />bufor_read_with_sd&#91;i&#93; = '\0';<br />}<br /><br />if(flaga_read_null == 1)<br />{<br />flaga_read_null = 0;<br />break;<br />}<br />num_sector++;<br />}*/<br /><br /><br /><br /><br /><br />}<br />if( (PINC &amp; CD) )<br />{<br />lcd_locate(1,1);<br />lcd_str(&quot;&#91;&quot;);<br /><br />lcd_str(&quot;&#93;&quot;);<br />_delay_ms(2000);<br /><br />}<br /><br /><br />while(1);<br /><br />}<br /><br />void write_close(void) {<br />BYTE res = disk_writep(0, 0);<br />uint8_t i;<br />for(i=0; i&lt;10000 &amp;&amp; res; i++) res = pf_write(0, 0, &amp;s1);;<br />}[/syntax]<br /><br />taka wersja testowa do odczytu duzych paczek. Lepszy jest jednak ten większy fatfs, ale soft jest i działa i zapis i odczyt.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1035">Paul Dirac</a> — 15 gru 2013, o 12:15</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Krauser]]></name></author>
<updated>2013-12-14T22:48:11+01:00</updated>
<published>2013-12-14T22:48:11+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61165#p61165</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61165#p61165"/>
<title type="html"><![CDATA[Re: Petit FAT library]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61165#p61165"><![CDATA[
<div class="quotetitle">Paul Dirac napisał(a):</div><div class="quotecontent"><br />const char file_name[] = &quot;test&quot;;<br /></div><br />A twój plik nie ma rozszerzenia?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=465">Krauser</a> — 14 gru 2013, o 22:48</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Paul Dirac]]></name></author>
<updated>2013-12-14T22:35:13+01:00</updated>
<published>2013-12-14T22:35:13+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61159#p61159</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61159#p61159"/>
<title type="html"><![CDATA[Re: Petit FAT library]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61159#p61159"><![CDATA[
Po wielu godzianch walki inicjalizuje się i montue. Ale teraz nie chce tworzyć pliku. Kod, który zmontowałem <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" />:<br />[syntax=c]#include &lt;avr/io.h&gt;<br />#include &lt;stdio.h&gt;<br />#include &lt;util/delay.h&gt;<br />#include &lt;avr/pgmspace.h&gt;<br /><br />#include &quot;PetitFS/diskio.h&quot;<br />#include &quot;PetitFS/pff.h&quot;<br /><br />#include &quot;LCD/lcd.h&quot;<br /><br />#define SCK PB7<br />#define MOSI PB5<br />#define SS PB4<br />#define MISO PB6<br /><br />#define CD (1&lt;&lt;PC2)<br /><br />const char file_name&#91;&#93; = &quot;test&quot;;<br /><br />char bufor&#91;128&#93;;<br /><br /><br />/*-----------------------------------------------------------------------*/<br />/* Main                                                                  */<br />int main (void)<br />{<br />DDRA = 0xff;<br />PORTA = 0x00;<br /><br /><br /><br />FATFS fs;/* File system object */<br />//DIR dir;/* Directory object */<br />//FILINFO fno;/* File information */<br /><br />//PWR<br /><br /><br /><br />//configuration for SPI<br />DDRB |= (1&lt;&lt;MOSI)|(1&lt;&lt;SCK)|(1&lt;&lt;SS);<br />DDRB &amp;= ~(1&lt;&lt;MISO);<br />PORTB |= (1&lt;&lt;SS);//mode SLAVE<br /><br />//PWR<br />DDRC |= (1&lt;&lt;PC3);//jako wyjście<br />PORTC &amp;= ~(1&lt;&lt;PC3);//stan niski<br /><br />PORTC |= CD;//CD<br /><br />SPCR |= (1&lt;&lt;SPE)|(1&lt;&lt;MSTR);<br /><br />lcd_init();<br />lcd_locate(0,0);<br />stdout = &amp;mystdout;<br />printf(&quot;jest okey&quot;);<br />_delay_ms(1000);<br />lcd_clear();<br />if( !(PINC &amp; CD) )<br />{<br />while(disk_initialize());<br /><br />lcd_locate(0,0);<br />printf(&quot;OKEY1&quot;);<br /><br />while(pf_mount(&amp;fs));<br /><br />lcd_locate(0,0);<br />printf(&quot;OKEY2&quot;);<br /><br />while(pf_open(file_name));<br /><br />lcd_locate(0,0);<br />printf(&quot;OKEY3&quot;);<br />}<br />if( (PINC &amp; CD) )<br />{<br />lcd_locate(1,1);<br />lcd_str(&quot;&#91;&quot;);<br /><br />lcd_str(&quot;&#93;&quot;);<br />_delay_ms(2000);<br /><br />}<br /><br /><br />while(1);<br /><br />}[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1035">Paul Dirac</a> — 14 gru 2013, o 22:35</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Paul Dirac]]></name></author>
<updated>2013-12-14T17:14:57+01:00</updated>
<published>2013-12-14T17:14:57+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61092#p61092</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61092#p61092"/>
<title type="html"><![CDATA[Re: Petit FAT library]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61092#p61092"><![CDATA[
W sumie nie. Ale fakt obczaje na M32. Zaraz sprawdzę.<br /><br /><strong><span style="color: #808000">------------------------ [ Dodano po: 38 minutach ]</span></strong><br /><br />Tak jak myslałem, nie ma żadnej róznicy. Jak to jest nie działa, ale jak zadzziała to juz zawsze działa <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" />. Przesiadłem sie na M32 i to samo. Połaczenie poprawne, bo działa mi ten duży fatfs, ale petit nie <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" />. pewnie coś w programie siedzi.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1035">Paul Dirac</a> — 14 gru 2013, o 17:14</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[acid3]]></name></author>
<updated>2013-12-14T16:31:54+01:00</updated>
<published>2013-12-14T16:31:54+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61089#p61089</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61089#p61089"/>
<title type="html"><![CDATA[Re: Petit FAT library]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61089#p61089"><![CDATA[
Paul, Twój kod bardzo się różni od kodu z BB. Czy próbowałeś najpierw na M32 np?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=944">acid3</a> — 14 gru 2013, o 16:31</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Paul Dirac]]></name></author>
<updated>2013-12-14T16:01:38+01:00</updated>
<published>2013-12-14T16:01:38+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61084#p61084</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61084#p61084"/>
<title type="html"><![CDATA[Petit FAT library]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5159&amp;p=61084#p61084"><![CDATA[
Cześć!<br /><br />W sumie doszedłem do momentu w książce, w której chcę pobawić sie właśnie tymi bibliotekami i nie chce mi się z inicjalizować microsd. W sumie do tej pory napisałem prosty program, który ma postać:<br />[syntax=c]#include &lt;avr/io.h&gt;<br />#include &lt;stdio.h&gt;<br />#include &lt;util/delay.h&gt;<br /><br />#include &quot;PetitFS/diskio.h&quot;<br />#include &quot;PetitFS/pff.h&quot;<br /><br />#include &quot;LCD/lcd.h&quot;<br /><br />#define SCK PB7<br />#define MOSI PB5<br />#define SS PB4<br />#define MISO PB6<br /><br /><br />char file_name&#91;&#93; = &quot;test.txt&quot;;<br />char bufor&#91;128&#93;;<br /><br /><br />/*-----------------------------------------------------------------------*/<br />/* Main                                                                  */<br />int main (void)<br />{<br />DDRA = 0xff;<br />PORTA = 0x00;<br /><br />BYTE res;<br />WORD s1;<br /><br />FATFS fs;/* File system object */<br />//DIR dir;/* Directory object */<br />//FILINFO fno;/* File information */<br /><br /><br />//configuration for SPI<br />DDRB |= (1&lt;&lt;MOSI)|(1&lt;&lt;SCK)|(1&lt;&lt;SS);<br />DDRB &amp;= ~(1&lt;&lt;MISO);<br />PORTB |= (1&lt;&lt;SS);//mode SLAVE<br /><br />//PWR<br />DDRC |= (1&lt;&lt;PC3);//jako wyjście<br />PORTC &amp;= ~(1&lt;&lt;PC3);//stan niski<br /><br />SPCR |=(1&lt;&lt;SPE)|(1&lt;&lt;MSTR);<br />SPCR |= (1&lt;&lt;SPR1) | (1&lt;&lt;SPR0) ;<br /><br />lcd_init();<br />lcd_set_xy(0,0);<br />stdout = &amp;mystdout;<br />printf(&quot;OKEY&quot;);<br />_delay_ms(1000);<br />lcd_clear();<br />lcd_str(&quot;odczyt: test.txt&quot;);<br />lcd_set_xy(1,0);<br /><br />_delay_ms(10000);<br /><br />res = disk_initialize();<br />_delay_ms(1000);<br />if( res == FR_OK ) {<br />res = pf_mount(&amp;fs);<br />if( res == FR_OK ) {<br />} else lcd_str(&quot;mount error&quot;);<br />} else lcd_str(&quot;disk init error&quot;);<br /><br />while(1);<br /><br />}[/syntax]<br /><br />I ciągle mam komunikat na lcd: &quot;disk init error&quot;. Nie mam pomysłu co gdzie szukać. Bo nawet zmniejszyłem szybkość komunikacji spi prescalerem. Do zabawy wykorzystuje atmege664p. W sumie może ktoś miał podobny problem i udało mu sie to rozwiązać. To dzieki za all sugestie.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1035">Paul Dirac</a> — 14 gru 2013, o 16:01</p><hr />
]]></content>
</entry>
</feed>