TXBUF0 = 0; ///start spi clock
do
{
IFG1 &=~ URXIFG0;
}while (URXIFG0 & IFG1); //wait for RX buffer to write
Dummy[2] = RXBUF0; //transfer the RX buffer data to a variable
stefandk63 wrote: Hi,maybe i'm wrong,but
What exactly does this code?
----- Original Message ----
From: stefandk63
To: m...
Sent: Monday, October 15, 2007 4:43:47 PM
Subject: [msp430] Re: MSP430F449 SPI
Hi,maybe i'm wrong,but
What exactly does this code?
TXBUF0 = 0;
do
{
IFG1 &=~ URXIFG0;
}while (URXIFG0 & IFG1);
Dummy[2] = RXBUF0;
____________________________________________________________________________________
Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get
listings, and more! http://tv.yahoo.com/collections/3658
Reply by Pisit Sawangvonganan●October 15, 20072007-10-15
Hi, Jeyakumar
After I take a look in your source code here are the list that may be the
source of problem
1) I think you should set MOSI pin for P3.1 too.
2) What's you MCLK speed 8 MHz? If yes, please lower your speed and after
correct the problem then
go back to your desired MCLK speed.
3) You need to make a wait for ADC conversiton time after the falling edg of
CS
It's take the time around 72.73 ms +- 1% Wait more than 100 ms to make
sure for this point
4) CS state should be high in the idle state
5) Let's try the code that I modifie from your original code.
// Initialize Section
P3SEL = 0x00;
P3SEL |= 0x0E; // P3.1-3 SPI Option select
P3DIR |= 0x1A; // P3.1,3.3 Output direction, P3.4 use as CS
P3DIR &= ~0x04; // P3.2 Input direction
P3OUT |= 0x10; // Set CS to High First
// Add your delay here to make sure for more than 100 ms
// After the ADC conversion complete then you can read them
for(int j=0xFFFF;j>0; j--);
for(int j=0xFFFF;j>0; j--);
P3OUT |= 0x10; //CS high
Jeyakumar wrote:
Hi,
The clock should be starting from high to low ( from MCP3551 data sheet) . If
I set CKPL and CKPH to 0, then the clock is come to low to high. I facing same
problem again. I always getting 0xFF from the RXBUF0. Pls correct me..
bye
Pisit Sawangvonganan wrote:
Hi, After I check from the MCP3551 ADC data sheet it support for only
SPI MODE 0 or 3. But for this line in your code, if I'm correct it's
setting for MODE2.
UTCTL0 |= CKPL + SSEL1 + SSEL0 + STC; // SMCLK, 3-pin mode
The line you comment out is the setting for MODE3
Please try in MODE0 by set CKPL and CKPH to 0.
Another recommend please clear the register before use self OR instruction.
Think will help you.
Jeyakumar wrote: Hi,
I wrote the code for SPI communication for MCP3551 ADC bellow. but it is not
working. I always receive 0xFF in all arrays. Pls if any one correct me..
---------------------------------
Need a vacation? Get great deals to amazing places on Yahoo! Travel.
---------------------------------
Shape Yahoo! in your own image. Join our Network Research Panel today!
---------------------------------
Be a better Globetrotter. Get better travel answers from someone who knows.
Yahoo! Answers - Check it out.
---------------------------------
Be a better Heartthrob. Get better relationship answers from someone who
knows.
Yahoo! Answers - Check it out.
Reply by Jeyakumar●October 14, 20072007-10-14
Hi,
The clock should be starting from high to low ( from MCP3551 data sheet) . If
I set CKPL and CKPH to 0, then the clock is come to low to high. I facing same
problem again. I always getting 0xFF from the RXBUF0. Pls correct me..
bye
Pisit Sawangvonganan wrote:
Hi, After I check from the MCP3551 ADC data sheet it support for only
SPI MODE 0 or 3. But for this line in your code, if I'm correct it's
setting for MODE2.
UTCTL0 |= CKPL + SSEL1 + SSEL0 + STC; // SMCLK, 3-pin mode
The line you comment out is the setting for MODE3
Please try in MODE0 by set CKPL and CKPH to 0.
Another recommend please clear the register before use self OR instruction.
Think will help you.
Jeyakumar wrote: Hi,
I wrote the code for SPI communication for MCP3551 ADC bellow. but it is not
working. I always receive 0xFF in all arrays. Pls if any one correct me..
---------------------------------
Need a vacation? Get great deals to amazing places on Yahoo! Travel.
---------------------------------
Shape Yahoo! in your own image. Join our Network Research Panel today!
---------------------------------
Be a better Globetrotter. Get better travel answers from someone who knows.
Yahoo! Answers - Check it out.
Reply by Pisit Sawangvonganan●October 13, 20072007-10-13
Hi, After I check from the MCP3551 ADC data sheet it support for only SPI MODE 0
or 3. But for this line in your code, if I'm correct it's setting for
MODE2.
UTCTL0 |= CKPL + SSEL1 + SSEL0 + STC; // SMCLK, 3-pin mode
The line you comment out is the setting for MODE3
Please try in MODE0 by set CKPL and CKPH to 0.
Another recommend please clear the register before use self OR instruction.
Think will help you.
Jeyakumar wrote: Hi,
I wrote the code for SPI communication for MCP3551 ADC bellow. but it is not
working. I always receive 0xFF in all arrays. Pls if any one correct me..