| Posted: 11:32am 17 Apr 2026 |
|
|
|
Good point, added a 5mS timeout to the loop and a counter to record the number of times the timeout is reached. Then made it loop continuously to see how often this happens.
Print "Page write speed test for 24C32 EEPROM on I2C2" Dim Wr$, Re$, tmp$, n%, t, LC%, LT, TOut%, I2C.addr = &H57
For n% = 32 To 127 'make 3 pages of data Inc Wr$, Chr$(n%) Next Print "Test Data" Print Wr$ : Print
Do For n% = 0 To 64 Step 32 tmp$ = Mid$(Wr$,n%+1,32) Print tmp$ tmp$ = Chr$(0) + Chr$(n%) + tmp$ I2C2 write I2C.addr, 0, Len(tmp$), tmp$ t=Timer:Do :I2C2 read I2C.addr,0,1,Re$:Loop Until MM.I2C<>1 Or Timer-t>5:t=Timer-t Print "Time to Write a Page = ";t;"mS" If t>5 Then Print "*********** 5mS Timout Exceeded ************" Inc TOut% EndIf Next Print
Re$ = "" Print " Check saved data for errors." I2C2 write I2C.addr, 0, 2, 0, 0 : I2C2 read I2C.addr, 0, 96, Re$ Print Re$ ': Print If Re$ = Wr$ Then Print " Data validated" Else Print " Validation failed!" If t > LT Then LT = t Inc LC% Print "Loop Count =";LC%, "Max. Write Time =";LT, "Number of Timeouts =";TOut% Print "Start again" : Print : Print Loop End
!"#$%&'()*+,-./0123456789:;<=>? Time to Write a Page = 1.767999999mS @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ Time to Write a Page = 1.83mS `abcdefghijklmnopqrstuvwxyz{|}~ Time to Write a Page = 1.825999999mS
Check saved data for errors. !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Data validated Loop count = 7574 Max. Write Time = 1.833000001 Number of Timeouts = 0 Start again
!"#$%&'()*+,-./0123456789:;<=>? Time to Write a Page = 1.824999999mS @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ Time to Write a Page = 1.821mS `abcdefghijklmnopqrstuvwxyz{|}~ Time to Write a Page = 1.823000001mS
Check saved data for errors. !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Data validated Loop count = 7575 Max. Write Time = 1.833000001 Number of Timeouts = 0 Start again
Edit. A longer run. Check saved data for errors. !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Data validated Loop count = 84732 Max. Write Time = 1.833000001 Number of Timeouts = 0 Start again Edited 2026-04-17 22:07 by phil99 |