Other Parts Discussed in Thread: MSP430F1611
NOTE: I posted this in the wrong forum, this is a repost of the same question. I have been trying to get the code below to work for over a week now with no success. I am building a datalogger with a MSP430F1611 and I am using a MSP-FET430UIF to interface with the controller. I am new to embedded programming and taking an incremental approach to the coding. I first made an LED blink based off of the Timer A interrupt and now I am trying to get the SPI to talk to a 1GB SD card. I have read through the data sheets and online forums and I am still stuck. I run my code and use an oscilloscope to monitor the UCLK pin and see it rise to a steady 3.3V. I know I am new at this but I thought that there is supposed to be a steady pulse emanating from that pin! I wanted to see if it was transmitting and I wasn't using the oscilloscope correctly so I set the LISTEN bit and ran the program. I checked the receive register and there was nothing there. I just want this darn thing to send out a steady clock signal and some kind of data stream, I appreciate any help I can get. #include <msp430f1611.h> #include <mmc.h> #include <stdio.h> #include "fatlib.h" #include "HALayer.h" // Global Variables int Working = 0; unsigned int buffer[512]; //Function declarations void cpu_init(void); void spi_init(void); void main(void) { cpu_init(); spi_init(); while(1) { U1TXBUF = 0xaa; //Dummy value // for(int i=0;i<0xFF;i++); //Delay for Tx } } void cpu_init(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P5SEL |= BIT1+BIT2+BIT3; // Set pins P5.1-3 to peripheral P5DIR |= BIT0; //P5.0 output P5OUT &= ~BIT0; //P5.0 Low } void spi_init(void) { U1CTL |= SWRST; //disable state machine U1CTL |= CHAR+SYNC+MM+LISTEN; //8bit char, SPI,USART is master,Tx to Rx U1TCTL |= SSEL0+STC; //UCLK=ACLK U1MCTL = 0x00; //No Modulation U1BR0 = 0x02; //Divide ACLK by 2 U1BR1 = 0x00; ME2 |= USPIE1; //Enable SPI module U1CTL &= ~SWRST; //Initialize state machine }