Hi
I've been trying set-up and use I2C and SPI using UCB0 on Port2. The intention is to switch between the two of them during runtime.
The issue I'm facing is that I cannot get the SPI to work after I have enabled I2C(SPI works if do not map the I2C to Port2.) - it seem like the port mapping is creating the issue but I not entirely sure(I've looked in errate and couldn't find any known related issue).
What I do: I reset the module and clear the state of the port pins, in between, before switching to SPI.
First I set up ports directions, state and so and then i do port mapping. When that is done I initialize the UCB0 for either SPI or I2C including relevant settings and enable the module(UCB0CTL1 &= ~UCSWRST)
I'm wondering if its something with UCBOCLK and UCB0SCL as they are essential the same?
Below is a snippet of how the mapping is done? Is there something I misunderstand in regards to mapping during runtime??
*////////////////////// Mapping SPI to PORT2.x*/////////////
__disable_interrupt();
PMAPPWD = 0x02D52; // Mapping SPI to PORT2.x
P2MAP0 = PM_UCB0CLK;
P2MAP1 = PM_UCB0SOMI;
P2MAP2 = PM_UCB0SIMO;
P2MAP3 = PM_NONE;
P2MAP4 = PM_NONE;
PMAPPWD = 0;
__enable_interrupt();
*////////////////////// Mapping I2C to PORT2.x*/////////////
__disable_interrupt();
PMAPPWD = 0x02D52; // Mapping I2C to PORT2.x
P2MAP0 = PM_NONE;
P2MAP1 = PM_NONE;
P2MAP2 = PM_NONE;
P2MAP3 = PM_UCB0SDA;
P2MAP4 = PM_UCB0SCL;
PMAPPWD = 0;
__enable_interrupt();
Br MM