9S12ZVL IIC software problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

9S12ZVL IIC software problem

Jump to solution
1,027 Views
huang_hw
Contributor II

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).

Labels (1)
0 Kudos
1 Solution
815 Views
kef2
Senior Contributor IV

IIC0IBCR = (IIC0IBCR_IBEN_MASK  &  IIC0IBCR_MS_SL_MASK  &  IIC0IBCR_TX_RX_MASK);

View solution in original post

0 Kudos
2 Replies
815 Views
huang_hw
Contributor II

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);

0 Kudos
816 Views
kef2
Senior Contributor IV

IIC0IBCR = (IIC0IBCR_IBEN_MASK  &  IIC0IBCR_MS_SL_MASK  &  IIC0IBCR_TX_RX_MASK);

0 Kudos