Hello @VaneB the S32Design Studio didn't have LPI2C Receive example code for S32K146EVB.
If you can provide any example code for LPI2C or MRDR Receive that will be helpful for me.
Thank You
Hello @VaneB I am searching for S32 SDK for LPI2C not for RTM project..
I am not interested in any RTOS project.
If you can help me any hardcoded file with MRDR or Master Receive function that will be helpful for me.
Thank You
Hi @Nibesh
RTM means "ready to market". It is not the name of the software. We have available two different software for S32K1 devices. These are the S32 SDK for S32K1xx, and the other one is Real-Time Drivers (RTD).
Regarding the examples previously provided, the first one was implemented using the registers as the S32K1xx Series Cookbook and the other two were implemented using the SDK. Any of these uses RTOS.
Could you please help me clarify if you are using any of the mentioned software or if you are working with the registers?
Hi @Nibesh
Check the following examples. These are some implementations for I2C using different software. It might be a good reference for your project.
Example_S32K144_I2C_Master_MPL3115A2
LPI2C MASTER and LPI2C SLAVE (S32 SDK for S32K1xx examples)
B.R.
VaneB
Hi @Nibesh
Sorry for the delay. I have some observations about your code.
If we refer to the code used as a reference for your project, we can see that two addresses were defined for the slave.
#define MPL3115A2_W 0xC0
#define MPL3115A2_R 0xC1
In these, a 1-bit shift to the left was made, and the bit that identifies whether you want to do a read or writing was added (we go from a 7-bit to an 8-bit address). Therefore, when you are calling the read or write functions, the same direction is taken as if a write were being done all the time.
Additionally, I could see that in your write function, you are sending an array, but when you call it in the function, you are only sending the address of the array, not a pointer to it.
use &uartRxBuff instead of uartRxBuff
Additionally, in this function, when sending data, you would not be traveling through the array, because you always send the same data.
uint8_t LPI2C0_write(uint8_t s_w_address, uint8_t * byte, uint8_t size)
{
if(bus_busy()) return (error |= (1 << BUSY));
generate_start_ACK(s_w_address);
for(int i=0;i<size;i++)
transmit_data(byte[i]);
if(generate_stop()) return error;
else return OK;
}
Please let me know if I misunderstood any of the above observations.