mcuOnEclipse - GI2C0, use with FreeRTOS

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

mcuOnEclipse - GI2C0, use with FreeRTOS

1,352 Views
Cdn_aye
Senior Contributor I

Hi

I am using KDS v3.2, sdk 1.3, PE with the mcuoneclipse components. One of the components is a high level i2c driver. I am using this with the devices.c function ReadI2CBytes. This all works as long as the FreeRTOS component is not used. Once I add the rtos, the system hangs. I have gone through the settings many times and selected FreeRTOS both the non-LDD and LDD driver but I can not get it to work with the RTOS. I have tried using the critical component around the access point of the driver but that also does not work

1). This driver is supposed to work and the example project / tutorial shows it working but with non-LDD. If I choose non-LDD I cannot change the device to 0, only 1 and 2 are available, which means the pins do not work. I have tried deleting and adding many times but no luck. Here is the question please, what are the settings for using GI2C with FreeRTOS? If it is non-LDD then how do I get to select device 0? Can anyone share a project that works on the MK20DX256ZVLL10 core or any other, we tried the FRDM-KE02Z code base (no RTOS) from mcuoneclipse and changed the processor, but as explained, we can't get this to work with the RTOS.

2). I can see the correct traffic on the analyzer for non-LDD and no RTOS. If I use LDD and no RTOS is see no traffic with the MasterReceiveBlock. I have set the slave in the init of the component. How do I get this to work? 

I found some code on the net that means adding the register access manually and it works with FreeRTOS. Is that a better way to go? I know that there are end-of-life issues with PE and how NXP chose to support the system. Do I have to go back to sdk 1.2 from sdk v1.3##? What are the recommendations anyone would have.

Thanks

Robert

Tags (3)
2 Replies

1,070 Views
Cdn_aye
Senior Contributor I

Hi 

Thanks for the suggestion. I do have the i2c access setup in a task after the scheduler starts.

///////

Found the issue. 

The alternate drivers entry point was overriding the soft vector entry, even though I had conditional compile around the task but not the unused code section. Since the code was not called I thought it was optimized out; however the compiler (IAR) still used the entry for the unused code for the vector table even though there was an entry in fsl_i2c.c for the soft vector entry point.

Thank you for the response.

Robert

0 Kudos
Reply

1,070 Views
BlackNight
NXP Employee
NXP Employee

Hi Robert,

one think to know with using an RTOS like FreeRTOS is that typically interrupts are disabled until the scheduler runs. So if you are using the I2C bus in interrupt mode, it will not work until the scheduler is started and you use it from a task context.

Maybe this is your issue?

Use the I2C bus from a task, or turn on interrrupts manually.

Thanks,

Erich