资源简介

stm32 stm32f103 stm32f10x 的sd卡读写实验例子,sdio模式(非spi),整个工程打包,带串口usart1(115200,8bit,无校验) 调试,把sd卡的数据读出来打印到securityCRT或者超级终端,可用winhex配合调试。是一个sd卡的驱动,由st官方的程序改编。适用于学习

资源截图

代码片段和文件信息

/******************** (C) COPYRIGHT 2009 奋斗嵌入式开发工作室 ********************
* File Name          : main.c  
* Author             : Sun68 
* Version            : V1.0
* Date               : 11/11/2009
* Description        : 演示将一段字符串写入AT45DB161D的1页中,然后读出并通过USART1传送出去。
                       字符串:SPI AT45DB161D Example: This is SPI DEMO 终端上出现这一行字,说明AT45DDB161的读写正常 
                       
    定义:
USART1
TXD1----- PA9-US1-TX
RXD1----- PA10-US1-RX   速率:115200n81 

SPI2 
NSS---PB12-SPI2-NSS
    MISO--PB14-SPI2-MISO
MOSI--PB15-SPI2-MOSI
SCK---PB13-SPI2-SCK


*********************************************************************/
/* Includes ------------------------------------------------------------------*/
#include “stm32f10x.h“
#include “platform_config.h“
#include “stm32f10x_usart.h“
#include “misc.h“


extern void SPI_Flash_Init(void);
extern u8 SPI_Flash_ReadByte(void);
extern u8 SPI_Flash_SendByte(u8 byte);
extern void FlashPageEarse(u16 page);
extern void FlashPageRead(u16 pageu8 *Data);
extern void FlashPageWrite(u16 pageu8 *Data);
extern void FlashWaitBusy(void);
extern void AT45_RomTo_buf(unsigned char bufferunsigned int page);
extern u8 AT45_buf_ToRam(unsigned char bufferunsigned int start_addressunsigned int length);
extern u8 AT45_RamTo_buf(unsigned char bufferunsigned int start_addressunsigned int length);   
extern void AT45_buf_ToRom(unsigned char bufferunsigned int page);
extern void AT45_page_earse(unsigned int page);

extern unsigned char AT45_buffer[];
/** @addtogroup StdPeriph_Examples
  * @{
  */

/** @addtogroup USART_Interrupt
  * @{
  */ 

/* Private typedef -----------------------------------------------------------*/
typedef enum { FAILED = 0 PASSED = !FAILED} TestStatus;

/* Private define ------------------------------------------------------------*/
#define TxBufferSize1   (countof(TxBuffer1) - 1)
#define RxBufferSize1   (countof(TxBuffer1) - 1)

/* Private macro -------------------------------------------------------------*/
#define countof(a)   (sizeof(a) / sizeof(*(a)))

/* Private variables ---------------------------------------------------------*/
USART_InitTypeDef USART_InitStructure;
uint8_t TxBuffer1[] = “SPI AT45DB161D Example: This is SPI DEMO 终端上出现这一行字,说明AT45DDB161的读写正常“;
uint8_t RxBuffer1[RxBufferSize1]rec_f;
__IO uint8_t TxCounter1 = 0x00;
__IO uint8_t RxCounter1 = 0x00; 
uint8_t NbrOfDataToTransfer1 = TxBufferSize1;
uint8_t NbrOfDataToRead1 = RxBufferSize1;
__IO TestStatus TransferStatus1 = FAILED; 

/* Private function prototypes -----------------------------------------------*/
void RCC_Configuration(void);
void GPIO_Configuration(void);
void NVIC_Configuration(void);

void Delay(__IO uint32_t nCount);
void USART_OUT(USART_TypeDef* USARTx uint8_t *Datauint16_t Len);

TestStatus Buffercmp(uint8_t* pBuffer1 uint8_t* pBuffer2 uint16_t BufferLength);

GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef US

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4951  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\misc.h

     文件      19585  2009-08-31 15:06  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_adc.h

     文件       7373  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_bkp.h

     文件      14289  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_can.h

     文件       3213  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_conf.h

     文件       1980  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_crc.h

     文件      10271  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_dac.h

     文件       2980  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_dbgmcu.h

     文件      18790  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_dma.h

     文件       5833  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_exti.h

     文件      14446  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_flash.h

     文件      17276  2009-09-01 10:57  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_fsmc.h

     文件      15221  2009-09-04 15:44  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_gpio.h

     文件      16923  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_i2c.h

     文件       3677  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_iwdg.h

     文件       4201  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_pwr.h

     文件      16258  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_rcc.h

     文件       3659  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_rtc.h

     文件      18598  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_sdio.h

     文件      14896  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_spi.h

     文件      48768  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_tim.h

     文件      14483  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_usart.h

     文件       2785  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\inc\stm32f10x_wwdg.h

     文件       6874  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\SRC\misc.c

     文件      46634  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\SRC\stm32f10x_adc.c

     文件       8248  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\SRC\stm32f10x_bkp.c

     文件      30960  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\SRC\stm32f10x_can.c

     文件       3340  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\SRC\stm32f10x_crc.c

     文件      13723  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\SRC\stm32f10x_dac.c

     文件       4310  2009-04-06 10:30  13 SD卡读写-SDIO接口\FWlib\SRC\stm32f10x_dbgmcu.c

............此处省略107个文件信息

评论

共有 条评论