SAM4S as TWI slave in FreeRTOS

Has anyone ever gotten a SAM4S to work as TWI slave in FreeRTOS? I’m having trouble finding any information or examples. Don’t really know where to start at the moment.

Where did you look? I think Microchip provide examples with their tools.

Here is an example on TWI usage. Though not directly connected to freeRTOS

Thanks for the response! I can now send and receive from my device.

There’s one thing I don’t understand: I2C/TWI slave devices always have registers you write to to set it up. How would I go about implementing that? So far, my slave device only reads and get the data.