9S12ZVL IIC software problem

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

9S12ZVL IIC software problem

ソリューションへジャンプ
1,710件の閲覧回数
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).

ラベル(1)
0 件の賞賛
返信
1 解決策
1,498件の閲覧回数
kef2
Senior Contributor V

IIC0IBCR = (IIC0IBCR_IBEN_MASK  &  IIC0IBCR_MS_SL_MASK  &  IIC0IBCR_TX_RX_MASK);

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,498件の閲覧回数
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 件の賞賛
返信
1,499件の閲覧回数
kef2
Senior Contributor V

IIC0IBCR = (IIC0IBCR_IBEN_MASK  &  IIC0IBCR_MS_SL_MASK  &  IIC0IBCR_TX_RX_MASK);

0 件の賞賛
返信