Microchip have never understood the concept of creating a defined Application Interface,
and supporting it for the whole range of microcontrolleers and software tools.
Especially for I2C, each new line of software tools do driver interfaces in different ways,
or just deliver building blocks, such that application programmers have to develop their own application interfaces.
Some of this may be connected with different application developers have different preferences.
Some developers want code to be robust and flexible,
while other developers want code to be bare-bones simple and minimalistic.
When MCC generated code is neither compact nor robust, it ends up with each developer using their own modifications.
AFIK. MCC and Harmony do not even agree upon whether to use 7-bit or 8-bit(shifted) representation of 7-bit I2C address values.
The closest I have come, is rewriting the code you have used for I2C from
Device Library PIC10 / PIC12 / PIC16 / PIC18 MCUs - v1.77 and earlier.
Modified routines, I have used on many devices from PIC12 to PIC32MZ___EF.
See thread here: https://www.microchip.com/forums/FindPost/978822
Lately, I have been making code intended for smaller 8-bit PIC devices,
to run I2C Master code without interrupts in blocking mode.
Still with the requirement to function in a multimaster environment,
and supporting the ability to use 10 bit addressing.
With supply voltage Not higher than 4.2 V, your calculations and signaling seem within range,
with the restriction that the Pull-up voltage is 3.3 V and not lower.
However, be aware that the rising edge of signal get more rounded off,
when signal voltage is closing up to the pull-up voltage, so this will cause a limitation to the highest signaling frequency that will work.
If possible, you should study the signal vaweform on oscilloscope, to confirm that signal margins are reasonable.
I generally prefer to use SMBus input signal levels, or TTL input signal levels, if SMBus inputs are not available.
post edited by Mysil - 2021/01/16 18:11:29