Part Number: MSP432P401R
Hi Team
Use the SPI function of the UCB3 module: configure P10.3 as SOMI, P10.2 as SIMO, P10.1 as SCK; clock frequency is 12M;
The initialization code is as follows:
P10SEL1 &= ~(BIT2+ BIT3); P10SEL0 |= (BIT2+ BIT3); P10SEL0 |= (BIT1); P10SEL1 &= ~(BIT1); P10DIR |= BIT1; P10SEL0 &= ~(BIT0); P10SEL1 &= ~(BIT0); P10DIR |= BIT0; P9SEL0 &= ~(BIT7); P9SEL1 &= ~(BIT7); P9DIR |= BIT7; UCB3CTLW0 |= UCSWRST; UCB3CTLW0 |= (UCMST + UCSYNC + UCMSB+ UCCKPL); UCB3CTLW0 |= UCSSEL_2; UCB3BRW = 2; UCB3CTLW0 &= ~UCSWRST; |
TA2.4 is configured as PWM function, output pin P6.7, configuration output function first basic function; output frequency 100Hz, counting mode 2;
The initialization code is as follows:
P6SEL0 |= BIT7; P6SEL1 &= ~BIT7; P6DIR |= BIT7; P6OUT |= BIT7; TA2CTL &= ~(MC1 + MC0 ) ;
TA2CTL |= TASSEL_2 + TACLR + ID_3; TA2CCR0 = SMCLK / 800; TA2CCR4 = 0x0; TA2CCTL4 = OUTMOD_2; TA2CTL |= MC0; |
In the case that the PWM function is not initialized, the SPI operation is normal; however, after the PWM is initialized, the read data of the SPI is always 0xff;
May i know what is this all about?
Thanks