• AVR Freaks

Helpful ReplyHot!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
simong123
Lab Member No. 003
  • Total Posts : 1309
  • 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) ☄ Helpfulby Kentw 2019/07/28 23:51:36
5 (1)
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
Kentw
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2019/05/06 03:34:55
  • Location: 0
  • Status: offline
Re: Issue with RG2 and RG3 as GPIO input. 2019/07/28 23:55:16 (permalink)
0
simong123
How have you connected VUSB3V3? It should be connected to VDD to enable RG2/RG3 to be used as GPIO.




We were having the exact same problem - trying to use RG2/RG3 as inputs connected to dip switches as we were out of other pins. Symptoms were the the same.
 
Both inputs are now working correctly once VUSB3V3 was connected to VDD.
 
Thank you very much for the response.
#4
Jump to:
© 2019 APG vNext Commercial Version 4.5