Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21938

Port 2 using as SPI USCIB0

$
0
0

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


Viewing all articles
Browse latest Browse all 21938

Trending Articles



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