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 CCS Technical Support

SD CARD CCS C

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ilker07



Joined: 03 Jun 2022
Posts: 45

View user's profile Send private message

SD CARD CCS C
PostPosted: Fri Jun 27, 2025 1:15 am     Reply with quote

Hi eveyone,I try to use sd card(480*320 ILI9486) with PIC18F67K22.I use Kingston 8 gb sd card I formatted sd as FAT32 and I put test.txt file and put 'G' character but i gives me 'B' character when I try to read the file.Then I replaced the 'G' with 'A' but it gives me 'B' again .What is the problem??

#include <18F67K22.h>
#use delay(xtal=20MHz,clock=80MHz)
#use fast_io(c)
#define MMCSD_PIN_SCK PIN_C3 //o
#define MMCSD_PIN_SDI PIN_C4 //i
#define MMCSD_PIN_SDO PIN_C5 //o
#define MMCSD_PIN_SELECT PIN_E1 //

#include <mmcsd_m.c>
#include <fat_m.c>

void main() {

int8 i;
FILE myfile;



i = fat_init();

if(i != 0) tft_fill_color(0xf800); //red

else {

if(fatopen((char *)"/test.txt", (char *)"r", &myfile) != 0) tft_fill_color(0x001F);


else {

signed int ch_int;
char text[10];


fatseek(&myfile, 0, SEEK_SET); // begining of the file
ch_int=fatgetc(&myfile);

if (ch_int != EOF) {
unsigned char ch=(char)ch_int;
drawChar16x32(100,100,ch,0xffff,0x0000);
fatclose(&myfile);
}


}

}



while(TRUE) ;





}
temtronic



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

View user's profile Send private message

PostPosted: Fri Jun 27, 2025 5:10 am     Reply with quote

hmm quick basic hardware questions
1) what VDD running the PIC on ?
2) proper pullups/downs/ caps for the SD card ?
ilker07



Joined: 03 Jun 2022
Posts: 45

View user's profile Send private message

PostPosted: Fri Jun 27, 2025 6:14 am     Reply with quote

temtronic wrote:
hmm quick basic hardware questions
1) what VDD running the PIC on ?
2) proper pullups/downs/ caps for the SD card ?


5v and There are no pull up or donw resistors..
ilker07



Joined: 03 Jun 2022
Posts: 45

View user's profile Send private message

PostPosted: Fri Jun 27, 2025 6:20 am     Reply with quote

temtronic wrote:
hmm quick basic hardware questions
1) what VDD running the PIC on ?
2) proper pullups/downs/ caps for the SD card ?



[img][/img]
Ttelmah



Joined: 11 Mar 2010
Posts: 19871

View user's profile Send private message

PostPosted: Fri Jun 27, 2025 6:51 am     Reply with quote

OK.

That has a voltage regulator to give the 3.3v for the SD card, but does not
have any level translation for the SD.
You need to read the sticky at the top of the forum about 5v and 3.3v devices,
and add level translation to your circuit. Also you need to be very careful
about having a good supply capacitor close to the 5v connection. The unit
is a little 'naughty' (doesn't actually meet the SD recommedations, about the
decoupling provided to the SD itself.
Read the sticky. It describes the circuits you need.
You also need to look at the code library, and get the modified drivers
for high capacity SD cards.
As a community, 'hopefully you have the voltage regulator enabled.
This is required above 3.6v.
Also the chip is not rated to run to 80MHz. 64MHz max. The maximum
crystal frequency with the PLL enabled is 16MHz. Look at table 31-7
section 1A in the data sheet.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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