Enabling UART1 causes incorrect ADC initialisation
MPLAB X V5.40
Windows 10 x64
I have a working project, see MyConfig(WORKS).mc3 and IDE Log(WORKS).txt.
Essentially it uses an interrupt to service sensor inputs from a BLDC motor in order to drive its phases. It also uses an ADC channel (AN8) to get the position of a potentiometer used to set it speed.
I now open MCC in order to add UART1 for use with pins RB7 (Tx) and RB8 (Rx), 9600, 8 data-bits, no parity and no flow control. After generating the new code, building and loading to the target the ADC AN8 no longer works, no longer able to set the motor speed. See MyConfig(BROKEN).mc3 and IDE Log(BROKEN).txt
When doing a diff between the source code that worked and the source code that included the UART1, register AD1CON2 is being set to 0x0000 but was previously set to 0x0414 thus ADC1 is not being configured correctly.
The diff reveals other changes also but as far as I can tell these appear to just swap the ordering of include files and various #define which amount to no change (but it is weird that it has occurred).
If I manually modify register AD1CON2 to 0x0414 after it has been initialised to 0x0000 during initialisation everything including the UART1 works as expected.
When MCC generates the new files both uart1.c and uart1.h shows failure in the output windows.
Any ideas why an unrelated register is be changed when UART1 is included in the project?