Moin Moin,
Ja, ist wirklich alt. Ein Tipp für eine einfache neuere lib die gut
funktioniert wäre klasse!
zum Problem:
Aus main_simple.c im Beispiel code. Ziel ist es n mal 1024 Byte aus
einer Datei zu lesen und zu bearbeiten. Den Rest ( falls vorhanden )
ebenfalls auslesen und den lese-Buffer mit 0x00 padden und weiter
verabeiten.
Es scheitert schon am simplen auslesen. Nach 4 Blöcken a´1024 Byte wird
nur noch 0x00 aus der Datei gelesen obwohl definitiv andere Daten in der
datei stehen.
Was mache ich hier falsch??
1 | // ***************************************************
|
2 | // read file complete and print via uart!
|
3 | if( MMC_FILE_OPENED == ffopen(file_name,'r') ){
|
4 |
|
5 | for(i = 0; i < 8; i++) {
|
6 | for(blk = 0; blk < 1024; blk++)
|
7 | bytes[blk] = ffread();
|
8 |
|
9 | uputc(bytes[0]); // only for check Byte 0
|
10 | uputc(bytes[1]); // only for check Byte 1
|
11 | }
|
12 |
|
13 | ffclose();
|
14 | }
|
Serial Output in Hex:
1 | 0A 42 6F 6F 74 2E 2E 2E 4F 4B 0A //Boot...OK
|
2 |
|
3 | 01 31 // Byte 0/1 Block 0
|
4 | 20 31 // Byte 0/1 Block 1
|
5 | 20 20 // Byte 0/1 Block 2
|
6 | 72 00 // Byte 0/1 Block 3
|
7 | 00 00 // Byte 0/1 Block 4
|
8 | 00 00 // Byte 0/1 Block 5
|
9 | 00 00 // Byte 0/1 Block 6
|
10 | 00 00 // Byte 0/1 Block 7
|
Daaanke für jeden Tipp,
gruß
Karsten