Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 228860

Forum Post: RE: MSP430F5529: How to configure the 4 wire SPI Connection in salve MCU?

$
0
0
void spi_init(void) { P3SEL |= BIT0; // MOSI P3SEL |= BIT1; // MISO P3SEL |= BIT2; // CLK P1DIR |= 0xff; // set all to output direction CS10, CS9, CS8, CS7, CS6, CS5, CS4, CS3 P2DIR |= BIT1 + BIT0; //Set to Output Direction CS1, CS2; UCB0CTL1 |= UCSWRST; // **Put state machine in reset** UCB0CTL0 |= UCMST+UCSYNC+UCCKPL+UCMSB; // 3-pin, 8-bit SPI master // Clock polarity high, MSB UCB0CTL1 |= UCSSEL_2; // SMCLK 8MHz UCB0BR0 = 0x08; // /8 = 1Mhz UCB0BR1 = 0; // //UCB0MCTL = 0x00; // No modulation UCB0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** } void spi_init(void) { P3SEL |= BIT0; // MOSI P3SEL |= BIT1; // MISO P3SEL |= BIT2; // CLK P1DIR |= 0xff; // set all to output direction CS10, CS9, CS8, CS7, CS6, CS5, CS4, CS3 P2DIR |= BIT1 + BIT0; //Set to Output Direction CS1, CS2; UCB0CTL1 |= UCSWRST; // **Put state machine in reset** UCB0CTL0 |= UCMST+UCSYNC+UCCKPL+UCMSB; // 3-pin, 8-bit SPI master // Clock polarity high, MSB UCB0CTL1 |= UCSSEL_2; // SMCLK 8MHz UCB0BR0 = 0x08; // /8 = 1Mhz UCB0BR1 = 0; // //UCB0MCTL = 0x00; // No modulation UCB0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** } this is the configuration in master. In my program, I receive the data from master and then assign the values to the GPIO pins. So I check the GPIO pins, It's not giving the output. I am using UCB0 for the SPI configurations.

Viewing all articles
Browse latest Browse all 228860

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>