Reply by saravana_friend81●February 23, 20052005-02-23
hi jan
already i do that in correct way.first i enabled chip enable and
then i write a program to read electronics signature of flash.Then i
have some problem in my code.can any body help me.
thanks®ards
saravana
--- In msp430@msp4..., "Jan Szymanski" <janek@b...> wrote:
>
> Check the specification from ST website.
> For any operation you have to enable CS line (low) and then
disable it
> for example if your CS line is connected to P30:
> #define SFCS_LOW P3OUT &= 0xfe // CS is P30
> #define SFCS_HIGH P3OUT |= 0x01
>
> SFCS_LOW // CS active
> // you code here
> SFCS_HIGH // CS inactive
> Hope this will help
> Jan
>
>
> --- In msp430@msp4..., "saravana_friend81"
> <saravana_friend81@y...> wrote:
> >
> > hi all,
> > I am a learner in MSP 430. I am working in GPS application
project.I
> > want to write some data in External serial
flash memory through
> > MSp430F149.I am using serial flash memory for data logging
purpose
> > from ST microelectronics part no M25P20.That
serial flash
connected
> > in SPI mode control protocol thru
MSP430F149.The serial flash
data
> > input line is connected to SIMO pin of
MSP.The serial flash data
out
> > pin is connected to SOMI pin.How to write a
data in to that
serial
> > flash in a particular location of serial
flash.
> >
> >
> > This is the hardware connection for the above appln.
> >
> >
> > MSP430F149
> > -----------------
> > /|\| xt2in|-
> > | | | 8MHz SERIAL FLASH M25P20
> > --|RST xt2OUT| - -------------
> > | |
> > | P3.1|------>|CS |
> > |SIMO0/P3.1|------>|DATAIN |
> > |UCLK0/P3.3|------>|SCLK |
> > |SOMI /P3.2|<------|DATAOUT |
> > I have written the code as follows
> >
> >
> > #include "msp430x14x.h"
> > int SIGN,COUNT;
> >
> >
> >
> > void main(void)
> > {
> > unsigned I;
> > int STATUS,BUFFER[300]; //buffer for storage
> > int A=0;
> > WDTCTL = WDTPW + WDTHOLD; // Stop WDT
> > BCSCTL1 &= ~XT2OFF; // XT2on
> >
> > do
> > {
> > IFG1 &= ~OFIFG; // Clear OSCFault flag
> > for (I = 0xFF; I > 0; I--); // Time for flag to set
> > }
> > while ((IFG1 & OFIFG)); // OSCFault flag still
> > set?
> >
> > BCSCTL2 |= SELM_2 + SELS; // MCLK = SMCLK = XT2 (safe)
> >
> >
> > for (I = 0xFFFF; I > 0; I--); // Delay
> >
> >
> > //INITIALIZATION
> >
> > ME1 |= USPIE0;//module enable
> > UCTL0 |= CHAR + SYNC + MM+ SWRST;// P3.1,2,3 SPI option select
> >
> > UTCTL0 |= CKPL+SSEL1+STC;// // Polarity, 3-wire
> > UBR00 = 0x41;//8MHz clock rate with 9600 baud rate
> > UBR10 = 0x03;
> > UMCTL0 = 0x00;
> > ME1 |= UTXE0 + URXE0;//tx&Rx interrupt enable
> > UCTL0 &= ~SWRST;
> >
> > IE1 |= URXIE0;
> > P6SEL |= 0x38;
> > P6DIR |= 0x38;
> > P6OUT = 0x30;
> > //*********READ ELECTRONIC SIGNATUREcommand sequece is 1.send
> > command 0xAB and three cummy byte *****************/
> > P3SEL = 0x0F;
> > P3DIR = 0x0A;
> > for(I=0xFFFF;I>0x0;I--);
> >
> > while(!(IFG1 & UTXIFG0));
> > TXBUF0 = 0xAB;
> > //DUMMY BYTES
> > while(!(IFG1 & UTXIFG0));
> >
> > TXBUF0 = 0x00;
> > while(!(IFG1 & UTXIFG0));
> > TXBUF0 = 0x10;
> > while(!(IFG1 & UTXIFG0));
> > TXBUF0 = 0x10;
> >
> > _BIS_SR(GIE);
> > for(;;)
> > {
> > if(COUNT==1)
> > break;
> >
> > }
> > P6OUT = 0x30
> > asm("nop;");
> > }
> >
> > #pragma vector=UART0RX_VECTOR
> > __interrupt void usart0_rx (void)
> > {
> > SIGN = RXBUF0;
> > if(SIGN==0x11||SIGN==0xB)//check for electronic signature 0X11
> > COUNT=1;
> > }
> >
> > In the above program i made a mistake but i dont know what is the
> > mistake.I got a result as 0x00 or 0xffh.any body can help me how
to
> > write a code to read electronic signature
thru MSP430f149 . I am
> > waiting for ur valuable guidance.
> > Thanks &Regards
> > Saravana
Reply by Jan Szymanski●February 22, 20052005-02-22
Check the specification from ST website.
For any operation you have to enable CS line (low) and then disable it
for example if your CS line is connected to P30:
#define SFCS_LOW P3OUT &= 0xfe // CS is P30
#define SFCS_HIGH P3OUT |= 0x01
SFCS_LOW // CS active
// you code here
SFCS_HIGH // CS inactive
Hope this will help
Jan
--- In msp430@msp4..., "saravana_friend81"
<saravana_friend81@y...> wrote:
>
> hi all,
> I am a learner in MSP 430. I am working in GPS application project.I
> want to write some data in External serial flash memory through
> MSp430F149.I am using serial flash memory for data logging purpose
> from ST microelectronics part no M25P20.That serial flash connected
> in SPI mode control protocol thru MSP430F149.The serial flash data
> input line is connected to SIMO pin of MSP.The serial flash data out
> pin is connected to SOMI pin.How to write a data in to that serial
> flash in a particular location of serial flash.
>
>
> This is the hardware connection for the above appln.
>
>
> MSP430F149
> -----------------
> /|\| xt2in|-
> | | | 8MHz SERIAL FLASH M25P20
> --|RST xt2OUT| - -------------
> | |
> | P3.1|------>|CS |
> |SIMO0/P3.1|------>|DATAIN |
> |UCLK0/P3.3|------>|SCLK |
> |SOMI /P3.2|<------|DATAOUT |
> I have written the code as follows
>
>
> #include "msp430x14x.h"
> int SIGN,COUNT;
>
>
>
> void main(void)
> {
> unsigned I;
> int STATUS,BUFFER[300]; //buffer for storage
> int A=0;
> WDTCTL = WDTPW + WDTHOLD; // Stop WDT
> BCSCTL1 &= ~XT2OFF; // XT2on
>
> do
> {
> IFG1 &= ~OFIFG; // Clear OSCFault flag
> for (I = 0xFF; I > 0; I--); // Time for flag to set
> }
> while ((IFG1 & OFIFG)); // OSCFault flag still
> set?
>
> BCSCTL2 |= SELM_2 + SELS; // MCLK = SMCLK = XT2 (safe)
>
>
> for (I = 0xFFFF; I > 0; I--); // Delay
>
>
> //INITIALIZATION
>
> ME1 |= USPIE0;//module enable
> UCTL0 |= CHAR + SYNC + MM+ SWRST;// P3.1,2,3 SPI option select
>
> UTCTL0 |= CKPL+SSEL1+STC;// // Polarity, 3-wire
> UBR00 = 0x41;//8MHz clock rate with 9600 baud rate
> UBR10 = 0x03;
> UMCTL0 = 0x00;
> ME1 |= UTXE0 + URXE0;//tx&Rx interrupt enable
> UCTL0 &= ~SWRST;
>
> IE1 |= URXIE0;
> P6SEL |= 0x38;
> P6DIR |= 0x38;
> P6OUT = 0x30;
> //*********READ ELECTRONIC SIGNATUREcommand sequece is 1.send
> command 0xAB and three cummy byte *****************/
> P3SEL = 0x0F;
> P3DIR = 0x0A;
> for(I=0xFFFF;I>0x0;I--);
>
> while(!(IFG1 & UTXIFG0));
> TXBUF0 = 0xAB;
> //DUMMY BYTES
> while(!(IFG1 & UTXIFG0));
>
> TXBUF0 = 0x00;
> while(!(IFG1 & UTXIFG0));
> TXBUF0 = 0x10;
> while(!(IFG1 & UTXIFG0));
> TXBUF0 = 0x10;
>
> _BIS_SR(GIE);
> for(;;)
> {
> if(COUNT==1)
> break;
>
> }
> P6OUT = 0x30
> asm("nop;");
> }
>
> #pragma vector=UART0RX_VECTOR
> __interrupt void usart0_rx (void)
> {
> SIGN = RXBUF0;
> if(SIGN==0x11||SIGN==0xB)//check for electronic signature 0X11
> COUNT=1;
> }
>
> In the above program i made a mistake but i dont know what is the
> mistake.I got a result as 0x00 or 0xffh.any body can help me how to
> write a code to read electronic signature thru MSP430f149 . I am
> waiting for ur valuable guidance.
> Thanks &Regards
> Saravana
Reply by saravana_friend81●February 22, 20052005-02-22
hi all,
I am a learner in MSP 430. I am working in GPS application project.I
want to write some data in External serial flash memory through
MSp430F149.I am using serial flash memory for data logging purpose
from ST microelectronics part no M25P20.That serial flash connected
in SPI mode control protocol thru MSP430F149.The serial flash data
input line is connected to SIMO pin of MSP.The serial flash data out
pin is connected to SOMI pin.How to write a data in to that serial
flash in a particular location of serial flash.
This is the hardware connection for the above appln.
MSP430F149
-----------------
/|\| xt2in|-
| | | 8MHz SERIAL FLASH M25P20
--|RST xt2OUT| - -------------
| |
| P3.1|------>|CS |
|SIMO0/P3.1|------>|DATAIN |
|UCLK0/P3.3|------>|SCLK |
|SOMI /P3.2|<------|DATAOUT |
I have written the code as follows
#include "msp430x14x.h"
int SIGN,COUNT;
void main(void)
{
unsigned I;
int STATUS,BUFFER[300]; //buffer for storage
int A=0;
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
BCSCTL1 &= ~XT2OFF; // XT2on
do
{
IFG1 &= ~OFIFG; // Clear OSCFault flag
for (I = 0xFF; I > 0; I--); // Time for flag to set
}
while ((IFG1 & OFIFG)); // OSCFault flag still
set?
BCSCTL2 |= SELM_2 + SELS; // MCLK = SMCLK = XT2 (safe)
for (I = 0xFFFF; I > 0; I--); // Delay
//INITIALIZATION
ME1 |= USPIE0;//module enable
UCTL0 |= CHAR + SYNC + MM+ SWRST;// P3.1,2,3 SPI option select
UTCTL0 |= CKPL+SSEL1+STC;// // Polarity, 3-wire
UBR00 = 0x41;//8MHz clock rate with 9600 baud rate
UBR10 = 0x03;
UMCTL0 = 0x00;
ME1 |= UTXE0 + URXE0;//tx&Rx interrupt enable
UCTL0 &= ~SWRST;
IE1 |= URXIE0;
P6SEL |= 0x38;
P6DIR |= 0x38;
P6OUT = 0x30;
//*********READ ELECTRONIC SIGNATUREcommand sequece is 1.send
command 0xAB and three cummy byte *****************/
P3SEL = 0x0F;
P3DIR = 0x0A;
for(I=0xFFFF;I>0x0;I--);
while(!(IFG1 & UTXIFG0));
TXBUF0 = 0xAB;
//DUMMY BYTES
while(!(IFG1 & UTXIFG0));
TXBUF0 = 0x00;
while(!(IFG1 & UTXIFG0));
TXBUF0 = 0x10;
while(!(IFG1 & UTXIFG0));
TXBUF0 = 0x10;
_BIS_SR(GIE);
for(;;)
{
if(COUNT==1)
break;
}
P6OUT = 0x30
asm("nop;");
}
#pragma vector=UART0RX_VECTOR
__interrupt void usart0_rx (void)
{
SIGN = RXBUF0;
if(SIGN==0x11||SIGN==0xB)//check for electronic signature 0X11
COUNT=1;
}
In the above program i made a mistake but i dont know what is the
mistake.I got a result as 0x00 or 0xffh.any body can help me how to
write a code to read electronic signature thru MSP430f149 . I am
waiting for ur valuable guidance.
Thanks &Regards
Saravana