Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

SD card read and write using SPI protocol

Status
Not open for further replies.

RenesasT

Full Member level 2
Joined
Mar 11, 2016
Messages
149
Helped
0
Reputation
0
Reaction score
0
Trophy points
16
Activity points
1,330
Dear all,

I am using Renesas Microcontroller RX111 series with E2 studio.

I have connected SD card with the same. The thing is that I am not able to read and write data into it after so much trying.

Please help me with that.

I am using CATALEX MICRO SD CARD adapter.

Please help me as I am in big trouble.

Rene
 

Test the SD card is working properly with some electronic gadgets.
Check for the pin connections first for SD card connector as per the standard. Atleast post the circuit will let you know...
 

Some libraries are able to deal with just one tipe of formatting (FAT16, FAT32) or are limited in size.
Check at the SD card program if there exists any of these restrictions.
 

Dear hobbyckts,

Test the SD card is working properly with some electronic gadgets.
Check for the pin connections first for SD card connector as per the standard. Atleast post the circuit will let you know...

I have checked SD card using laptop, its detecting.

SPI to adapter

VCC-----------VCC
GND----------GND
MISO---------MISO
MOSI---------MOSI
SCK----------SCK
SS------------CS


Dear Andre,

Some libraries are able to deal with just one tipe of formatting (FAT16, FAT32) or are limited in size.
Check at the SD card program if there exists any of these restrictions.

How to check it...?

thanks for helping me . Both please keep going.. Lets resolve this and will have a good party.
 

You connected the wrong way: MOSI of the master have to be connected to MISO of device, and vice-versa.
 

Hi,

You connected the wrong way: MOSI of the master have to be connected to MISO of device, and vice-versa.

I don´t think so.

MOSI: Master out - slave in. Master output MOsi --> moSI the slave input
MISO: Master in - slave out. Master input MIso <-- miSO the slave output


Klaus
 

Dear Andre,

You connected the wrong way: MOSI of the master have to be connected to MISO of device, and vice-versa.

Are you sure about it??

My controller is my MASTer and SD card adapter is slave . I have connected MOSI to MOSI. When master out then slave should be input.

You are saying, MOSI to MISO. In this case Master out and slave is also out.

Please confirm if I am wrong. I am awaiting for your reply.

Thnks
 

Both you are absolutely right, no idea how I made that confusion.
The above connections you've originally posted are pretty correct.
 

Dear all,

I am trying this from last 14 days. Its not happening. I think you guys could do something. I am ready to provide all detail whatever you all require. But I desperately need a help.
 

Hi,

Its not happening

please tell us detailed how you see it is not working.
We have no clue wha´ts happening as long as you don´t tell us.

Klaus
 

it has function f_mount which should return FR_OK. But its replying FR_NOT_READY

Sorry, but I have to ask:
Have you confirmed if the card switch is not at the Lock position ?
 

Hi,

See, i am using the library given on the url http://elm-chan.org/fsw/ff/00index_e.html

it has function f_mount which should return FR_OK. But its replying FR_NOT_READY.

This is urgent information we need to know.
What f_mount parameters did you use?

***
Did you use "disk_initialize" before? Be careful it may destroy all data on the SD. Read documentatin. There is a warning: An application must not call this function.

***
Can you perform "disk_status"?

Klaus
 

Dear KlausT,

Please find my main function as below

Code:
void main(void)
{
    R_MAIN_UserInit();
    /* Start user code. Do not edit comment generated here */
    res = f_mount( &fs[0],"0:file1.txt",1);

    res = f_open(&fsrc, "0:file1.txt", FA_CREATE_ALWAYS | FA_WRITE);
     //  LED04 = ~LED04;

       for (i=0;i<2000;i++)
          {
            res = f_write(&fsrc, buffer, 9, &bw);               /* Write data to the file */
       //     LED04 = ~LED04;                                     /* Do something so we can see it */
          }
       f_close(&fsrc);

       f_mount(0, 0,0);
    while (1U)
    {
        ;
    }
    /* End user code. Do not edit comment generated here */
}

I have been trying since long but no luck.

Please help me.

- - - Updated - - -

Dear Andre,

Which lock position? what are you talking about. Are you talking about the locking system when sd card is inserted in laptop?
 

Which lock position? what are you talking about. Are you talking about the locking system when sd card is inserted in laptop?

I was referring to the switch that put the card in write protection mode.
I'm sure that you cartainly already checked this, but I'm asking just to remind.

lock.png
 

Hi,

I´m not familiar with this stuff..
Code:
    res = f_mount( &fs[0],"0:file1.txt",1);
Is it correct to mount the filename?

Try: res = f_mount( &fs[0], "0:", 1);

Klaus
 

Dear Andre,

I am using Catalex micro SD card adapter which uses micro sd card. below images are for your reference.

- - - Updated - - -

Dear KlauST,

The same thing, its replying FR_NOT_READY. What to do?
 

Attachments

  • 8945277041olE0CgYIL14375577411457266485.jpg
    8945277041olE0CgYIL14375577411457266485.jpg
    14 KB · Views: 98
  • CATALEX.jpg
    CATALEX.jpg
    14.7 KB · Views: 113

I am using Catalex micro SD card adapter which uses micro sd card. below images are for your reference

This do not answer the question, that is :
Did you already removed the card of the board to certify in which position is the switch ?
 

Dear Andre,

It doesn't have any lock type switch. Its a micro sd card , just simply acard which we used in smart phones. The image that you given is used for cameras. Catalex sd card adapter does not require that locking part. Directly put micro sd card into it. Thank you.
 

Dear KlauST,

the function res = f_mount( &fs[0], "0:", 1); is giving same reply as FR_NOT_READY. Please help.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top