LPI2C Master in S32K116

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

LPI2C Master in S32K116

7,582件の閲覧回数
MNRH
Contributor I

Hi,

I am new to the S32K series MCU's I was looking for a I2C master communication sample project for the S32K116

We found your base "Example_S32K144_I2C_Master_MPL3115A2_S32DSR1_v3" in the forum

I have tried to port it and to build for the S32K116 but its not working going to unknown interrupts,

are LPI2C0_SCL,LPI2C0_SDA  and LPI2C0_SCLS ,LPI2C0_SDAS are the same ?

can someone help me to figure it out the issue

0 件の賞賛
返信
8 返答(返信)

7,555件の閲覧回数
MNRH
Contributor I

Hi Robin,

I have used the sample code S32K116_Project_LPI2C from the below location 

MNRH_0-1657870180382.pngMNRH_0-1657870180382.png

I was trying to read a save device and only the Address byte is getting transferred and no read register address is passing

i am getting the ACK from the slave device  

MNRH_1-1657870288792.pngMNRH_1-1657870288792.png

 

Any idea why its not allowing further ?

 

0 件の賞賛
返信

7,551件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

You need to either use the PTA3 and PTA2 or the PTB6 and PTB7.

S32K116_Project_LPI2C is simple bare metal example. Have you tried to test lpi2c_master_s32k116?

0 件の賞賛
返信

7,545件の閲覧回数
MNRH
Contributor I

Hi Robin,

I am going to test the lpi2c_master_s32k116 now 

meantime I have found the example code for K144  "Example_S32K144_I2C_Master_MPL3115A2_S32DSR1_v3" can you explain to me how can I port the code for the S32K116? that would be a great help

From In the In the reference manual, all the In the prereferral registers are the In same for 116 and 144, only difference I found is the Highspeed mode

but when I compile and run the code is getting struck in to the default ISR I am using a 16MHz external oscillator in my board not sure is that the problem.

I am attaching the Example code here with 

 

Thanks 

0 件の賞賛
返信

7,539件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

I think you can copy the codes into S32K116_Project_LPI2C project. And then modify these points:

port the code for the S32K116.pngport the code for the S32K116.png

16MHz external oscillator will not caused issue due to the main function call SIRC_div(): System clock by default 48MHz CORE/SYS, 48MHz BUS, 24MHz FLASH in RUN mode (FIRC).

Please attached the debug image, so that I can check which step caused default ISR.

0 件の賞賛
返信

7,517件の閲覧回数
MNRH
Contributor I

 

Hi Robin,

When I send the data to read the slave register the Salve address is getting shifted to right by one bit 

LPI2C0_read(0x36,0x0b, id, 1);

For 0x36 I am getting the 0x1b(Shifted by 1 bit)

 

Error Frame.pngError Frame.png

0 件の賞賛
返信

7,508件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Take the MPL3115A2 data sheet and engineering as an example:

Figure 5. I2C bus transmission signals.pngFigure 5. I2C bus transmission signals.pngI2C Address MPL3115A2.pngI2C Address MPL3115A2.png

Please check the data sheet of your slave device.

0 件の賞賛
返信

7,552件の閲覧回数
MNRH
Contributor I

In My application board we have provided the PTA0 and PTA1 (SDAS and SCLS) for the I2C as SDA and SCL

from the information you have shared i have understand that this will not be able to use in 2 wire mode to communicate with a 2 wire slave device 

so we need to either use the PTA3 and PTA2 or the PTB6 and PTB7 pleas correct me if i am wrong 

 

0 件の賞賛
返信

7,560件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi 

Please install S32 Design Studio for ARM 2.2 - Update 1 available

Then you should find the lpi2c_master_s32k116 example

lpi2c_master_s32k116.pnglpi2c_master_s32k116.png

C:\NXP\S32DS_ARM_v2.2\S32DS\software\S32SDK_S32K1xx_RTM_3.0.0\doc\S32SDK_S32K116_UserManual.pdf may also helps.

52.2.4 Signal Descriptions.png52.2.4 Signal Descriptions.png

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