lpi2c_rtos having issues when used with powermode_switch

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

lpi2c_rtos having issues when used with powermode_switch

1,345 Views
tbtbtbt
Contributor III

I've been trying to use lpi2c for rtos to establish communication between mx rt1021 and arduino uno. I used the freertos_lpi2c demo app to make sure my hardware setup was correct and it worked just fine. I transferred that code into a larger project which uses the powermode_switch demo application rtos settings, but the code won't work in the new project. When the code reaches the lpi2c_transfer function, all tasks get suspended and transfer won't complete, even with error. I am a little lost because all of the code is the same and the hardware setup is the same as well. Are there any settings in the powermode_switch demo app that would affect i2c communication? 

All of the code can be found in "peripherals.c" and "idle_task.c" at the link provided below, if it is of any help.

https://github.com/AA-CubeSat-Team/soci_cdh_rtos/tree/dev_idleTask/cdh_prototype

Labels (1)
Tags (2)
0 Kudos
9 Replies

1,316 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
According to your description, the idle_task seems like fail to transmit the data via the I2C interface.
If my understanding is right, I'd like to suggest you just initialize the I2C_1, then give it a try again.

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

0 Kudos

1,306 Views
tbtbtbt
Contributor III

Yes that's correct.

I've initialized the I2C_1 interface and made sure that all of the routing details are the same as when I run the demo project, but this still doesn't fix the problem.

0 Kudos

1,300 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
I was wondering if you can upload a simple demo project based on freertos_lpspi_b2b_master that can replicate the issue, then I can test it on my board and figure it out.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,278 Views
tbtbtbt
Contributor III

Thank you for your help. 

Just to clarify, you would like me to switch to lpspi? Or upload the demo project code I've been using for lpi2c?

0 Kudos

1,253 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
1) Just to clarify, you would like me to switch to lpspi? Or upload the demo project code I've been using for lpi2c?
-- I'm sorry for the above typo error, I was wondering if you can upload a simple demo project based on freertos_lpi2c that can replicate the issue.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,239 Views
tbtbtbt
Contributor III

Hello,

I recreated the issue by copying the working lpi2c code into the powermode_switch demo app. Our overall project was copied into the powermode_switch demo app environment so I'm fairly certain this has isolated the problem.

Thank you.

0 Kudos

1,228 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
The LPI2C_RTOS_Transfer function will haven't returned the kStatus_Success flag when the slave device doesn't give the correct response.
In another word, the LPI2C_RTOS_Transfer function will fail to transfer the complete data, just as the below shows, the slave device can't give ACK to the master device during the interaction process.

jeremyzhou_1-1629790829606.png

So I'd like to suggest to check the slave device work well.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,331 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
Before answering your question, I was wondering if you can list the steps of merging code in detail.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,325 Views
tbtbtbt
Contributor III

Thank you for your reply.

The code was copied and pasted into the demo app project environment. The only differences are that the initialization code for I2C1 itself is placed in a separate function which is called from main before tasks are created and the scheduler is started. This also includes setting the clock speed and priority at nvic. 

0 Kudos