Hai,
Iam trying to interface serial EEPROM 25LC1024 with msp430G2553
Firstly I write data in my EEPROM IC with PIC16f877a(this is used because of confirmation)
then write a code for reading the known location but it return wrong data sometimes 0x03 sometimes 0xFF ,FEetc
Here P1.6 is used for CS
Please guide me
below is my code
#include <msp430g2553.h>
unsigned int received_ch;
unsigned int address=0x01;
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1OUT |= BIT6;//cs
P1DIR |= BIT6;
P1REN|=BIT6;
P1SEL = BIT1 | BIT2 | BIT4;
P1SEL2 = BIT1 | BIT2 | BIT4;
UCA0CTL1 = UCSWRST;
UCA0CTL0 |= UCCKPH + UCMSB + UCMST + UCSYNC; // 3-pin, 8-bit SPI master
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 |= 0x02; // /2
UCA0BR1 = 0; //
UCA0MCTL = 0; // No modulation
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
P1OUT|=BIT6;
P1OUT &= (~BIT6); // Select Device
UCA0TXBUF =0x03; //Read enable of EEPROM IC 25LC1024//http://ww1.microchip.com/downloads/en/devicedoc/22064a.pdf
_delay_cycles(10000);
////24 bit address
while (!(IFG2 & UCA0TXIFG)); //24 bit address
UCA0TXBUF =0x00;
while (!(IFG2 & UCA0TXIFG));
UCA0TXBUF =0x00;
while (!(IFG2 & UCA0TXIFG));
UCA0TXBUF =address;
// while (!(IFG2 & UCA0RXIFG)); // USCI_A0 RX Received?
received_ch = UCA0RXBUF; // Store received data
P1OUT |= (BIT6); // Unselect Device
while(1);//debugg
}