Jump to content
ELFORUM - Forumul Electronistilor
Sign in to follow this  
Drk_alien

Conectare la SD card platita

Recommended Posts

Buna,

Se apropie licenta la faculta si nu reusesc deloc sa interfatez un modul sd card cu pic MCU.

Sunt dispus sa platesc pentru cine se ofera sa ma ajute.

Doresc interfatarea cu un pic 18f4550 sau pic18f2580 a unui modul de citire sd ( https://encrypted-tbn1.gstatic.com/imag ... EvbMmSHu8U ). Programul sa foloseasca libraria de la MicroElectronika pentru scriere si citire de fisiere,creare director..etc (neaparat libraria de la MicroElectronika ) .

 

Eu am modul, am carduri de 16mb si 1Gb, am placile de dezvoltare cu aceste pic-uri, am clona Pickit2.

 

Astept oferte si eventual sa imi ziceti daca e nevoie sa va trimit cardul,modulul..etc.

Ma puteti contacta la [email protected].

 

Multumesc.

Share this post


Link to post
Share on other sites

Incerca sa folosesti Micro C. Uite-te la help. S-ar putea sa aiba exemple si proceduri deja definite pentru SD card.

Share this post


Link to post
Share on other sites

Deci..(fara deci :d)

Am pus aici o poza cu circuitul,am mai observat ca nu imi scrie programul in pic.Oare de ce?(ultima poza - memoria ramane asa D7FF FFF.....etc. Deci gol.)

Posted Image

Apoi o poza cu ce notite mi-am luat despre SPI si conexiunea in cauza.

Posted Image

 

Pe scurt , placa merge pt ecran 3310, PS2 ...leduri . Am legat asa:

RC5->MOSI

RC4->MISO

RC3->SCK

RC0->CS

 

Posted Image

 

Daca scriu un program care imi aprinde niste leduri...memoria este scrisa.Ciudat..nu?

 

Va multumesc . :)

Share this post


Link to post
Share on other sites

In primul rand ti-as recomanda sa folosesti fire mai scurte intre pk2 si pic, si nu neaparat paralele.In al doilea rand as incerca si cu mplab, eu am mai avut probleme cu softul pks.

Share this post


Link to post
Share on other sites

Poate cineva sa imi compileze codul asta?... special pt pic18f2580 la 6 mhz.

Cred ca hexu' generat de microC-ul meu e cam puscat.

O sa incerc si mplab.

sbit Mmc_Chip_Select           at LATC0_bit;  // for writing to output pin always use latch (PIC18 family)sbit Mmc_Chip_Select_Direction at TRISC0_bit;// eof MMC module connectionsconst LINE_LEN = 43;char err_txt[20]       = "FAT16 not found";char file_contents[LINE_LEN] = "XX MMC/SD FAT16 library by Anton Rieckertn";char           filename[14] = "MIKRO00x.TXT";          // File namesunsigned short loop, loop2;unsigned long  i, size;char           Buffer[512];// Creates new file and writes some data to itvoid M_Create_New_File() {  filename[7] = 'A';  Mmc_Fat_Set_File_Date(2010, 4, 19, 9, 0, 0); // Set file date & time info  Mmc_Fat_Assign(&filename, 0xA0);          // Find existing file or create a new one  Mmc_Fat_Rewrite();                        // To clear file and start with new data  for(loop = 1; loop <= 99; loop++) {    UART1_Write('.');    file_contents[0] = loop / 10 + 48;    file_contents[1] = loop % 10 + 48;    Mmc_Fat_Write(file_contents, LINE_LEN-1);   // write data to the assigned file  }}// Main. Uncomment the function(s) to test the desired operation(s)void main() {  ADCON1 |= 0x0F;                  // Configure AN pins as digital  //CMCON  |= 7;                     // Turn off comparators  Delay_ms(10);  // Initialize SPI1 module  SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV64, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);  // use fat16 quick format instead of init routine if a formatting is needed  if (Mmc_Fat_Init() == 0) {    // reinitialize spi at higher speed    SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV4, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);    //--- Test start    //--- Test routines. Uncomment them one-by-one to test certain features    M_Create_New_File();  }  else {  }}

Share this post


Link to post
Share on other sites

In atasament ai fisierul compilat pentru 18F4550 si quartz de 8MHz si pentru uC specificat de tine

Share this post


Link to post
Share on other sites

Va multumesc frumos pentru sfaturi.Am reusit cu ajutorul vostru sa identific problema, aceasta fiind chiar microC-ul meu care imi genera un hex prea mic si cu erori.Intradevar era foarte ciudat pentru ca verificasem de 1000 de ori circuitul atat electric cat si in soft si nu vedeam nimik deosebit.Va multumesc pentru ajutor si pentru rabdare.Codul nu este unul special, este cel din help. Circuitul la fel , tot din help.Multumesc inca odata... :101 icon_jook

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.