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.

MSP432P401R: SP432 SPI P10.0 pin CS problem

Part Number: MSP432P401R
Other Parts Discussed in Thread: CC3100

Hi,

My board is MSP432P401R.

CCS8.0

CC3100 SDK v1.3.0

I need to use the SPI signal on UCB3, configure P10.0 as SPI_CS; P10.1 as SPI_CLK; P10.2 as SPI_DIN; P10.3 as SPI_DOUT;

When the configuration of P10.0/P10.1/P10.2 is unchanged, P10.0 is used as CS, SPI communication fails, and when P3.0 is used as CS, SPI communication is normal.

 SPI initialization code:

Fd_t spi_Open(char *ifName, unsigned long flags){
/* Configure the SPI CS to be on P3.0 */
// P3->OUT |= BIT0; // CS=1 //p3
// P3->SEL1 &= ~BIT0; //p3
// P3->SEL0 &= ~BIT0; //p3
// P3->DIR |= BIT0; //p3

P10->OUT |= BIT0; // CS=1
P10->SEL1 &= ~BIT0;
P10->SEL0 &= ~BIT0;
P10->DIR |= BIT0;

P4->SEL0 &= ~(BIT1); // P4.1 nHIB (GPIO output)
P4->SEL1 &= ~(BIT1);
P4->OUT &= ~BIT1; // nHIB=0
P4->DIR |= BIT1;

// P1->OUT |= BIT7;

/* Enable pull up on P3.3, CC3100 UART RX */
P3->OUT |= BIT3;
P3->SEL0 &= ~(BIT3);
P3->SEL1 &= ~(BIT3);
P3->DIR &= ~BIT3; // input, pull up
P3->REN |= BIT3;
#if 1 //JN-SPI
/* Select the SPI lines: MOSI/MISO on P6.4,5 CLK on 6.3 */

P10->SEL0 |= (BIT1+BIT2+BIT3);
P10->SEL1 &= ~(BIT1+BIT2+BIT3);

/* Put state machine in reset */
EUSCI_B3->CTLW0 |= UCSWRST;
// UCB0CTLW0 |= UCSWRST;
/* 3-pin, 8-bit SPI master,
most sig bit first,
polarity 0, phase 0
SMCLK (12 MHz)
keep RESET */
EUSCI_B3->CTLW0 = UCMSB + UCMST + UCSYNC + UCCKPH + UCSWRST + UCSSEL__SMCLK;
// UCB0CTLW0 = UCMSB + UCMST + UCSYNC + UCCKPH;
// UCB0CTL1 = UCSWRST + UCSSEL_2;

/* Set SPI clock */
// UCB0BR0 = 0x00; /* f_UCxCLK = 8MHz */
// UCB0BR1 = 0;
EUSCI_B3->BRW = 1; // SMCLK/1 = 12 MHz
// UCB0CTL1 &= ~UCSWRST;
EUSCI_B3->CTLW0 &= ~UCSWRST;
#endif

/* Configure SPI IRQ line on P2.5 */ /* 00 (Setting as a GPIO)*/
P2->DIR &= ~BIT5;
P2->SEL1 &= ~BIT5;
P2->SEL0 &= ~BIT5;
P2->OUT &= ~BIT5; // pull down
P2->REN |= BIT5;

/* 50 ms delay */
Delay(50);
__enable_interrupt();

/* Enable WLAN interrupt */
CC3100_InterruptEnable();

return NONOS_RET_OK;
}

The MSP432 SPI pins are as follows:

How do I use the CS function on P10.0 ?

Thank you.

  • This code sets UCMODE=0, configures P10.1-3 as SPI (UCB3), and configures P10.0 as a GPIO (not STE, i.e. you wiggle it yourself). That is what I pretty much always do, and I don't know why it wouldn't work.

    Maybe you should describe your setup a little more. P3.0 goes out to the Booster Pack header, but P10.0-3 don't (rather J5). Is the CC3100 on a Booster Pack (which uses it as CS)? Is that what you're trying to talk to?

    > When the configuration of P10.0/P10.1/P10.2 is unchanged, P10.0 is used as CS, SPI communication fails
    I'm not quite sure what this means. "Unchanged" from what? What are P10.0-3 connected to?
  • Hi,

    P3.0 goes out to the Booster Pack header, Which file does it appear in ?

    We made the CC3100 board ourselves, but our SPI uses the P10.1-3 (UCB3) pin. The above code is my modification to the CC3100 SDK v1.3.0 spi.c.

    How can I port P3.0 to P10.0 ?

    Thank you.
  • > The above code is my modification to the CC3100 SDK v1.3.0 spi.c.
    Did you also modify the code that does the SPI transaction? If not, it probably still uses P3.0 for /CS, since it was probably written expecting the Booster Pack.

    > P3.0 goes out to the Booster Pack header, Which file does it appear in ?
    The schematics for the Launchpad are in the back of the User Guide (SLAU597B), but you can also read the Launchpad pin assignments from the silkscreen.

**Attention** This is a public forum