I2C Slave implementation with blocking reads

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

I2C Slave implementation with blocking reads

936 Views
nabeelhasan
Contributor I

Hi

I am working on implementing driver for Interrupt driven I2C slave.

I wrote some basic code where a task would wait for bytes to come from the master. As I started implementing this, I realized that the fread function is not a blocking call. If I were to use a UART interrupt driven driver, the driver would block the task till there is something in the buffer. But in the i2c driver, an fread simply reads whats in the buffer. If there is nothing then it will just return a 0 byte read. The only way to implement this would be to constantly poll Fread() and wait for bytes to come, but that defeats the purpose of using an interrupt driven I2C.

I started looking at older threads but did not find the answer to my question.

how to implement a SLAVE-mode MQX i2c driver??

In this thread, the person asks why i2c driver does not block tasks, and no one answered that question.

I2C Slave sample code

This thread only talks about a polled i2c slave driver.

If any one has implemented a interrupt I2c Slave driver, where a task can be blocked till bytes start filling the i2c RX buffer, please let me know :smileyhappy:

0 Kudos
3 Replies

417 Views
nabeelhasan
Contributor I

BTW, I am using a MCF54415

0 Kudos

417 Views
Wlodek_D_
Senior Contributor II

Hello,

Thank you for your post, however please consider moving it to the right community place (e.g. MQX Software Solutions ) to get it visible for active members.

For details please see general advice Where to post a Discussion?

Thank you for using Freescale Community.

0 Kudos

417 Views
nabeelhasan
Contributor I

thanks... I have moved it to the correct forum

0 Kudos