I'm trying to learn how to program my device to use TWI interface to read from my board temperature sensor and there are some settings I can't decide which options to set on their registers, so I need some help clarifying these settings meaning and what they are used for!
I'm using MPLAB X IDE v5.15 and AVR Toolchain v5.4.0. I'm on Debian 9.8 (Stretch) 64 bit, if this matters!
The goal is to setup TWI interface to read temperature from this sensor.
The first thing I did was start reading Mega4808 User Manual at the TWI section, starting at page 334. Then a bit further they talk about the interface initialisation where is said that properties SDASETUP and SDAHOLD must be set before initialising the device.
I didn't know what these 2 settings meant so I went to search about them. The problem is that even after I read about them I'm still not sure what to set for these 2 settings.
I have searched both documents and found timings tables of both devices and that these tables might hold the answers but still I'm not sure what to choose.
In MCP9808 I see:
and in Mega4808 User Manual I see:
Is it reasonable to assume that if I choose Mega4808 option 3, 0x2 (300ns nominal - 180-630ns) I'll be ok for this setting? Or is it better to choose option 4, 0x3 (500ns nominal - 300-1050ns) ???
And also for SDASETUP I have no clue what for is it used for! I also need clarification for that setting, please!