Issue with RG2 and RG3 as GPIO input.
I am using PIC32MX795F512L for 1 of my project. I need to read 4pin input dip switch status in my application. There are plenty of other GPIO's I am using and all of them are working properly however with RG2 and RG3 it's not working. If this 2 pins are low then on controller they read them as high. If both pin status is different then I can read them properly. I disabled USB and using this as an GPIO only.
I went through different posts and only found this pins are only Input but no one posted any issue with Input. Below is part of code.
#pragma config ICESEL = ICS_PGx1
#pragma config FCANIO=ON
#pragma config FUSBIDIO = OFF // USB USID Selection (Controlled by Port Function)
#pragma config FVBUSONIO = OFF // USB VBUS ON Selection (Controlled by Port Function)
#pragma config FPLLMUL = MUL_20, FPLLIDIV = DIV_2, FPLLODIV = DIV_1, FWDTEN = OFF
#pragma config POSCMOD = HS, FNOSC = PRIPLL, FPBDIV = DIV_2
#pragma config WDTPS = PS8192
#define DIP1_BIT_TRIS _TRISA3
#define DIP2_BIT_TRIS _TRISA2
#define DIP3_BIT_TRIS _TRISG2
#define DIP4_BIT_TRIS _TRISG3
#define DIP1_BIT _RA3
#define DIP2_BIT _RA2
#define DIP3_BIT _RG2
#define DIP4_BIT _RG3
DIP1_BIT_TRIS = INPUT;
DIP2_BIT_TRIS = INPUT;
DIP3_BIT_TRIS = INPUT;
DIP4_BIT_TRIS = INPUT;
Let me know if anyone can help.