本帖最后由 nine_e 于 2024-4-26 16:41 编辑
nine_e 发表于 2024-4-25 15:11 大佬们,帮帮
大佬们,走过路过看一看,读可以读了,就是写不进去(呜呜呜呜呜)
EepromOperations_t eeprom_WritePage(uint8_t* TxData, uint16_t WriteAddr, uint16_t NumByteToWrite){
/* We gonna send commands in one packet of 3 bytes */
uint8_t header[3];
u8 i;
header[0] = EEPROM_WRITE; // Send "Write to Memory" instruction
header[1] = WriteAddr >> 8; // Send 16-bit address
header[2] = WriteAddr;
GPIO_SetBits(GPIOA , GPIO_Pin_10);
sEE_WriteEnable();
// sEE_WriteStatusRegister(NULL);
// sEE_WriteEnable();
// Select the EEPROM: Chip Select low
EEPROM_CS_LOW();
for(i=0;i<3;i++){
SPI1_ReadWriteByte(header[ i ]);
}
for(i=0;i<NumByteToWrite;i++){
SPI1_ReadWriteByte(*(TxData+i));
}
// Deselect the EEPROM: Chip Select high
M95xx_DelayMs(1);
EEPROM_CS_HIGH();
M95xx_DelayMs(10);
// Wait the end of EEPROM writing
EEPROM_WaitStandbyState();
// Disable the write access to the EEPROM
sEE_WriteDisable();
M95xx_DelayMs(10);
}
这是写入的新函数