Hi,
I'm trying to change the port mapping on my MSP430F552x MCU so that the SPI ports are outputted as follows:
P4.1: PM_UCB1SIMO (Already set)
P4.7: PM_UCB1SOMI (Remap)
P4.4: PM_UCB1CLK (Remap)
After reading through several tutorials and documentation online, I wrote up the following code in my project:
void systemInit( void )
{
int state;
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
Port_Mapping();
gdevstate.adxl_interrupt_state=0;
setupPorts(); // set up IO ports
setupClocks(); // set up system clock and RTC
timerInit(); // init timer interface
setupSPI();
...
void Port_Mapping(void)
{
__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
P4MAP0 = PM_NONE;
P4MAP1 = PM_UCB1SIMO;
P4MAP2 = PM_NONE;
P4MAP3 = PM_NONE;
P4MAP4 = PM_UCB1CLK;
P4MAP5 = PM_NONE;
P4MAP6 = PM_NONE;
P4MAP7 = PM_UCB1SOMI;
PMAPPWD = 0; // Disable Write-Access to modify port mapping registers
#ifdef PORT_MAP_EINT
__enable_interrupt(); // Re-enable all interrupts
#endif
}
I think the remapping of all 8 ports might be redundant, but I wanted to be sure. When I test the device I'm trying to use (an ADXL345), I don't get any interrupt data back. It worked fine before when I used ports that were not remapped. I had to switch to remapped ports because the final PCB this module is attaching to does not include P4.2 or P4.3.
Does anyone have any suggestions why this may not be working? Also, if anybody had suggestions for how to visually debug that the port mapping is working (outputting to LEDs, etc), that would be great.
Thanks!
Matt