CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

SDCARD problems
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rufinopc@rufinogg.com



Joined: 11 Mar 2023
Posts: 17

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 15, 2023 2:14 am     Reply with quote

I am using an 8GB SD card, but I also try a 2GB one and the same thing happens.
I am using the original versions of CCS version 5.109 (fat.c and mmscd.c)
So which versions of these libraries can I use to be sure they work? because after trying several files modified by other users, I decided to use the original versions since they all gave many errors in the compilation.
Ttelmah



Joined: 11 Mar 2010
Posts: 19222

View user's profile Send private message

PostPosted: Wed Mar 15, 2023 3:20 am     Reply with quote

No. The full version is there in the first post in the code library. You will need
your modified DsPIC init. The links are showing the threads where the code
was derived from. You don't have to worry about these, except to see how
the changes evolved and were found.
The question on the 2GB card is how it was formatted?. Cards can be
formatted using GPT or MBR, and FAT16 or FAT32. for reliable operation,
with the standard driver, it needs to be MBR FAT16.
If your machine supports UEFI boot, then by default it'll select GPT.
rufinopc@rufinogg.com



Joined: 11 Mar 2023
Posts: 17

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 15, 2023 3:51 am     Reply with quote

In both cases they are formatted from windows 10 with the own windows 10 application in FAT 32 format.
Ttelmah



Joined: 11 Mar 2010
Posts: 19222

View user's profile Send private message

PostPosted: Wed Mar 15, 2023 7:44 am     Reply with quote

Almost certainly using GPT though, not MBR. If you look through the
links, you will see that this causes problems for the standard driver.
Basically 'where' things are is offset into a sub partition, instead of just
being at a fixed location in the card. The original driver does not handle
this, since historically all SD's were formatted MBR, until the mid 2010's,
and still have to be for many devices like cameras.
rufinopc@rufinogg.com



Joined: 11 Mar 2023
Posts: 17

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 15, 2023 10:57 am     Reply with quote

Are they formatted as GPT, there is no way that they can be used in CCS?
I have tried to change the format with "DISKPART" and it does not allow me to change it because it considers SD as CDROM or DVD
I also can't find any formatters that still have that option, although this would be anchronistic; It's like putting wooden wheels on a car.
I am lost in a sea of doubts and problems. Isn't there anyone who has faced such a seemingly basic problem like saving and recovering files on an SD? because Microchip apparently has it solved in the MPLAB X and not to mention the Arduinos using the microchip, already owned by Microchip.
Any idea to solve the problem? Thank you for the time you are giving me
temtronic



Joined: 01 Jul 2010
Posts: 9107
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Mar 15, 2023 11:05 am     Reply with quote

while I don't use them...perhaps you can get the 'driver' source codes for the other micros and then compare what they do differently than CCS ??
does Olimex have drivers or ask on their 'forum' ??
Ttelmah



Joined: 11 Mar 2010
Posts: 19222

View user's profile Send private message

PostPosted: Wed Mar 15, 2023 11:51 am     Reply with quote

The code in the code library handles this OK.
rufinopc@rufinogg.com



Joined: 11 Mar 2023
Posts: 17

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 15, 2023 11:51 am     Reply with quote

Microchip has examples for 32-bit micros and some examples for PIC24s. Could it be that I have to throw in the towel and work with the MPLABx? Because between adapting the examples to CCS and working with MPLABx I think the latter is easier, but I prefer to continue with CCS...
asmallri



Joined: 12 Aug 2004
Posts: 1630
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Mar 15, 2023 5:12 pm     Reply with quote

Disclaimer: I have not studied the code you are using.

Two points that may help you, I would not get hung up to much on the 400K initialization speed. I regularly test new hardware designs with initialisation speeds of 1MHz or higher. However the pullup on DO of the card is mandatory. The card will intermittently fail to initialise correctly without it.

Try setting the SPI high speed to 8MHz
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!


Last edited by asmallri on Thu Mar 16, 2023 2:16 am; edited 1 time in total
rufinopc@rufinogg.com



Joined: 11 Mar 2023
Posts: 17

View user's profile Send private message Send e-mail

PostPosted: Thu Mar 16, 2023 12:28 am     Reply with quote

Thanks asmallri
I have configured the SPI with 8MHz, but nothing is achieved and it is not a card problem; Fortunately I have found the MiniTool Partition Wizard application that allows us to see if the SD is MBR and "YES" it is, so we can now rule out this problem and focus on what is happening.
The truth is that I have been using CCS since its first version (years ago) and I have never had a problem like this, of course it is due to my ignorance about SD memories.
I can't believe that these problems are not solved by CCS technicians since SD memories have not just fallen from the sky. There is not a single example of the Atmel Mega that does not work with SD and they are real toys compared to CCS
asmallri



Joined: 12 Aug 2004
Posts: 1630
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Mar 16, 2023 2:11 am     Reply with quote

Try this. Format the SD card using a Camera. If not then goto sdcard.org (the organisation that defines SD card standards) and download their SD card format utility and use it to format the card. Why? Some format functions initialise existing data structures on the media, so a problem with the structure is not fixed with formatting the media. Whereas the application from SDcard.org creates the data structures from scratch.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
rufinopc@rufinogg.com



Joined: 11 Mar 2023
Posts: 17

View user's profile Send private message Send e-mail

PostPosted: Thu Mar 16, 2023 2:25 am     Reply with quote

I just formatted it with version 5.02 and it doesn't work either. There is always streaming data at initialization. Data also flows to the first "dir" through the I/Os, although it never appears in the output of the terminal since what it shows is as if the card had nothing, when, in fact, it has two files. With a second "dir" there is no data flow or SD enable pulses, but the terminal always shows an answer as an empty card...
Ttelmah



Joined: 11 Mar 2010
Posts: 19222

View user's profile Send private message

PostPosted: Thu Mar 16, 2023 3:27 am     Reply with quote

A a comment (he is being very careful not to advertise here), but Andrew
above has fully working PIC24 SD drivers. Go to the Brush Electronics site.
His drivers are much more reliable and adjusted compared to the CCS
ones. If you want a solution that works, pay for these. Very Happy
Ttelmah



Joined: 11 Mar 2010
Posts: 19222

View user's profile Send private message

PostPosted: Thu Mar 16, 2023 3:38 am     Reply with quote

And (of course), what syntax are you using to call the read directory
command?. You do realise it needs "/" to read the top directory?. Calling
with a blank name, will return nothing.
rufinopc@rufinogg.com



Joined: 11 Mar 2023
Posts: 17

View user's profile Send private message Send e-mail

PostPosted: Thu Mar 16, 2023 5:03 am     Reply with quote

Thanks for the notice about dir. I always refer to "dir", but the tests are always give the same results:
/> dir
--/--
/> dir
-----------------------
/> dir /
--/--
/>
-------------------------------------------------- --
/> dir/
Unknown Command 'dir/'
/>
It is observed that the command interpreter works well
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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


Powered by phpBB © 2001, 2005 phpBB Group