Hot!Issue with RG2 and RG3 as GPIO input.

Author
Mahendra007
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2018/08/09 17:23:42
  • Location: 0
  • Status: offline
2018/08/14 12:55:35 (permalink)
0

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.
 
Config -:
#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
 
GPIO-:
#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.
 
Thanks,
 
Mahendra
#1

2 Replies Related Threads

    simong123
    Lab Member No. 003
    • Total Posts : 1290
    • Reward points : 0
    • Joined: 2012/02/07 18:21:03
    • Location: Future Gadget Lab (UK Branch)
    • Status: offline
    Re: Issue with RG2 and RG3 as GPIO input. 2018/08/14 14:14:40 (permalink)
    0
    How have you connected VUSB3V3? It should be connected to VDD to enable RG2/RG3 to be used as GPIO.
    #2
    Mahendra007
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2018/08/09 17:23:42
    • Location: 0
    • Status: offline
    Re: Issue with RG2 and RG3 as GPIO input. 2018/08/14 17:06:09 (permalink)
    0
    Hi Simong, 
     
    VUSB is not connected right now I will connect it to VDD and check if this works.  Thank you.
     
     
    #3
    Jump to:
    © 2019 APG vNext Commercial Version 4.5