使用C232HM MPSSE读取M95128 EEPROM返回全0xFF问题求助
问题:C232H MPSSE读取M95128 EEPROM全返回0xFF
我使用搭载C232H MPSSE控制器的C232HM线缆读取M95128-DRMF4TG/K EEPROM,编写了如下C#代码:
private void ReadSPI(byte[] byteArray, int adress) //adress is 0x0100, bytearray has 998 Elements for 998 bytes to read { byte msbAdress = (byte)(adress >> 8); byte lsbAdress = (byte)adress; // First send the adress needed to the EEPROM byte[] eepromSendData = new byte[] //Sending the EEPROM the command, that it shall return the data from the specific adress { 0x10, 0x02, 0x00, 0x03, msbAdress, lsbAdress }; ftStatus = ftdiDevice.Write(eepromSendData, eepromSendData.Length, ref bytesWritten); byte msbLength = ((byte)(byteArray.Length >> 8)); byte lsbLength = (byte)byteArray.Length; byte[] readCommand = new byte[] // readCommand for the C232H controller { 0x20, lsbLength, msbLength }; ftStatus = ftdiDevice.Write(readCommand, readCommand.Length, ref bytesWritten); ftStatus = ftdiDevice.Read(byteArray, (uint)byteArray.Length, ref bytesRead); if (ftStatus != FTDI.FT_STATUS.FT_OK || bytesRead != byteArray.Length) { MessageBox.Show("Error reading SPI"); return; } bytesWritten = 0; bytesRead = 0; }
但EEPROM返回的所有字节均为0xFF。经检测,eepromSendData已正确发送至EEPROM,CS引脚已激活,时钟可测,但SOMI引脚始终处于2.4V(Vcc为3.3V),推测EEPROM未发送数据。仅调用ftdiDevice.Read会导致程序冻结,必须写入readCommand以激活时钟。读取EEPROM不同区域结果一致。
附M95128 EEPROM中文数据手册(原英文手册已翻译)
内容的提问来源于stack exchange,提问作者Heimdall
相关产品推荐
相关产品推荐

