Author Topic: SDCARD STM32f030k  (Read 1180 times)

0 Members and 1 Guest are viewing this topic.

Offline alizare368Topic starter

  • Regular Contributor
  • *
  • Posts: 56
  • Country: de
SDCARD STM32f030k
« on: November 02, 2019, 02:01:53 pm »
Hi everybody
I want to launch SD card with STM32f030k ,and I connected the pins like this.

SDcard pin number         MCUpin
3(MOSI)                         A7
4(POWER)                      3.3v
5(CLK)                           A5
6(GND)                          GND
7(MISO)                         A6
2(CS)                             A0

when the program reaches this line (myfres=disk_initialize(0);).Inter this part.
this function is in the mmc.c
Code: [Select]
static
void power_on (void)
{

for (Timer1 =3; Timer1; ); /* Wait for 30ms */

}

And stays there.
This is my code:
Code: [Select]
#include "main.h"

/* USER CODE BEGIN Includes */
 #include "stdio.h"
 #include "low_level.h"
 #include "ff.h"
 #include "diskio.h"

/* USER CODE END Includes */

/* USER CODE BEGIN 0 */

FATFS fs;
FIL myfile;
 #define sample_no 100
static uint16_t sai_buf[2][sample_no];

/* USER CODE END 0 */

int main(void)
{
  /* USER CODE BEGIN 1 */
static FRESULT  myfres=1;
uint32_t bt;

  /* USER CODE END 1 */

 /* USER CODE BEGIN 2 */

myfres=disk_initialize(0);
myfres=f_mount(0, &fs);
myfres=f_open(&myfile, "1.wav",FA_READ);
myfres=f_read(&myfile,&sai_buf[0],sample_no,&bt);
myfres=f_read(&myfile,&sai_buf[1],sample_no,&bt);


  /* USER CODE END 2 */

 while (1)
  {
   
  }
 
}

this code working for stm32f401 ,but I don't know why it doesn't work  for stm32f030k ? |O


 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf