Hello,
I am trying to build a model where LPI2C master sends data and the slave receives it. but when I am trying to generate code from the model it shows a redefinition error.
"check_com.c:40:6: error: redefinition of 'LPI2C_DRV_SetSlaveAddr' void LPI2C_DRV_SetSlaveAddr(uint16_t addr, bool is10BitAddr) ^~~~~~~~~~~~~~~~~~~~~~ check_com.c:29:6: note: previous definition of 'LPI2C_DRV_SetSlaveAddr' was here void LPI2C_DRV_SetSlaveAddr(uint16_t addr, bool is10BitAddr)"
How can I solve it?
Hello @saurabhkulkarni123,
Can you provide some information about this error? What board do you use? What toolbox? What Matlab version?
Best regards,
Bancila Sorin
I am using an NXP S32K148 board and Toolbox is NXP S32K148 and MATLAB version is 2022A.
Hello,
I built the example from the toolbox and I did not receive any errors. If possible, can you share with me your model?
By any chance, do you have any other toolboxes from NXP installed in Matlab?
Best regards,
Hello,
Even though I am trying to use the I2C Master example only for NXP S32K148 MATLAB Toolbox, I am not getting output at SDA and SCL. How I can solve it? or Is there any hardware jumper setting required?
Hello,
How did you verify that you don't get any output on SDA and SCL pins? What pins did you use to connect the slave to the master? (master being S32K148 board)
Best regards,
Bancila Sorin
Hello,
In the screenshot, I see that you run the example in SIL/PIL mode. I strongly recommend to use 'Embedded Coder' to build and deploy the application on the board as time sensitive tasks (like communication) can have undefined behavior in SIL/PIL mode as it doesn't run in real time.
Secondly, make sure you have a slave connected to the master otherwise LPI2C communication doesn't work.
Best regards,
Bancila Sorin
PS: Can you explain what CRO means as I never heard this abbreviation before.
Hello @SorinIBancila ,
I am attaching a ScreenShot of the Model, I am using I2c Master and Slave Example in a single project and trying to send data from master to slave.
Hello,
I was able to reproduce the problem. Apparently, the toolbox doesn't allow to add 2 LPI2C config blocks as it generates that error with redefinition of 'LPI2C_DRV_SetSlaveAddr'.
I will investigate this use case and I will try to provide a fix as soon as possible.
Best regards,
Bancila Sorin
Hello @SorinIBancila
Did you find a fix for this?
I am trying to use 2 I2C instances and am dealing with the same issue.
Thank you!
Hello @Poley ,
It seems I totally missed the notification you tagged me. I am really sorry for the late reply.
Here is another thread where I provided a hotfix patch. Can you please check if it fixes your problems (in case you still have problems with it)?
Hello @Poley,
You have to extract the content of the .zip file then run (in MATLAB) the NXP_MBDToolbox_S32K1xx_patch.m file.
Important! Make sure that the S32K1xx toolbox is added to the MATLAB's path.
Best regards,
Sorin Bancila