I am trying to control an IIC device from my 9S12ZVL board.
Background:
MPU: MC9S12ZVL32MLF (48 pins)
Dev. System: Code Warrior 10.6 Special (with Processor Expert installed)
I am already able to control other IO lines and PWM from software.
When I tried the simplest of initialization and testing WITHOUT using interrupt,
I get stuck at the very beginning when trying to send out the very first byte.
Would be grateful if someone can give me a pointer as to what I have missed?
Thanks.
My IIC code segment:
(all macros generated by Processor Expert)
IIC0IBCR = IIC0IBCR_IBEN_MASK; //enable IIC
//set IIC to Enable, Master and Tx mode, NO interrupt (this should send out a START)
IIC0IBCR = (IIC0IBCR_IBEN_MASK & IIC0IBCR_MS_SL_MASK & IIC0IBCR_TX_RX_MASK);
IIC0IBDR = 0x52U; //write slave address
while ((IIC0IBSR & IIC0IBSR_IBIF_MASK) == 0) {}
(The software is stuck here forever).
Solved! Go to Solution.
IIC0IBCR = (IIC0IBCR_IBEN_MASK & IIC0IBCR_MS_SL_MASK & IIC0IBCR_TX_RX_MASK);
Thanks Edward. You are absolutely right.
What would I do without Freescale(NXP?) Community.
I was in this mode where I can see the finest details but become blind to something obvious.
For others following this thread, it should have been
IIC0IBCR = (IIC0IBCR_IBEN_MASK | IIC0IBCR_MS_SL_MASK | IIC0IBCR_TX_RX_MASK);
IIC0IBCR = (IIC0IBCR_IBEN_MASK & IIC0IBCR_MS_SL_MASK & IIC0IBCR_TX_RX_MASK);