View previous topic :: View next topic |
Author |
Message |
temtronic
Joined: 01 Jul 2010 Posts: 9506 Location: Greensville,Ontario
|
|
Posted: Sat Jul 05, 2025 5:02 am |
|
|
it's because you MUST fix the hardware !
You must install 'logic level ' translation between the SD device and the PIC.
As Mr. T has pointed out the 3v SD can't send a '1' to the 5 v PIC.
NO code you try will work.
You must correct the hardware first THEN the software will work.... |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19891
|
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 57
|
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19891
|
|
Posted: Mon Jul 07, 2025 5:20 am |
|
|
No.
If you get the picture of the back of the board for that, the connections
to the SD card, just run directly to the pins. No level translation at all.
The SD card interface in the link I sent, has the IC on it to do the level
translation. |
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 57
|
|
Posted: Mon Jul 07, 2025 5:21 am |
|
|
Ttelmah wrote: | No.
If you get the picture of the back of the board for that, the connections
to the SD card, just run directly to the pins. No level translation at all.
The SD card interface in the link I sent, has the IC on it to do the level
translation. |
Then ,why does not it work?I dont understand?? |
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 57
|
|
Posted: Mon Jul 07, 2025 5:25 am |
|
|
Ttelmah wrote: | No.
If you get the picture of the back of the board for that, the connections
to the SD card, just run directly to the pins. No level translation at all.
The SD card interface in the link I sent, has the IC on it to do the level
translation. |
if(fatopen((char *)"test.txt", (char *)"r", &myfile) != 0) fprintf(SCREEN,"fileerror\n");
else {
signed int ch_int;
unsigned char ch;
fprintf(SCREEN,"file ok\n");
fatseek(&myfile, 0, SEEK_SET);
ch_int=fatgetc(&myfile);
if (ch_int != EOF) {
ch=(char)ch_int;
fprintf(SCREEN,"%c",ch);
}
fatseek(&myfile, 1, SEEK_SET); // 2. character
ch_int=fatgetc(&myfile);
if (ch_int != EOF) {
ch=(char)ch_int;
fprintf(SCREEN,"%c",ch);
}
fatclose(&myfile);
}
it only says file ok!!! |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9506 Location: Greensville,Ontario
|
|
Posted: Mon Jul 07, 2025 5:30 am |
|
|
You power the PIC with 5 volts, but the SD chip runs at 3 volts.
The SD chip can only give 3 volts for a '1' (high) BUT the PIC requires 5 volts for a '1'(high).
The PIC will NOT see ANY 'high' levels from the SD chip.
This is why you need 'logic level' convertors or translators'.They WILL change the 3 volts '1' signal from the sd chip into 5 volts that the PIC requires. |
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 57
|
|
Posted: Mon Jul 07, 2025 5:41 am |
|
|
Ttelmah wrote: | No.
If you get the picture of the back of the board for that, the connections
to the SD card, just run directly to the pins. No level translation at all.
The SD card interface in the link I sent, has the IC on it to do the level
translation. |
but it works with arduino?? |
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 57
|
|
Posted: Mon Jul 07, 2025 5:42 am |
|
|
temtronic wrote: | You power the PIC with 5 volts, but the SD chip runs at 3 volts.
The SD chip can only give 3 volts for a '1' (high) BUT the PIC requires 5 volts for a '1'(high).
The PIC will NOT see ANY 'high' levels from the SD chip.
This is why you need 'logic level' convertors or translators'.They WILL change the 3 volts '1' signal from the sd chip into 5 volts that the PIC requires. |
but I can use it with Arduino. |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19891
|
|
Posted: Mon Jul 07, 2025 5:44 am |
|
|
Read the sticky at the top of the forum about this.
SPI, actually _requires_ the high level of the signals goes to 0.8* the
supply. So for the PIC 4v. A lot of chips do not implement this, so will
accept 3.3v. The PIC though does. The device you are showing does
not have the level translation to convert the SD card signals to suit
the PIC. The little SD card adapter used in the example you pointed to
does have this translation.
The code is never going to work without this.
No amount of fiddling is going to make it work until this is fixed. |
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 57
|
|
Posted: Mon Jul 07, 2025 6:54 am |
|
|
RC3, RC4 ==> 0.7 VDD
I think this the problem these pins accept at least 3.5 v |
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 57
|
|
Posted: Mon Jul 07, 2025 7:38 am |
|
|
but it says On-board 5V/3.3V level shifting IC, compatible with 5V/3.3V operating voltage. It has to work??? |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9506 Location: Greensville,Ontario
|
|
Posted: Mon Jul 07, 2025 8:00 am |
|
|
please post a link or product info of the LCD/SD module.
Many makers LIE about the 'level shifting'. Really need to see the ACTUAL schematic of the PCB to understand why ,but I suspect they're really saying 5 volts can't destroy the 3v SD chip onboard.
BTW the Arduino uses a different 'tech' under the epoxy than PICs do |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19891
|
|
Posted: Mon Jul 07, 2025 11:12 pm |
|
|
The board has a 3.3v regulator to run the SD, but does not have level
shifting to the SD card. I looked at the image and you can see the tracks
go directly to the connector without level shifting.
The PIC is one of the few processors that insist on proper SPI signal
levels. This board will not work without added shifters. |
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 57
|
|
Posted: Tue Jul 08, 2025 5:27 am |
|
|
Ttelmah wrote: | The board has a 3.3v regulator to run the SD, but does not have level
shifting to the SD card. I looked at the image and you can see the tracks
go directly to the connector without level shifting.
The PIC is one of the few processors that insist on proper SPI signal
levels. This board will not work without added shifters. |
There are 2 74LVC245A IC on the shield.Arent they level-shifter 3.3 to 5 v?? |
|
 |
|