How to initialize and conf S32K146 MCU to I2C chip TLC59116-Q1 & LPI2C_DRV_MasterSendData() LED up

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

How to initialize and conf S32K146 MCU to I2C chip TLC59116-Q1 & LPI2C_DRV_MasterSendData() LED up

ソリューションへジャンプ
1,703件の閲覧回数
rteja
Contributor I

Hello NXP,

I am working on S32K146 MCU and I have configured pins PTA 2 SDA and PTA 3 SCL and PTD 5 RESET for I2C chip TLC59116-Q1 HW. Then I have done the Master configuration LPI2C0 with slave address 100U and 101U where I have two I2C chip in my HW board.

Now I was trying to send data address for LEDs  for eg:, which is 0x02, 0x03, 0x04, 0x05 f based on Register Map address  from I2C chip. 

According to HW department the address assigned for the chip was 0xC8 and 0xCA.

rteja_6-1693135308920.pngrteja_7-1693135323253.png

 

When I configured in Processor expert the generated output was configured to 100 and 101 as slave address.

Since it throws error if I am entering 0xC8 in process expert so I set 7 bit address as per above pics which is 0b0110010 .

I have tested with oscilloscope and I could see the pluse signal for SDA and SCL. This clear that my slave address 100 and 101 are  configured. 

Now when I am trying to send data from Master MCU to Slave I2C via using function LPI2C_DRV_MasterSendDataBlocking(with instance number which is 0, buffer for LED based on register map address for eg 0x02, 0x03, size, send stop true, timeout 100ms  ) But here I can't see the LEDs are up  which is my expected output.

 

 

 

 

 

 

 

 

In the attached picture you can see the  generated slave address on the left, middle driver function to send data to I2C, and my current implementation to send LED address based on the Register map from I2C chip as you can see in the  attached pics for reference. 

Currently, when I am calling my function krLed_State(); every 100ms.

My expectation was LED colour must enable as output. In oscilloscope I could see signal is receiving on I2C Hw but my LEDs are not blinking. I don't understand what went wrong. 

I  am new to I2C please could you help or suggest me what went wrong with my code ? I would really appreciated for your support.

 

Thanks in advance,

 

 

 

 

0 件の賞賛
返信
1 解決策
1,579件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Ravi,

If these two TLC59116-Q1 are connected to the LPI2C0 (PTA2 PTA3) I2C bus at the same time, you cannot create a new component lpi2c because Processor Expert will report an error: Peripheral is already used by the component lpi2c1

Peripheral is already used by the component lpi2c1.png

If you only need to switch another slave address and do not need to change other settings, then please call LPI2C_DRV_MasterSetSlaveAddr function.

Best Regards,
Robin

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,599件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

1. I don't understand why you call PINS_DRV_WritePin(PTA, SDA_I2C_Pin, 1); and PINS_DRV_WritePin(PTA, SCL_I2C_Pin, 1); Did you connect external pull up resistors at I2C bus?

2. Why configure 100Hz Baudrate, it's really slow.(You may need to increase the timeout value.)

3. Would you please measure the waveform of SDA and SCL. Then we can see a waveform similar to that mentioned in TLC59116: LEDs not turning on


Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信
1,591件の閲覧回数
rteja
Contributor I

Hi Robin, 

 

thank you for contacting me. I have fixed my problem I was using wrong slave address. Now I am able to turned up the LED and running.

I have one another question. In my HW we have 2 separate I2C TLC59116-Q1 chips . Currently in my Processor expert I have configured lpi2c0 component. It generated one INSTANCE 0. 

My point is do I need to create one more new component lpi2c1 or with the existing component lpi2c0 is enough to configure and make other chip to turn led on ? 

If so how to initialize  two components with single INSTANCE 0 ? 

Please help me how to handle two I2C chip with single instance. 

Thank you,

Ravi

0 件の賞賛
返信
1,580件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Ravi,

If these two TLC59116-Q1 are connected to the LPI2C0 (PTA2 PTA3) I2C bus at the same time, you cannot create a new component lpi2c because Processor Expert will report an error: Peripheral is already used by the component lpi2c1

Peripheral is already used by the component lpi2c1.png

If you only need to switch another slave address and do not need to change other settings, then please call LPI2C_DRV_MasterSetSlaveAddr function.

Best Regards,
Robin

0 件の賞賛
返信