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!
Hi,
Do you have the correct ISR in your code?
Can you share the code?
Example_S32K144_I2C_Master_MPL3115A2_S32DSR1_v3
BR, Daniel
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?
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.
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
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.
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
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.)
Best regards,
Xiaowei.