Pack PIC18F-Q_DFP 1.8.154
MCC plugin v4.0.2
Issue 1: MCC fails to configure I2C1CON2 correctly after change
1/ Add an I2C1 peripheral.
Set the pins in pin manager and use internal pull-ups.
I2C1CON2 = 0x18
2/ Edit the peripheral and turn on fast mode.
3/ Edit the peripheral and turn off fast mode.
I2C1CON2 = 0x00 // 0 is incorrect it should be 0x18
Issue 2: Interrupt driven I2C gets stuck in never ending interrupt loop.
Take some working MCC I2C polling mode code and enable interrupts on the I2C peripheral in MCC.
On calling I2C1_Open, the code gets stuck in a never ending interrupt loop as I2C1PIRbits.PCIF keeps getting set due to I2C1_MasterResetBus call in I2C1_DO_RESET. It seems that disabling and enabling the I2C peripheral causes the PCIF to be set again, just after the enable code. Commenting out the enable/disable in this code makes everything work fine.
Is it possible this is a silicon bug?
static inline void I2C1_MasterResetBus(void)
I2C1CON0bits.EN = 0;
//Set Clear Buffer Flag
I2C1STAT1bits.CLRBF = 1;
I2C1CON0bits.EN = 1;