Hi
I am working on MSP430F5659 controller. In this i want to use the USCIB0 SPI port which is Port2.
My question is whether i need to declare the Port2 pins as SPI port using PORT mapping as given in example code
void Port_Mapping(void)
{
// Disable Interrupts before altering Port Mapping registers
__disable_interrupt();
// Enable Write-access to modify port mapping registers
PMAPPWD = 0x02D52;
#ifdef PORT_MAP_RECFG
// Allow reconfiguration during runtime
PMAPCTL = PMAPRECFG;
#endif
P2MAP1 = PM_UCA0SOMI;
P2MAP2 = PM_UCA0SIMO;
P2MAP3 = PM_UCA0CLK;
// Disable Write-Access to modify port mapping registers
PMAPPWD = 0;
#ifdef PORT_MAP_EINT
__enable_interrupt(); // Re-enable all interrupts
#endif
}
or i can declare using below shown code
P2SEL |= BIT1+BIT2+BIT3; // Set SPI peripheral bits
P2DIR |= BIT1+BIT3; // Clock and DOUT as output MOSI & CLK
P2DIR &= ~BIT2; // Din as input MISO
Thanks
Nitesh