int main(void) { #ifdef DEBUG debug(); #endif for(i=0; i<1024; i++) { if(i<10) Tx_Buffer = 10; else Tx_Buffer = 1; } /* System clocks configuration ---------------------------------------------*/ RCC_Configuration();
/* NVIC configuration ------------------------------------------------------*/ NVIC_Configuration();
/* GPIO configuration ------------------------------------------------------*/ GPIO_Configuration();
/* Initialize the SPI FLASH driver -----------------------------------------*/ MSD_Init();
/* Write Tx_Buffer data to SPI FLASH memory */ FLASH_ID = MSD_WriteBlock(Tx_Buffer, Memory_Offset, 512); if(!FLASH_ID) //是不是写成功 { /* OK: Turn on led connected to PC6 */ GPIO_WriteBit(GPIOC, GPIO_Pin_6, Bit_SET); GPIO_WriteBit(GPIOC, GPIO_Pin_7, Bit_SET); GPIO_WriteBit(GPIOC, GPIO_Pin_8, Bit_SET); };
/* Read data from SPI FLASH memory */ Memory_Offset = 0; //读 FLASH_ID1 = MSD_ReadBlock(Rx_Buffer, Memory_Offset, 512);
/* Check the corectness of written dada */ j = Buffercmp(Tx_Buffer, Rx_Buffer,10);
if(!j==0)//FLASH_ID1 == 0)//TransferStatus1) //读写是不是一样 { /* OK: Turn on led connected to PC6 */ GPIO_WriteBit(GPIOC, GPIO_Pin_6, Bit_RESET); GPIO_WriteBit(GPIOC, GPIO_Pin_7, Bit_SET); GPIO_WriteBit(GPIOC, GPIO_Pin_8, Bit_SET); }; while (1) {} } 为什么读写返回都是正确的,可是读写的内容 为什么不一样 |