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.
Hi experts,
I'm using Port 4 for USCI_A1 Spi configuration, but in datasheet port mapping is there for port 4 so that we can use it by configuration through port mapping.
Here's what I have tried but it doesn't update P4MAP0 and so on registers can anyone please check and let me know where I'm going wrong.
const unsigned char P4mapping[8] = {
PM_UCA1CLK,
PM_NONE, // Please check down why I have used PM_NONE
PM_NONE,
PM_UCA1STE,
PM_UCA1SIMO,
PM_UCA1SOMI,
PM_NONE,
PM_NONE
};
void Port_Mapping(void)
{
unsigned char i;
volatile unsigned char *ptr;
__disable_interrupt(); // Disable Interrupts before altering Port Mapping registers
PMAPPWD = 0x02D52; // Enable Write-access to modify port mapping registers
#ifdef PORT_MAP_RECFG
PMAPCTL = PMAPRECFG; // Allow reconfiguration during runtime
#endif
ptr = &P4MAP0;
for(i=0;i<8;i++)
{
*ptr = P4mapping[i];
ptr++;
}
// P4MAP0 = PM_UCA1CLK;
// P4MAP3 = PM_UCA1STE;
// P4MAP4 = PM_UCA1SIMO;
// P4MAP4 = PM_UCA1SOMI;
PMAPPWD = 0; // Disable Write-Access to modify port mapping registers
#ifdef PORT_MAP_EINT
__enable_interrupt(); // Re-enable all interrupts
#endif
}
int main (void)
{
int i;
WDTCTL = WDTPW | WDTHOLD; // Stop Watchdog
__bis_SR_register(GIE);
//increaseVCoreToLevel2();
Port_Mapping();
initClockTo1MHz();
}
Note: Here in array I have wrote there PM_NONE for some variables just because I don't want to configure that registers.
Please it's a humble reuest that let me know what wrong I'm doing so that I can fix that issue and move further to my work as I'm stuck at this portion.
Hi Lukas,
Can you check my portmapping function and let me know whether the initialization is correct or wrong??? Please throw some lights on me.
Hi Manish,
When you set the P4MAPx register, you also need to set the P4SEL and P2DIR registers to achieve the function you want.
If you would like to use the USCI_AI SPI function, as described in the Datasheet, you need to set:
P4MAP0: 0x0D P4MAP4: 0x0C P4MAP5: 0x0B P4SEL : bit0:1 bit4:1 bit5:1 P4DIR : bit0:1 bit4:1 bit5:0
Some data in datasheet as your reference :
Best Regards
Johnson
**Attention** This is a public forum