I2C Slave Mode for LPC8N04

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

I2C Slave Mode for LPC8N04

1,209 Views
syazdanp
Contributor II

Hi 

I look for I2C slave mode example code for LPC8N04 , dose anyone know a nice source code example even for similar chip, documents,.... to start? Thanks in advance.

Labels (1)
5 Replies

918 Views
syazdanp
Contributor II

I can not find  related function for Transmit and Receive data in slave mode in i2c_8Nxx.c  library. I need to read my address from Master but can not find slave read  function at the first step.

I really appreciate if you can give some hint toward it. 

0 Kudos

918 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Audrey Jam,

    Unfortunately, until now, about the sample code, we just have the i2c_8Nxx.c, we still don't have the dedicated i2c sample code.

   About the document, please refer tot he LPC8N04 user manual I2C chapter:

https://www.nxp.com/docs/en/user-guide/UM11074.pdf 

   Actually, in the the i2c_8Nxx.c, there has some slave read and send data, it is in handleSlaveXferState function.

   About the slave address, actually, it is configured in the slave code, then when the master send the according slave addres, the I2C slave will match, and will get the according status in teh I2C status register. You don't need to read the slave address from master in the slave code.  The slave address can be set with function setSlaveAddr.

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

918 Views
syazdanp
Contributor II

Hi Kerry 

I have developed my project with I2C LPC8N04  to use in  slave Mode implemented based on LPC8N04-MCUXpresso-BSP.zip from NXP and chapter 16 I2C of user Manual. My slave address is 0x1E coming from master, but by using  interrupt based operation I am not able to see my slave address or having  any communication with master. I have tried  Chip_I2C_EventHandler which does not work and then using poling  Chip_I2C_EventHandlerPolling, but still my I2C does not work.  My second problem is setting right address mask. Please see the attached file. I really appreciate if you can take a look and see which part of my setting is wrong.

I have set (in LPC_I2C_T)   I2C_Regs.CONSET= 0x44; //  01000100  based on manual , but my SI bit never changes to 1.  I set consent and slave address  registers ,and did not config rest of registers, am i wrong?Thanks in advance, best regards

0 Kudos

918 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Audrey,

   It seems you missed the attached file, please attach it again, please also tell me what the I2C data and detail address you want to send in the I2C bus, I will check it on my side when I have time.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

918 Views
syazdanp
Contributor II

Thanks for your answer, I will use it and let you know if i need more clarification.

best regards

0 Kudos