s32k3 i2c

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

s32k3 i2c

2,391 Views
piyush1
Contributor III

hello dear NXP team .....

i have configured this LPi2c0 as master and Lpi2c1 as slave but it doesn't work...i don't know how to it will communicate with each others....i have uploaded my project code here ...please check and edit necessary things in it and give me workable edited code from your side... 

0 Kudos
Reply
5 Replies

2,245 Views
piyush1
Contributor III

brother what i meant is i dont know which API's to call in main source file....so can you please put those API's and configurations which are needed in the project code which i have uploded here...so that i can understand and next time i can configure it by myself.

0 Kudos
Reply

2,208 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @piyush1 

To implement polling mode, use the blocking send and receive functions. For low-level drivers, these are named Lpi2c_Ip_MasterSendDataBlocking() and Lpi2c_Ip_MasterReceiveDataBlocking(). For high-level drivers, use I2c_SyncTransmit().

Additionally, I recommend consulting the S32K3/S32M27x I2C Driver Integration Manual and the User Manual included with the RTDs. These documents provide detailed information on the I2C driver, including its limitations, hardware and software requirements, usage instructions, and configuration guidelines. You can typically find these resources at a path similar to:

C:\NXP\S32DS.3.6.2\S32DS\software\PlatformSDK_S32K3\RTD\I2c_TS_T40D34M60I0R0\doc

0 Kudos
Reply

2,365 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @piyush1 

I have reviewed your code and configuration and would like to share a few observations.

The I2C clock source has been set to CORE_CLK, but the actual source is AIPS_SLOW_CLK. You can confirm this in the Clock Tree within the Clock Tool of ConfigTools or refer to Figure 75 in the S32K3xx Reference Manual, Rev. 11.

Also, when working in polling mode, I recommend separate devices for master and slave, as in this mode, the master continuously checks for the end of transmission or incoming data without interrupts, which can affect.

While there is not a dedicated example for your specific setup, there are two example codes available for S32K1 devices using the S32SDK for S32K1xx. These examples implement similar functionality and can serve as a helpful reference, as the I2C module is similar across these families.

 

BR, VaneB

0 Kudos
Reply

2,361 Views
piyush1
Contributor III

brother i didn't understand...can you please do corrections and update my code ang give me back so that i can understand the things ...

0 Kudos
Reply

2,336 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @piyush1 

Let me show you what I meant earlier. 

In the image below, you will see two sides:

  • On the left, there is the clock source that is currently configured in your project.
  • On the right, you will see the actual clock source being used by LPI2C0.

VaneB_0-1755281159299.png

Now, about the separate project part. What I meant is that in polling mode, the master keeps checking for data or transmission events all the time. If you set up the slave in the same project, it might interrupt this constant monitoring, which could lead to missing some data. That is why it is better to keep them in separate devices when using polling mode.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2150881%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Es32k3%20i2c%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2150881%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Ehello%20dear%20NXP%20team%20.....%3CBR%20%2F%3E%3CBR%20%2F%3Ei%20have%20configured%20this%20LPi2c0%20as%20master%20and%20Lpi2c1%20as%20slave%20but%20it%20doesn't%20work...i%20don't%20know%20how%20to%20it%20will%20communicate%20with%20each%20others....i%20have%20uploaded%20my%20project%20code%20here%20...please%20check%20and%20edit%20necessary%20things%20in%20it%20and%20give%20me%20workable%20edited%20code%20from%20your%20side...%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2155539%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20s32k3%20i2c%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2155539%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F252587%22%20target%3D%22_blank%22%3E%40piyush1%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20implement%20polling%20mode%2C%20use%20the%20blocking%20send%20and%20receive%20functions.%20For%20low-level%20drivers%2C%20these%20are%20named%20Lpi2c_Ip_MasterSendDataBlocking()%20and%20Lpi2c_Ip_MasterReceiveDataBlocking().%20For%20high-level%20drivers%2C%20use%20I2c_SyncTransmit().%3C%2FP%3E%0A%3CP%3EAdditionally%2C%20I%20recommend%20consulting%20the%20S32K3%2FS32M27x%20I2C%20Driver%20Integration%20Manual%20and%20the%20User%20Manual%20included%20with%20the%20RTDs.%20These%20documents%20provide%20detailed%20information%20on%20the%20I2C%20driver%2C%20including%20its%20limitations%2C%20hardware%20and%20software%20requirements%2C%20usage%20instructions%2C%20and%20configuration%20guidelines.%20You%20can%20typically%20find%20these%20resources%20at%20a%20path%20similar%20to%3A%3C%2FP%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3EC%3A%5CNXP%5CS32DS.3.6.2%5CS32DS%5Csoftware%5CPlatformSDK_S32K3%5CRTD%5CI2c_TS_T40D34M60I0R0%5Cdoc%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2155179%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20s32k3%20i2c%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2155179%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Ebrother%20what%20i%20meant%20is%20i%20dont%20know%20which%20API's%20to%20call%20in%20main%20source%20file....so%20can%20you%20please%20put%20those%20API's%20and%20configurations%20which%20are%20needed%20in%20the%20project%20code%20which%20i%20have%20uploded%20here...so%20that%20i%20can%20understand%20and%20next%20time%20i%20can%20configure%20it%20by%20myself.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2152966%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20s32k3%20i2c%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2152966%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F252587%22%20target%3D%22_blank%22%3E%40piyush1%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet%20me%20show%20you%20what%20I%20meant%20earlier.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20image%20below%2C%20you%20will%20see%20two%20sides%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EOn%20the%20left%2C%20there%20is%20the%20clock%20source%20that%20is%20currently%20configured%20in%20your%20project.%3C%2FLI%3E%0A%3CLI%3EOn%20the%20right%2C%20you%20will%20see%20the%20actual%20clock%20source%20being%20used%20by%20LPI2C0.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22VaneB_0-1755281159299.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_0-1755281159299.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F352597i2DD8D65432981BBF%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22VaneB_0-1755281159299.png%22%20alt%3D%22VaneB_0-1755281159299.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ENow%2C%20about%20the%20separate%20project%20part.%20What%20I%20meant%20is%20that%20in%20polling%20mode%2C%20the%20master%20keeps%20checking%20for%20data%20or%20transmission%20events%20all%20the%20time.%20If%20you%20set%20up%20the%20slave%20in%20the%20same%20project%2C%20it%20might%20interrupt%20this%20constant%20monitoring%2C%20which%20could%20lead%20to%20missing%20some%20data.%20That%20is%20why%20it%20is%20better%20to%20keep%20them%20in%20separate%20devices%20when%20using%20polling%20mode.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2151541%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20s32k3%20i2c%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2151541%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Ebrother%20i%20didn't%20understand...can%20you%20please%20do%20corrections%20and%20update%20my%20code%20ang%20give%20me%20back%20so%20that%20i%20can%20understand%20the%20things%20...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2151119%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20s32k3%20i2c%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2151119%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F252587%22%20target%3D%22_blank%22%3E%40piyush1%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20have%20reviewed%20your%20code%20and%20configuration%20and%20would%20like%20to%20share%20a%20few%20observations.%3C%2FP%3E%0A%3CP%3EThe%20I2C%20clock%20source%20has%20been%20set%20to%20CORE_CLK%2C%20but%20the%20actual%20source%20is%20AIPS_SLOW_CLK.%20You%20can%20confirm%20this%20in%20the%20Clock%20Tree%20within%20the%20Clock%20Tool%20of%20ConfigTools%20or%20refer%20to%20Figure%2075%20in%20the%20S32K3xx%20Reference%20Manual%2C%20Rev.%2011.%3C%2FP%3E%0A%3CP%3EAlso%2C%20when%20working%20in%20polling%20mode%2C%20I%20recommend%20separate%20devices%20for%20master%20and%20slave%2C%20as%20in%20this%20mode%2C%20the%20master%20continuously%20checks%20for%20the%20end%20of%20transmission%20or%20incoming%20data%20without%20interrupts%2C%20which%20can%20affect.%3C%2FP%3E%0A%3CP%3EWhile%20there%20is%20not%20a%20dedicated%20example%20for%20your%20specific%20setup%2C%20there%20are%20two%20example%20codes%20available%20for%20S32K1%20devices%20using%20the%20S32SDK%20for%20S32K1xx.%20These%20examples%20implement%20similar%20functionality%20and%20can%20serve%20as%20a%20helpful%20reference%2C%20as%20the%20I2C%20module%20is%20similar%20across%20these%20families.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBR%2C%20VaneB%3C%2FP%3E%3C%2FLINGO-BODY%3E