Part Number: MSP430F67791
Hi,
How to interface external win bond flash in MSP430F67791.
How to access (read/write) external SPI Flash in MSP430F67791 any API provided ? any sample application I can refer to ?
Thank you.
Ashokkumar
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: MSP430F67791
Hi,
How to interface external win bond flash in MSP430F67791.
How to access (read/write) external SPI Flash in MSP430F67791 any API provided ? any sample application I can refer to ?
Thank you.
Ashokkumar
Hi Sir,
Now i have MSP430F67791 interface the W25q64 winbond chip.But communication is not working.what happened?
This is my following code details,
interface pin details for your reference,
SCLK P3.3 SCK
SOMI P3.4 DO
SIMO P3.5 DI
CS P3.6 CS
void spi_init(void)
{
UCA1CTL1 = UCSWRST;
P3OUT &= ~BIT6; // Clear P1.0
P3DIR |= BIT6; // Set P1.0 to output direction
P3SEL0 = BIT3| BIT4 | BIT5 ; // Set P3.0,P3.1,P3.2 to non-IO
UCA1CTL0 |= UCCKPH + UCMSB + UCMST + UCSYNC;
UCA1CTL1 |= UCSSEL_2; // SMCLK
UCA1BR0 |= 0x02;
UCA1BR1 = 0x00;
UCA1MCTLW = 0;
UCA1CTL1 &= ~UCSWRST;
}
void spi_chipHigh(void)
{
P3OUT |= CS;
}
void spi_chipLow(void)
{
P3OUT &= ~CS;
}
int datacount=0;
unsigned char data=0;
unsigned char GCu_Tx_Data[10];
unsigned char GCu_Recieved_Data[10];
uint8_t sFLASH_SendByte(unsigned char *uData,unsigned char count)
{
while(!(UCA1IFG &= UCTXIFG));
for(datacount=0;datacount<count;datacount++)
UCA1TXBUF = uData[datacount];
while (!(UCA1IFG & UCRXIFG));
uData[0] = UCA1RXBUF;
return *uData;
}
unsigned char Read_SingleBytes(unsigned int LIu_Flash_Add){
unsigned char LCu_Read_Data=0;
spi_chipLow();
GCu_Tx_Data[0] = 0x03; //read
GCu_Tx_Data[1] = (LIu_Flash_Add >> 16) & 0xFF;
GCu_Tx_Data[2] = (LIu_Flash_Add >> 8) & 0xFF;
GCu_Tx_Data[3] = (LIu_Flash_Add >> 0) & 0xFF;
LCu_Read_Data=sFLASH_SendByte(&GCu_Tx_Data[0],4);
spi_chipHigh();
return(LCu_Read_Data);
}
while(1)
{
Read_SingleBytes(0x000000);
}
If any coding problem pls tell me the exact reason and how to work properly guide me as soon as possible.
Hello,
Please read through our Solutions to Common eUSCI and USCI Serial Communication Issues on MSP430™ MCUs application report, specifically Chapter 4 Common SPI Communication Issues. This should help get you started.
Regards,
James
MSP Customer Applications
**Attention** This is a public forum