Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

For Beginners...
Goto page 1, 2  Next
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> KokkeKat FAT-free SD card lib
View previous topic :: View next topic  
Author Message
manans

Bascom Member



Joined: 30 Jan 2009
Posts: 18

india.gif
PostPosted: Fri Jul 08, 2011 7:54 am    Post subject: For Beginners... Reply with quote

Hello Niclas,
Very goog work....I am new to SD card interfacing....I read your library, but honestly I could not relate it.... I want to interface SD_HC card with xmega controller...I want to create a file and write it to on SD card and save it....How to start is a question for me.....Your help will be great for me.....
Back to top
View user's profile
KokkeKat

Bascom Member



Joined: 08 May 2011
Posts: 59
Location: Stockholm

sweden.gif
PostPosted: Fri Jul 08, 2011 6:52 pm    Post subject: Reply with quote

Hi Manans

I'm sorry, but I can't provide beginner's help. Please understand that I am providing this free of charge, which means the users need to learn on their own. This support forum is primarily intended for getting help when a real (or suspected) bug is found in my code.

Please see the files named Example_*.bas, Main.bas, and KokkeKat FAT-free SD library Application Note v1.0.pdf.

If anything is unclear after reading them, please post a detailed description of the problem you are facing.

You could also take a look in the other threads in this forum.

Kind regards

Niclas
Back to top
View user's profile
manans

Bascom Member



Joined: 30 Jan 2009
Posts: 18

india.gif
PostPosted: Wed Jul 13, 2011 11:41 am    Post subject: Reply with quote

I have read main program and after compiling it gives 4 errors...Assignement errors and if endif error

my SDusefind=0 and Sddirlist=1

how to remove this?
Back to top
View user's profile
KokkeKat

Bascom Member



Joined: 08 May 2011
Posts: 59
Location: Stockholm

sweden.gif
PostPosted: Wed Jul 13, 2011 4:11 pm    Post subject: Reply with quote

Hi Manans

Could you please post your developer settings from the declarations file and also the exact error messages you receive?

Kind regards

Niclas
Back to top
View user's profile
manans

Bascom Member



Joined: 30 Jan 2009
Posts: 18

india.gif
PostPosted: Thu Jul 14, 2011 7:03 am    Post subject: Reply with quote

Hi Niclas,

I found it that when I include write file example then I get those errors, but when I comment it then it goes...

It belongs to write file example ....
now in write file example...
Sdentrynames = "138 TXT"
what does it mean??
Back to top
View user's profile
KokkeKat

Bascom Member



Joined: 08 May 2011
Posts: 59
Location: Stockholm

sweden.gif
PostPosted: Thu Jul 14, 2011 8:37 am    Post subject: Reply with quote

Hi Manans

Without any information to go on, I would guess that you either have a non-working combination of developer settings or you are including an example file that doesn't work with your developer settings. It might be that variable Sdentrynames gets declared twice because of this.

If you want me to help you further, you must follow my instructions so I can get the information I need. Could you please post your developer settings from the declarations file and also the exact error messages you receive?

Kind regards

Niclas
Back to top
View user's profile
manans

Bascom Member



Joined: 30 Jan 2009
Posts: 18

india.gif
PostPosted: Thu Jul 14, 2011 12:57 pm    Post subject: Reply with quote

sorry for not giving what you want....

switches...

' Developer switches:

' 1 = minimum detail (only make sure that the init is successful)
' 0 = full detail (return full detail if init is unsuccessful)
Const Sdinitdetail = 1

' 1 = FAT16/32 file system active
' 0 = FAT16/32 file system not active (only read and write raw sectors)
Const Sdfsactive = 1

' 1 = Use the FIND routine
' 0 = Don't use the FIND routine
Const Sdusefind = 0

' 1 = Enable Sdusefindstoreentry
' 0 = Don't enable Sdusefindstoreentry
Const Sdusefindstoreentry = 0

' 1 = Use Sddirlist
' 0 = Don't use Sddirlist
Const Sdusedirlist = 1 ' Use or don't use
Const Sddirlistarraysize = 12 ' If used, set the size of the array that holds the cluster numbers

' 1 = read
' 0 = not reading
Const Sdrmode = 1

' 2 = write unbuffered
' 1 = write buffered
' 0 = not writing
Const Sdwmode = 0

' 1 = Use Sdappend
' 0 = Don't use Sdappend
Const Sduseappend = 0

' 1 = Clear the unused end of the sector before writing it to the SD card
' 0 = Don't clear the unused end of the sector before writing it to the SD card
Const Sdcleartail = 0

' 1 = Use FAT32 fsinfo sector data
' 0 = Don't use FAT32 fsinfo sector
Const Sdusefsinfo = 0

' 1 = Use Long FileNames when reading
' 0 = Don't use Long FileNames when reading
Const Sduselfn = 1

' 1 = When using lfn, also support file name comparison
' 0 = When using lfn, don't support file name comparison
Const Sduselfncompare = 0

' 1 = Use wipe
' 0 = Don't use wipe
Const Sdusewipe = 0

' 1 = Use the size info routine
' 0 = Don't use the size info routine
Const Sdusesizeinfo = 0

' 1 = Use the CRC7 function
' 0 = Don't use the CRC7 function
Const Sdusecrc7 = 0 ' This has no practical use in the library - use it if you want to add CRC7 checks yourself

Error message:File is attached.
Back to top
View user's profile
KokkeKat

Bascom Member



Joined: 08 May 2011
Posts: 59
Location: Stockholm

sweden.gif
PostPosted: Thu Jul 14, 2011 1:17 pm    Post subject: Reply with quote

Hi Manans

Thanks. If you want to write, you need to set this switch to 1 or 2:
' 2 = write unbuffered
' 1 = write buffered
' 0 = not writing
Const Sdwmode = 0


In this case, I also recommend setting this switch to 1:
' 1 = Use FAT32 fsinfo sector data
' 0 = Don't use FAT32 fsinfo sector
Const Sdusefsinfo = 0

Please also notice the bugs and fixes reported in one of the sticky threads.

Kind regards

Niclas
Back to top
View user's profile
manans

Bascom Member



Joined: 30 Jan 2009
Posts: 18

india.gif
PostPosted: Sun Jul 24, 2011 7:48 pm    Post subject: Reply with quote

Hi Niclas,
I am currently following your code, meanwhile I want to ask you couple of questions..
1. If I create a file, where I can write the file name?....which can be dynamic.....
2. After writing so many file (say 100) then If I want to search file from SD card....is it possible....?
Back to top
View user's profile
KokkeKat

Bascom Member



Joined: 08 May 2011
Posts: 59
Location: Stockholm

sweden.gif
PostPosted: Wed Jul 27, 2011 1:23 am    Post subject: Reply with quote

Hi Manans

Yes. Please see the example code included in the download zip file.

Kind regards

Niclas
Back to top
View user's profile
manans

Bascom Member



Joined: 30 Jan 2009
Posts: 18

india.gif
PostPosted: Tue Aug 02, 2011 1:17 pm    Post subject: Reply with quote

Hi Niclas,
I am building the schematic as shown in the pdf of yours. I wonder you have shown 5 resistors one side connected to 3.3v and other side at respective pins..Is it for pulling up or is it something related 5v-3.3v adjustment...

Secondly after this when I compile and load hex file of Main.bas for writing a file, do I need to copy and paste whole program of "example_write_file_"in the main.bas ? or include statement itself executes the whole program(like any function)....If yes then how I can give dynamic file name and write dynamic data?

sorry for troubling...it seems I am not following good enough...
Back to top
View user's profile
KokkeKat

Bascom Member



Joined: 08 May 2011
Posts: 59
Location: Stockholm

sweden.gif
PostPosted: Tue Aug 02, 2011 1:35 pm    Post subject: Reply with quote

Hi Manans

Yes, the resistors are needed for pull-up to 2.7-3.6V. It is absolutely necessary that you have a good power supply that can deliver enough current within this voltage range. Any 3.3V voltage regulator with matching filter capacitors should work. If you use 5V, you are very likely to fry the SD card sooner or later.

Please see the Bascom help from inside the editor. Type "include", position your cursor and click inside this text and then press F1. INCLUDEs are used so that you don't have to physically copy the code into your program. Just include it and make sure that you include the data declarations at the beginning and the code at the end. The code in the include file typically is functions, subroutines, or gosubs.

See the example file for writing a file. The filename should be placed either in string Sdentrynames or in byte array Sdentrynameb(). Make sure that you follow the 8.3 naming rules. Simple rule: Use only CAPITAL English letters and "_" and you'll be fine. Don't enter the "." It is implicit.

Kind regards

Niclas
Back to top
View user's profile
manans

Bascom Member



Joined: 30 Jan 2009
Posts: 18

india.gif
PostPosted: Wed Aug 03, 2011 8:31 am    Post subject: Reply with quote

Hi Niclas,
Thank you so much for reply, its making me more interesting...
As I understand about include statement which is just like any function residing as a different file name....now as I want to give dynamic file name I have to declare sdentrynames or byte array Sdentrynameb in the Main file OR it is declared at in other file(global so I can use it anywhere)... and after doing so I have to modify statements in "write_file" regarding file name...(sdentrynames should be deleted from file)

And same thing for dynamic data entry....sdtempb2 declaration and data assignment....
If I want to write 20 different bytes what I should write in my Main file....

I wonder If I can remove the include statement and use that file inside main.bas as a function....is it possible?
Back to top
View user's profile
KokkeKat

Bascom Member



Joined: 08 May 2011
Posts: 59
Location: Stockholm

sweden.gif
PostPosted: Wed Aug 03, 2011 10:53 am    Post subject: Reply with quote

Hi Manans

Please look at the two library files included in the zip file. One contains the developer switches and data declarations and the other contains the code. All the declarations required for this library are included already.

Do not change the data declarations or code in the two library files (except for the bugfix found in a separate thread). (If you do, I won't be able to support you.)

When you have successfully used the example code to create a file, you can copy the code from Main.bas and Example_...bas into your own program.

Kind regards

Niclas
Back to top
View user's profile
manans

Bascom Member



Joined: 30 Jan 2009
Posts: 18

india.gif
PostPosted: Fri Aug 26, 2011 10:34 am    Post subject: Reply with quote

Hi Niclas!
I have one doubt, is this library work on Micro SD card? I have read that in MicroSD card the SPI mode is optional. So should I try on SD card? (the big one). Which card you have used?
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> KokkeKat FAT-free SD card lib All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum