To begin, this is my first go-around with a Kinetis microcontroller and Kinetis Design Studio (v3.2.0). I am working with a Kinetis MK10DN512VLK10 and have been using Processor Expert within Kinetis Design Studio to create the drivers for my peripherals. On my platform, I'm using CAN, I2C, and a few general GPIO. I'm also running FreeRTOS v9.0.0. Processor Expert has created the drivers for the I2C (driver version 1.07) and CAN (also driver version 1.07). My microcontroller is running at 100MHz, the I2C bus is running at 250kHz, and the CAN bus is running at 125kbit/s.
The problem that I'm experiencing is this: Whenever I read or write to the bus, I have to wait approximately 10ms (which I am doing via the FreeRTOS command "vTaskDelay()") before I can read from or write to the bus again. This holds true for both I2C and CAN. It's very odd and is a nuisance for timing critical functions. As a result of the required delay, in order to function correctly, my code has to look like that below:
I2Cdatafunctionpointer = Component_I2C0_Init(I2CUserDataPointer);
I2Cstatus = Component_I2C0_SelectSlaveDevice(I2Cdatafunctionpointer, LDD_I2C_ADDRTYPE_7BITS, TemperatureSensorAddress); //Select I2C slave addresses
I2Cstatus = Component_I2C0_MasterSendBlock(I2Cdatafunctionpointer, &TemperatureSensorTempRegister, 0x01u, LDD_I2C_SEND_STOP); //Send register address to I2C slave device
I2Cstatus = Component_I2C0_MasterReceiveBlock(I2Cdatafunctionpointer, &TemperatureRaw, 0x02u, LDD_I2C_SEND_STOP); //Read I2C slave device register
TemperatureRaw = .....
If I use a delay time of less than 10ms, the I2C bus either shows as "busy" when I'm trying to write, or has no data yet if I'm trying to read. If I'm using CAN, consecutive writes without the 10ms delay results in only the first message being sent and no subsequent messages.
Although I have no data to support this yet, I'm assuming my problem lies with either my interrupt priorities or the driver itself. In the FreeRTOS config, I have my "Max SysCall Interrupt Priority" set to 5. Therefore, I have my I2C task, which contains the above code, running at a priority of 1. The I2C driver is operating via interrupts at a priority of 5.
Has anyone seen anything like this before? Any help is greatly appreciated!