When I initial the LPI2C by S32DS, it will run in default ISR.

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

When I initial the LPI2C by S32DS, it will run in default ISR.

1,418 Views
1120905896
Contributor I

firstly i initialize the clock and then initialize pins driver. And then I initialize the LPI2C. But when I enable interrupt. then it will run to default interrupt. I actually don't know which cause it. Can someone help me?

  Thanks in advance!

0 Kudos
7 Replies

1,219 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

Do you have the correct ISR in your code?

Can you share the code?

Example_S32K144_I2C_Master_MPL3115A2_S32DSR1_v3 

BR, Daniel

0 Kudos

1,219 Views
1120905896
Contributor I

Hello Daniel,

   Thanks for your reply.  It's because I don't enable the bus clock. But when I send data. execute the command

master->blocking = true. the txBuff can be accessd. Can you give me some suggestion?WeChat Screenshot_20190327175109.png

0 Kudos

1,219 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello,

Thanks, I read in the post that you initialized the clock

Yes, if the bus interface clock is not enabled, any access to the LPI2C module triggers a fault exception.

I have noticed that you use S32K144.

pastedImage_1.png

Which has SRAM_U mapped to 0x20000000 - 0x20006FFF.

And the txBuff pointer points to 0x20010018 which is out of the SRAM_U region on this device.

Regards,

Daniel

0 Kudos

1,219 Views
1120905896
Contributor I

Hello Daniel,

   I'm so sorry I don't express my meaning clearly. I mean that before I run the command  master->blocking = true. txBuff pointer points at 0x20000884. But after running this command. txBuff pointer will point at address 0x20000884. if I change the command master->blocking = true to master->blocking = false.  The address will be correst.

But now when I initialize the SOSC 8M, SPLL160M and normal run mode 80M. the program will run into startup.c file.  I don't know which cause it.

Best regrds,

Xiaowei.

0 Kudos

1,219 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Xiaowei,

The SDK drivers must not be modified. We can't guarantee a proper functionality of the drivers if modified. 

There are two functions you can use:

LPI2C_DRV_MasterSendDataBlocking()

LPI2C_DRV_MasterSendData()

Depending whether you want to send the data blocking or non-blocking.

Regarding the clock issue, I would have to see the code to answer that.

Can you provide a simple test code?

Thanks,

BR, Daniel

0 Kudos

1,219 Views
1120905896
Contributor I

Hello Daniel,

Thanks for your support.

Now I create a new project and move my source code from old project to new project.  And now it work properly. Now I use functionality LPI2C_DRV_MasterSendData() to send data to slave. But I still don't know which cause that issue. And I can't confirm that the clock of former project is correct. So I'm very confused.  you can see the wave.  is it correct?  (One is SCL, two is SDA.)

WeChat Image_20190329171106.jpg

Best regards,

Xiaowei.

0 Kudos

1,219 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Xiaowei.

The waveform looks correct to me.

It is not receiving any ACK though.

What is your doubt?

Thanks,

Daniel

0 Kudos