Forums

MSP430 to emulate a SPI EEPROM

Started by John Speth December 19, 2006
Hi Group-

I'm hoping to tap into your various experiences regarding a specific
application I am being asked to consider:

We would like to support a legacy device that in the past was simply
an EEPROM (25LC320 SPI compatible 4K bytes). It holds sensor
calibration data. When a sensor is connected to the smart sensor
host, the host reads the EEPROM data. Now we want to make the sensor
a little smarter. We want to be able to select cal data sets
presented by the EEPROM depending on sensor characteristics that
change dynamically. We need to support SPI clock rates up to 1 MHz.

I am looking into whether an MSP430 (or some other micrcontroller)
can emulate the 25LC320 EEPROM SPI interface reliably. Has anyone
ever tried this?

>From my investigation I see one problem that is related to the read
byte cycle - To read a byte, the SPI master sends a READ opcode byte,
followed by 16 bits of address, followed by 8 clocks that will clock
in data to the master on MISO. I can't envision that the MSP430 can
resolve the opcode and address fast enough so that the data is ready
in the MSP430 transmit buffer by the time the first clock of the last
8 clocks for read byte data is received.

A huge constraint on the system is that I can't control the rate of
clocks from the SPI master (but will not exceed 1 MHz). The MSP430
needs to be ready with data on demand. If the MSP430 isn't suitable
for the task, can anyone suggest a mictrocontroller that is?

Thanks for your expert opinions, John.

Beginning Microcontrollers with the MSP430

Hi. I did the same (inteligent sensor) with msp430f2013.
I didnt emulate EEPROM. I've used a propietary protocol so I cant tell you
anything about that.

_____

From: m... [mailto:m...] On Behalf Of
John Speth
Sent: Martes, 19 de Diciembre de 2006 02:48 p.m.
To: m...
Subject: [msp430] MSP430 to emulate a SPI EEPROM

Hi Group-

I'm hoping to tap into your various experiences regarding a specific
application I am being asked to consider:

We would like to support a legacy device that in the past was simply
an EEPROM (25LC320 SPI compatible 4K bytes). It holds sensor
calibration data. When a sensor is connected to the smart sensor
host, the host reads the EEPROM data. Now we want to make the sensor
a little smarter. We want to be able to select cal data sets
presented by the EEPROM depending on sensor characteristics that
change dynamically. We need to support SPI clock rates up to 1 MHz.

I am looking into whether an MSP430 (or some other micrcontroller)
can emulate the 25LC320 EEPROM SPI interface reliably. Has anyone
ever tried this?

>From my investigation I see one problem that is related to the read
byte cycle - To read a byte, the SPI master sends a READ opcode byte,
followed by 16 bits of address, followed by 8 clocks that will clock
in data to the master on MISO. I can't envision that the MSP430 can
resolve the opcode and address fast enough so that the data is ready
in the MSP430 transmit buffer by the time the first clock of the last
8 clocks for read byte data is received.

A huge constraint on the system is that I can't control the rate of
clocks from the SPI master (but will not exceed 1 MHz). The MSP430
needs to be ready with data on demand. If the MSP430 isn't suitable
for the task, can anyone suggest a mictrocontroller that is?

Thanks for your expert opinions, John.

--


--
I do not quite understand your situation. Is this "legacy device" the
same thing as the "smart sensor host"? In what way can MSP430
chip "support"?

Also, how many times do you need to erase/write the calibration
constants in the lifetime of the device? Can you use the internal
Flash of MSP430 instead of an external EEPROM?

--- In m..., "John Speth" wrote:
>
> Hi Group-
>
> I'm hoping to tap into your various experiences regarding a
specific
> application I am being asked to consider:
>
> We would like to support a legacy device that in the past was
simply
> an EEPROM (25LC320 SPI compatible 4K bytes). It holds sensor
> calibration data. When a sensor is connected to the smart sensor
> host, the host reads the EEPROM data. Now we want to make the
sensor
> a little smarter. We want to be able to select cal data sets
> presented by the EEPROM depending on sensor characteristics that
> change dynamically. We need to support SPI clock rates up to 1 MHz.
>
> I am looking into whether an MSP430 (or some other micrcontroller)
> can emulate the 25LC320 EEPROM SPI interface reliably. Has anyone
> ever tried this?
>
> From my investigation I see one problem that is related to the read
> byte cycle - To read a byte, the SPI master sends a READ opcode
byte,
> followed by 16 bits of address, followed by 8 clocks that will
clock
> in data to the master on MISO. I can't envision that the MSP430
can
> resolve the opcode and address fast enough so that the data is
ready
> in the MSP430 transmit buffer by the time the first clock of the
last
> 8 clocks for read byte data is received.
>
> A huge constraint on the system is that I can't control the rate of
> clocks from the SPI master (but will not exceed 1 MHz). The MSP430
> needs to be ready with data on demand. If the MSP430 isn't
suitable
> for the task, can anyone suggest a mictrocontroller that is?
>
> Thanks for your expert opinions, John.
>
On 2006-12-19, FB wrote:

> Hi. I did the same (inteligent sensor) with msp430f2013.
> I didnt emulate EEPROM. I've used a propietary protocol so I cant tell you
> anything about that.

In other words:

No, I don't know anything about what you're asking.

I did to something else, but it's secret, so I won't tell.

Darned useful response, that.

1/2 ;)

--
Grant Edwards grante Yow! Sorry, wrong ZIP
at CODE!!
visi.com
Add all the integers from 1 to 36 (inclusive), and what you get?

--- In m..., Grant Edwards wrote:
>
> On 2006-12-19, FB wrote:
>
> > Hi. I did the same (inteligent sensor) with msp430f2013.
> > I didnt emulate EEPROM. I've used a propietary protocol so I cant
tell you
> > anything about that.
>
> In other words:
>
> No, I don't know anything about what you're asking.
>
> I did to something else, but it's secret, so I won't tell.
>
> Darned useful response, that.
>
> 1/2 ;)
>
> --
> Grant Edwards grante Yow! Sorry,
wrong ZIP
> at CODE!!
> visi.com
>
> I do not quite understand your situation. Is this "legacy device"
the
> same thing as the "smart sensor host"? In what way can MSP430
> chip "support"?

The legacy device is a family of products (I'll call them hosts) that
our sensors connect to. The host reads the sensor EEPROM using SPI.
We're upgrading the sensor products and we can't upgrade the host
firmware.

My goal is to replace the sensor's 25LC320 SPI EEPROM with an MSP430
or other micro. It must perform the same SPI interface functions the
EEPROM performs up to the SPI clock rate of 1 MHz.

> Also, how many times do you need to erase/write the calibration
> constants in the lifetime of the device? Can you use the internal
> Flash of MSP430 instead of an external EEPROM?

It's write once, read many. The MSP430 has plenty of flash space to
store my data (I can use unsed code flash for that). I'm looking for
a one-chip solution.

JJS

> --- In m..., "John Speth" wrote:
> >
> > Hi Group-
> >
> > I'm hoping to tap into your various experiences regarding a
> specific
> > application I am being asked to consider:
> >
> > We would like to support a legacy device that in the past was
> simply
> > an EEPROM (25LC320 SPI compatible 4K bytes). It holds sensor
> > calibration data. When a sensor is connected to the smart sensor
> > host, the host reads the EEPROM data. Now we want to make the
> sensor
> > a little smarter. We want to be able to select cal data sets
> > presented by the EEPROM depending on sensor characteristics that
> > change dynamically. We need to support SPI clock rates up to 1
MHz.
> >
> > I am looking into whether an MSP430 (or some other
micrcontroller)
> > can emulate the 25LC320 EEPROM SPI interface reliably. Has
anyone
> > ever tried this?
> >
> > From my investigation I see one problem that is related to the
read
> > byte cycle - To read a byte, the SPI master sends a READ opcode
> byte,
> > followed by 16 bits of address, followed by 8 clocks that will
> clock
> > in data to the master on MISO. I can't envision that the MSP430
> can
> > resolve the opcode and address fast enough so that the data is
> ready
> > in the MSP430 transmit buffer by the time the first clock of the
> last
> > 8 clocks for read byte data is received.
> >
> > A huge constraint on the system is that I can't control the rate
of
> > clocks from the SPI master (but will not exceed 1 MHz). The
MSP430
> > needs to be ready with data on demand. If the MSP430 isn't
> suitable
> > for the task, can anyone suggest a mictrocontroller that is?
> >
> > Thanks for your expert opinions, John.
>
The problem I see is the turn around time. You get a 16 bit address and
have to immediately have the data in the next clock (<1 microsecond). It
is too fast a turn around for an interrupt driven system.

There is a chance you could do it running at 16 MHz, polling on the
receive, as soon as the data arrives pull it from memory and stick it in
the SPI output register. You have to be really careful on the
instructions you use and you can only use a couple of assembler
instructions to do it.

You may be better off having multiple 25LC320 and selecting the one you
want externally.

The chip is cheap. $0.53.
http://ww1.microchip.com/downloads/en/DeviceDoc/21227E.pdf

Kip

On Tue, 2006-12-19 at 20:06 +0000, John Speth wrote:
> > I do not quite understand your situation. Is this "legacy device"
> the
> > same thing as the "smart sensor host"? In what way can MSP430
> > chip "support"?
>
> The legacy device is a family of products (I'll call them hosts) that
> our sensors connect to. The host reads the sensor EEPROM using SPI.
> We're upgrading the sensor products and we can't upgrade the host
> firmware.
>
> My goal is to replace the sensor's 25LC320 SPI EEPROM with an MSP430
> or other micro. It must perform the same SPI interface functions the
> EEPROM performs up to the SPI clock rate of 1 MHz.
>
> > Also, how many times do you need to erase/write the calibration
> > constants in the lifetime of the device? Can you use the internal
> > Flash of MSP430 instead of an external EEPROM?
>
> It's write once, read many. The MSP430 has plenty of flash space to
> store my data (I can use unsed code flash for that). I'm looking for
> a one-chip solution.
>
> JJS
>
> > --- In m..., "John Speth" wrote:
> > >
> > > Hi Group-
> > >
> > > I'm hoping to tap into your various experiences regarding a
> > specific
> > > application I am being asked to consider:
> > >
> > > We would like to support a legacy device that in the past was
> > simply
> > > an EEPROM (25LC320 SPI compatible 4K bytes). It holds sensor
> > > calibration data. When a sensor is connected to the smart sensor
> > > host, the host reads the EEPROM data. Now we want to make the
> > sensor
> > > a little smarter. We want to be able to select cal data sets
> > > presented by the EEPROM depending on sensor characteristics that
> > > change dynamically. We need to support SPI clock rates up to 1
> MHz.
> > >
> > > I am looking into whether an MSP430 (or some other
> micrcontroller)
> > > can emulate the 25LC320 EEPROM SPI interface reliably. Has
> anyone
> > > ever tried this?
> > >
> > > From my investigation I see one problem that is related to the
> read
> > > byte cycle - To read a byte, the SPI master sends a READ opcode
> > byte,
> > > followed by 16 bits of address, followed by 8 clocks that will
> > clock
> > > in data to the master on MISO. I can't envision that the MSP430
> > can
> > > resolve the opcode and address fast enough so that the data is
> > ready
> > > in the MSP430 transmit buffer by the time the first clock of the
> > last
> > > 8 clocks for read byte data is received.
> > >
> > > A huge constraint on the system is that I can't control the rate
> of
> > > clocks from the SPI master (but will not exceed 1 MHz). The
> MSP430
> > > needs to be ready with data on demand. If the MSP430 isn't
> > suitable
> > > for the task, can anyone suggest a mictrocontroller that is?
> > >
> > > Thanks for your expert opinions, John.
> > >
> >

--
Kipton Moravec
On 2006-12-19, old_cow_yellow wrote:

>> We would like to support a legacy device that in the past was
>> simply an EEPROM (25LC320 SPI compatible 4K bytes). It holds
>> sensor calibration data. When a sensor is connected to the
>> smart sensor host, the host reads the EEPROM data. Now we
>> want to make the sensor a little smarter. We want to be able
>> to select cal data sets presented by the EEPROM depending on
>> sensor characteristics that change dynamically. We need to
>> support SPI clock rates up to 1 MHz.
>>
>> I am looking into whether an MSP430 (or some other micrcontroller)
>> can emulate the 25LC320 EEPROM SPI interface reliably. Has anyone
>> ever tried this?

> I do not quite understand your situation. Is this "legacy
> device" the same thing as the "smart sensor host"? In what way
> can MSP430 chip "support"?

He wants to replace a serial EEPROM with an MSP430. Instead of
a fixed table of data in an EEPROM that's read via SPI, he'll
have an MSP430 that calculates the data and provides it via an
SPI interface that's the same as the old serial EEPROM.

> Also, how many times do you need to erase/write the calibration
> constants in the lifetime of the device? Can you use the internal
> Flash of MSP430 instead of an external EEPROM?

The MSP430 is the external EEPROM.

--
Grant Edwards grante Yow! I'm having BEAUTIFUL
at THOUGHTS about the INSIPID
visi.com WIVES of smug and wealthy
CORPORATE LAWYERS...
I agree. To respond to READ, you only have one half of a SCK to do
it. If SCK = 1 MHz and your CPU's MCLK is only 16 MHz that is very
tight. MSP430 CPU takes more than 4 MCLKs to read/write memory or I/O
registers (and only 1 MCLK to operating on CPU registers).

Freescale S08 and S12 chips are faster. I think the CPU clock can be
as high as 40 MHz. Timing for READ could still be tight.

--- In m..., Kipton Moravec wrote:
>
> The problem I see is the turn around time. You get a 16 bit address
and
> have to immediately have the data in the next clock (<1
microsecond). It
> is too fast a turn around for an interrupt driven system.
>
> There is a chance you could do it running at 16 MHz, polling on the
> receive, as soon as the data arrives pull it from memory and stick
it in
> the SPI output register. You have to be really careful on the
> instructions you use and you can only use a couple of assembler
> instructions to do it.
>
> You may be better off having multiple 25LC320 and selecting the one
you
> want externally.
>
> The chip is cheap. $0.53.
> http://ww1.microchip.com/downloads/en/DeviceDoc/21227E.pdf
>
> Kip
>
> On Tue, 2006-12-19 at 20:06 +0000, John Speth wrote:
> > > I do not quite understand your situation. Is this "legacy
device"
> > the
> > > same thing as the "smart sensor host"? In what way can MSP430
> > > chip "support"?
> >
> > The legacy device is a family of products (I'll call them hosts)
that
> > our sensors connect to. The host reads the sensor EEPROM using
SPI.
> > We're upgrading the sensor products and we can't upgrade the host
> > firmware.
> >
> > My goal is to replace the sensor's 25LC320 SPI EEPROM with an
MSP430
> > or other micro. It must perform the same SPI interface functions
the
> > EEPROM performs up to the SPI clock rate of 1 MHz.
> >
> > > Also, how many times do you need to erase/write the calibration
> > > constants in the lifetime of the device? Can you use the
internal
> > > Flash of MSP430 instead of an external EEPROM?
> >
> > It's write once, read many. The MSP430 has plenty of flash space
to
> > store my data (I can use unsed code flash for that). I'm looking
for
> > a one-chip solution.
> >
> > JJS
> >
> > > --- In m..., "John Speth" wrote:
> > > >
> > > > Hi Group-
> > > >
> > > > I'm hoping to tap into your various experiences regarding a
> > > specific
> > > > application I am being asked to consider:
> > > >
> > > > We would like to support a legacy device that in the past was
> > > simply
> > > > an EEPROM (25LC320 SPI compatible 4K bytes). It holds sensor
> > > > calibration data. When a sensor is connected to the smart
sensor
> > > > host, the host reads the EEPROM data. Now we want to make the
> > > sensor
> > > > a little smarter. We want to be able to select cal data sets
> > > > presented by the EEPROM depending on sensor characteristics
that
> > > > change dynamically. We need to support SPI clock rates up to
1
> > MHz.
> > > >
> > > > I am looking into whether an MSP430 (or some other
> > micrcontroller)
> > > > can emulate the 25LC320 EEPROM SPI interface reliably. Has
> > anyone
> > > > ever tried this?
> > > >
> > > > From my investigation I see one problem that is related to
the
> > read
> > > > byte cycle - To read a byte, the SPI master sends a READ
opcode
> > > byte,
> > > > followed by 16 bits of address, followed by 8 clocks that
will
> > > clock
> > > > in data to the master on MISO. I can't envision that the
MSP430
> > > can
> > > > resolve the opcode and address fast enough so that the data
is
> > > ready
> > > > in the MSP430 transmit buffer by the time the first clock of
the
> > > last
> > > > 8 clocks for read byte data is received.
> > > >
> > > > A huge constraint on the system is that I can't control the
rate
> > of
> > > > clocks from the SPI master (but will not exceed 1 MHz). The
> > MSP430
> > > > needs to be ready with data on demand. If the MSP430 isn't
> > > suitable
> > > > for the task, can anyone suggest a mictrocontroller that is?
> > > >
> > > > Thanks for your expert opinions, John.
> > > >
> > > --
> Kipton Moravec
>> I've used a propietary protocol so I cant tell you anything about that.

The Intellectual Property value of most proprietary protocols is close to zero.

Now if you had written a STANDARD protocol handler in 12.7 bytes of code THEN we might be interested!