Eeprom Download Error

Started by Conrad A***** August 11, 2003
The past day and a half for some reason I cannot reporgram my BX24.
I keep getting this error message.

Writing internal EEPROM
Verifying internal EEPROM
Verify OK
Writing external EEPROM
Verifying external EEPROM
Verify failed, retrying
Verify failed

I have tried on two different computers, just to make sure it wasn't
the BX24 compiler that was causing the problem. So it is definately
something wrong with the BX24.

The code I was using last was the dtalog code provided by BasicX. I
had it datalogging air temperature and battery voltage. So I let it
take samples every 2 minutes and I left it run for aabout 16hours.
I then flipped it to upload mode and it sent out the data to the
computer perfectly fine. I put the graphs in Excel and the results
were quite odd. I don't know if that might be the cause of the
error.

But then when I tried to repogram the BX24 I just kept getting that
message. I also tried the reset on pin 22 and trying every way to
get the BX24 to accept some new code.

So what went wrong?

Conrad



From: Conrad A***** <>

> The past day and a half for some reason I cannot
> reporgram my BX24. I keep getting this error
> message.
>
> Writing internal EEPROM
> Verifying internal EEPROM
> Verify OK
> Writing external EEPROM
> Verifying external EEPROM
> Verify failed, retrying
> Verify failed
> [...]

This tells me the PC is at least able to halt the BX-24 as well as
communicate with it, since the internal EEPROM is downloading OK.
The problem looks like it's related to the external EEPROM.

When you get the EEPROM download error window, there should be a
"Details" button. What gets displayed if you click on that button?

Can you tell if the new program is actually working? It's possible
a program is downloaded correctly, but the PC is not able to
verify the download.

-- Frank Manning
-- NetMedia, Inc.



> When you get the EEPROM download error window, there should be a
> "Details" button. What gets displayed if you click on that button?

Well the Detail section shows this:
Error verifying external EEPROM:
Data error at address 1:
Expected value: 33
Actual value: 231
But when I try a different program I get this error message detail:
Error verifying external EEPROM:
Data error at address 911:
Expected value: 160
Actual value: 240
And another program:
Error verifying external EEPROM:
Data error at address 1:
Expected value: 211
Actual value: 231
And another:
Error verifying external EEPROM:
Data error at address 1:
Expected value: 211
Actual value: 231

The two last programs showed the same error and that was with
running the Hello World code (first one) and then the LEDdemo
provided with the compiler. But they all show different errors so
is that of any use?

> Can you tell if the new program is actually working? It's possible
> a program is downloaded correctly, but the PC is not able to
> verify the download.

No the new program isn't working, I just get that error and it seems
that the BX24 locks up after the error message pops up. I then
disconnect and reconnect the power to the bx24 and it works fine on
its old code.

I appreciate the help and the quick response Frank.

Conrad


> Well the Detail section shows this:
>
> Error verifying external EEPROM:
> Data error at address 1:
> Expected value: 33
> Actual value: 231
>
> But when I try a different program I get this error message
> detail:
>
> Error verifying external EEPROM:
> Data error at address 911:
> Expected value: 160
> Actual value: 240
>
> And another program:
>
> Error verifying external EEPROM:
> Data error at address 1:
> Expected value: 211
> Actual value: 231
>
> And another:
>
> Error verifying external EEPROM:
> Data error at address 1:
> Expected value: 211
> Actual value: 231
>
> The two last programs showed the same error and that was
> with running the Hello World code (first one) and then
> the LEDdemo provided with the compiler. But they all
> show different errors so is that of any use?

Yes -- for one thing, this implies the problem is not due to
serial communication problems with the PC. An input buffer
overflow on the PC side, for example, is probably not happening --
otherwise the error messages would be different. Input buffer
overflows sometimes happened in the past when FIFO settings were
not correct. That's probably not the case here.

What's happening is that the downloader is comparing,
byte-for-byte, the expected vs. actual data being stored in the
SPI EEPROM. In 3 of the 4 cases, a mismatch occurs by address 1,
which is the 2nd byte (address 0 is the 1st byte). In those 3
cases, the BX-24 is reporting the same data (231) at address 1,
which tells me the BX-24 is not just picking up random noise or
something similar.

In the other case, bytes 0 through 900 apparently agree, and it's
only by byte 911 that a mismatch occurs.

>> Can you tell if the new program is actually working? It's
>> possible a program is downloaded correctly, but the PC is
>> not able to verify the download.
>
> No the new program isn't working, I just get that error
> and it seems that the BX24 locks up after the error
> message pops up. I then disconnect and reconnect the
> power to the bx24 and it works fine on its old code.

Do you still have a copy of the program that the BX-24 is running?
I'd be curious as to whether you see an EEPROM verify error if you
try to download that particular program.

I'd guess the SPI EEPROM is not accepting new data, for whatever
reason, but is otherwise functioning, since the BX-24 still
executes a previously-loaded program.

-- Frank Manning
-- NetMedia, Inc.



I wrote:

> [...]
> In the other case, bytes 0 through 900 apparently
> agree, and it's only by byte 911 that a mismatch
> occurs. [...]

Correction -- bytes 0 through 910 apparently agree...

-- Frank Manning
-- NetMedia, Inc.


> Yes -- for one thing, this implies the problem is not due to
> serial communication problems with the PC. An input buffer
> overflow on the PC side, for example, is probably not happening --
> otherwise the error messages would be different. Input buffer
> overflows sometimes happened in the past when FIFO settings were
> not correct. That's probably not the case here.

I agree, that's why I tried it on two different computers just to
make sure it wasn't the computer or the compiler that was causing
the problems.

> What's happening is that the downloader is comparing,
> byte-for-byte, the expected vs. actual data being stored in the
> SPI EEPROM. In 3 of the 4 cases, a mismatch occurs by address 1,
> which is the 2nd byte (address 0 is the 1st byte). In those 3
> cases, the BX-24 is reporting the same data (231) at address 1,
> which tells me the BX-24 is not just picking up random noise or
> something similar.

Ya the BX24 is running on a fairly regulated power supply.

> Do you still have a copy of the program that the BX-24 is running?
> I'd be curious as to whether you see an EEPROM verify error if you
> try to download that particular program.

Yep the code is basically what is given with the compiler, its the
Datalogging code, but I copied it and pasted it for you.

Attribute VB_Name = "DataLogger"
'--------------------------------
-----------

Option Explicit

' Number of bytes required by each data sample.
Private Const ElementSize As Integer = 2

Const UploadSwitchPin As Byte = 10 ' For BX-24
Const SwitchClosed As Byte = 0
Dim LEDBuffer(1 To 20) As Byte

' Define the desired block of EEPROM memory here. Caution -- refer to
' the MPP map file to make sure these addresses do not conflict with
' code storage.
Const StartAddress As Long = 4760
Const EndAddress As Long = 32760
'--------------------------------
-----------

Public Sub Main()

Call Sleep(0.5)

If (FirstTime) Then
CallTask "BlinkLED", LEDBuffer
Call ClearMemoryBlock(StartAddress, EndAddress)
Exit Sub
End If

If (GetPin(UploadSwitchPin) = SwitchClosed) Then
Call UploadData(StartAddress, EndAddress)
Call PutPin(25, 1)
Call PutPin(26, 0)
Else
Call LogData(StartAddress, EndAddress)
Call PutPin(25, 0)
Call PutPin(26, 1)
End If

End Sub
'--------------------------------
-----------
Private Sub LogData( _
ByVal StartAddress As Long, _
ByVal EndAddress As Long)

Const SamplePeriod As Single = 120.0 ' 1 sample every 2 minutes.

Dim CurrentAddress As Long
Dim ADCdata(1 to 8) As Integer
Dim Stopwatch As Single
Dim Channel As Byte

Call PutPin(25, 1)
Call PutPin(26, 0)

' Set the clock to midnight.
Call PutTime(0, 0, 0!)

' Get the EEPROM start address.
CurrentAddress = StartAddress

Do
' Get the seconds past midnight.
StopWatch = Timer

' If stopwatch is greater or equal to "SamplePeriod" read
each ADC
' channel and store the data.
If (StopWatch >= SamplePeriod) Then

' Reset the clock to midnight.
Call PutTime(0, 0, 0!)

' Read the ADC pins.
Call ReadSensors(ADCdata)

' Store each of the 8 integers to the EEPROM.
For Channel = 1 To 8

Call PutEEPROM(CurrentAddress, ADCdata(Channel),
ElementSize)

' Increment CurrentEEPROMaddress to the next new
location.
CurrentAddress = CurrentAddress + CLng(ElementSize)
Next
End If

' Check to see if we are out of storage space.
If (CurrentAddress > EndAddress) Then

' We've run out of EEPROM storage space.
Exit Sub
End If

Loop

End Sub
'--------------------------------
-----------
Private Sub ReadSensors( _
ByRef ADCdata() As Integer)

' Reads ADC channels 1 to 8.

Dim Channel As Byte

Const ADCpin As Byte = 13 ' For BX-24

For Channel = 1 To 8
ADCdata(Channel) = GetADC(ADCpin + Channel - 1)
Next

End Sub
'--------------------------------
-----------
Private Sub UploadData( _
ByVal StartAddress As Long, _
ByVal EndAddress As Long)

' This procedure reads data stored in EEPROM and transmits the data
to
' the serial port.

Dim ADCdata As Integer
Dim Address As Long
Dim Channel As Byte

Channel = 1
Address = StartAddress

Call PutPin(25, 0)
Call PutPin(26, 1)

Do
' Read the data.
Call GetEEPROM(Address, ADCdata, ElementSize)

Debug.Print CStr(ADCdata);

Address = Address + CLng(ElementSize)

Channel = Channel + 1

If (Channel <= 8) Then

' Separate each value with a comma delimiter.
Debug.Print ", ";
Else
' Insert a <CR><LF> at the end of the channel set.
Debug.Print
Channel = 1
End If
Loop Until (Address >= EndAddress)

Debug.Print "EOF"

End Sub
'--------------------------------
-----------
Private Sub ClearMemoryBlock( _
ByVal StartAddress As Long, _
ByVal EndAddress As Long)

' This procedure clears the specified EEPROM memory block.

Dim Address As Long
Dim ElementCount As Long
Dim N As Long
Dim Temp As Integer

Debug.Print "Clearing EEPROM block."
Debug.Print "This may take 3 or 4 minutes."

Temp = 0
ElementCount = ( (EndAddress - StartAddress) \ CLng
(ElementSize) ) + 1

Address = StartAddress
For N = 1 To ElementCount
Call PutEEPROM(Address, Temp, ElementSize)
Address = Address + CLng(ElementSize)
Next

Debug.Print "Done."

End Sub
'--------------------------------
-----------

Private Sub BlinkLED()

Const Red1 As Byte = 25
Const Green1 As Byte = 26
Const Time As Single = 0.05

Do
Call PutPin(Red1, 0)
Call Sleep (Time)
Call PutPin(Red1, 1)
Call Sleep (Time)
Call PutPin(Green1, 0)
Call Sleep (Time)
Call PutPin(Green1, 1)
Call Sleep (Time)
Loop

End Sub
'--------------------------------
----------- > I'd guess the SPI EEPROM is not accepting new data, for whatever
> reason, but is otherwise functioning, since the BX-24 still
> executes a previously-loaded program.

Well I ran the code befor and it worked find and nothing was wrong.
But when I left it for a a day and a ahlf datalogging the power
supply voltage and air temperature. I could upload it perfectly
fine, but then after that I couldn't download any more programs into
the BX24, I think it has something to do with the datalogging of the
pins that has caused problems with the Eeprom or something?

Conrad


From: Conrad A***** <>

> From: Frank Manning
>> [...]
>> Do you still have a copy of the program that the BX-24
>> is running? I'd be curious as to whether you see an
>> EEPROM verify error if you try to download that
>> particular program.
>
> Yep the code is basically what is given with the compiler,
> its the Datalogging code, but I copied it and pasted it
> for you. [...]

OK -- have you tried to download it again? If so, do you get any
error messages?

In other words, what happens if you try to download the same
program currently stored in the BX-24?

-- Frank Manning
-- NetMedia, Inc.



> OK -- have you tried to download it again? If so, do you get any
> error messages?

Yes I have tried dowloading it again many times and I still do come
up with the external EEPROM error.

> In other words, what happens if you try to download the same
> program currently stored in the BX-24?

This is what I get:
Writing internal EEPROM
Verifying internal EEPROM
Verify OK
Writing external EEPROM
Verifying external EEPROM
Verify failed, retrying
Verify failed

Error verifying external EEPROM:
Data error at address 911:
Expected value: 160
Actual value: 240

I tried downloading it a few times and I got the same error every
time.

Conrad


From: "Conrad A*****" <>

> From: Frank Manning
>>
>> OK -- have you tried to download it again? If so, do
>> you get any error messages?
>
> Yes I have tried dowloading it again many times and
> I still do come up with the external EEPROM error.

OK, sorry if I misunderstood. I wasn't sure this was the same
program.

> [...]
> Error verifying external EEPROM:
> Data error at address 911:
> Expected value: 160
> Actual value: 240

My guess is this is a hardware problem related to the SPI EEPROM.
I am but a lowly software weenie, so I've asked our exhalted
hardware guy to contact you about the problem.

-- Frank Manning
-- NetMedia, Inc.



> My guess is this is a hardware problem related to the SPI EEPROM.
> I am but a lowly software weenie, so I've asked our exhalted
> hardware guy to contact you about the problem.

I really appreciate the help Frank, it seems very odd that running
code could damage the hardware. I will await for your hardware tech
to contact me. Thanks!

Conrad