LPI2C redefinition Error

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

LPI2C redefinition Error

2,191 Views
saurabhkulkarni123
Contributor II

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?

 

0 Kudos
13 Replies

2,178 Views
SorinIBancila
NXP Employee
NXP Employee

Hello @saurabhkulkarni123,

Can you provide some information about this error? What board do you use? What toolbox? What Matlab version?

Best regards,

Bancila Sorin

0 Kudos

2,174 Views
saurabhkulkarni123
Contributor II

I am using an NXP S32K148 board and Toolbox is NXP S32K148 and MATLAB version is 2022A.

 

0 Kudos

2,165 Views
SorinIBancila
NXP Employee
NXP Employee

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,

0 Kudos

2,136 Views
saurabhkulkarni123
Contributor II

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?

Tags (1)
0 Kudos

2,128 Views
SorinIBancila
NXP Employee
NXP Employee

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

0 Kudos

2,123 Views
saurabhkulkarni123
Contributor II

I am using S32k148 as master LPI2C 1 and SDA- PTC31, SCL-PTD19. I am checking SDA and SCL at CRO, and also use ISR like when data is sent LED will Blink.

 I am attaching Screenshot.

0 Kudos

2,116 Views
SorinIBancila
NXP Employee
NXP Employee

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.

SorinIBancila_1-1667481064762.png

 

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.

 

0 Kudos

2,140 Views
saurabhkulkarni123
Contributor II

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.

0 Kudos

2,131 Views
SorinIBancila
NXP Employee
NXP Employee

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

0 Kudos

971 Views
Poley
Contributor V

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!

0 Kudos

802 Views
SorinIBancila
NXP Employee
NXP Employee

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)?

0 Kudos

798 Views
Poley
Contributor V

Hey @SorinIBancila 

 

No problem at all.

That is great, thank you!

 

How do I apply the patch?

 

0 Kudos

790 Views
SorinIBancila
NXP Employee
NXP Employee

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

0 Kudos