Dear TI,
we use BQ28550 in a 1-Cell application.
I wrote a Visual Basic program to read out the Golden Flash an write it to an other device.
i use the function from BQ20z95 application notes.
Here is the save function. But this doesn't work. It makes a file, but there is no content (or the wrong content)
What is wrong?
Public Function saveDataFlashImagetoFile(ByVal sFilename As String, _ sChipType As String) As Long 'flash write 'sChipType = "z80" or "z90" Dim iFileNumber As Integer Dim iNumberOfRows As Integer Dim iRow As Integer Dim iIndex As Integer Dim iLen As Integer Dim yRowData(32) As Byte Dim yDataFlashImage(&H700) As Byte Dim buf1$ Dim arg As Long saveDataFlashImagetoFile = 0 'directly from TI '//0x700 is the data flash size for bq8024-based devices (eg:bq20z80). '// 0x700/32 = 56 rows '//0x6C0 is the data flash size for bq8030-based devices (eg:bq20z90). '// 0x6C0/32 = 54 rows Select Case sChipType$ Case "z70" iNumberOfRows% = &H6C0 / 32 Case "z80" iNumberOfRows% = &H700 / 32 Case "z90" iNumberOfRows% = &H6C0 / 32 Case "z95" iNumberOfRows% = &H6C0 / 32 Case "3060" iNumberOfRows% = &H400 / 32 Case "28550" iNumberOfRows% = &H400 / 32 Case Else GoTo saveDataFlashImage_error End Select '//PUT DEVICE INTO ROM MODE If putInRom <> 0 Then GoTo saveDataFlashImage_error DoDelay 0.01 '//READ THE DATA FLASH ROW BY ROW For iRow% = 0 To iNumberOfRows% - 1 '//Set the address for the row. &H9 is the ROM mode command '//0x200 (512) is the row number where data flash starts '//Multiplication by 32 gives us the actual physical address where each row starts arg = (512 + iRow%) * 32 If writeSMBusInteger(&H9, CInt(arg)) <> 0 Then GoTo saveDataFlashImage_error '//Read the row. &HC is the ROM mode command. If ReadSMBusByteArray(&HC, yRowData, iLen) <> 0 Then GoTo saveDataFlashImage_error '//Copy dthis row into its place in a big byte array For iIndex% = 0 To 32 - 1 yDataFlashImage((iRow% * 32) + iIndex%) = yRowData(iIndex%) Next iIndex% Next iRow% '//WRITE THE FLASH IMAGE TO THE FILE iFileNumber% = FreeFile Open sFilename$ For Binary Access Write As #iFileNumber% Put #iFileNumber%, , yDataFlashImage Close #iFileNumber% '//EXECUTE GG PROGRAM If executeGGProgram <> 0 Then GoTo saveDataFlashImage_error Exit Function