• AVR Freaks

Helpful ReplyHot!PIC24FJ64GA702 -- No output on pin RA4

Author
user2x
Super Member
  • Total Posts : 352
  • Reward points : 0
  • Joined: 2011/02/10 20:43:36
  • Location: 0
  • Status: offline
2019/11/10 18:52:55 (permalink)
0

PIC24FJ64GA702 -- No output on pin RA4

I just cannot get any GPIO output on pin 
 
SOSCO/PWRLCLK/RA4.
 
The pin remains at 0V. it is not shorted to anything.
 
I have narrowed the code down to:
 

 
ANSA = 0;
LATA = 0xffff;
 
while(1)
{
  TRISA = 0xffff;
  TRISA = 0x0000;
}
 

 
I am suspecting something else is driving this pin.
 
There is the SOSCO funtion controlled by config bits in FOSC.
 
The device config doc states:

 











OSCIOFCN = ONOSC2 is general purpose digital I/O pin
OSCIOFCN = OFFOSC2 is clock output

 

 
But the DS states the opposite (I think)

 
OSCIOFCN: CLKO Enable Configuration bit
1 = CLKO output signal is active on the OSCO pin (when the Primary Oscillator is disabled or configured
for EC mode)
0 = CLKO output is disabled
 

 
Anyway, I have tried both ways and there is not change.
 
What else can this possibly be?
 
Regards
X
 
 
 
 
post edited by user2x - 2019/11/10 19:46:13
#1
ric
Super Member
  • Total Posts : 24638
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: PIC24FJ64GA702 -- No output on pin RA4 2019/11/10 19:05:11 (permalink)
0
#1. You are assuming that "ON" means "1", and "OFF" means "0".
This is most certainly NOT true when you are talking about #pragma config lines.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#2
user2x
Super Member
  • Total Posts : 352
  • Reward points : 0
  • Joined: 2011/02/10 20:43:36
  • Location: 0
  • Status: offline
Re: PIC24FJ64GA702 -- No output on pin RA4 2019/11/10 19:16:54 (permalink)
0
Either way, it does not work as IO.
 
In addition, I also cannot get that pin to work as input.
 
There has to be something else that must be set or disabled. I cannot find it.
 
 
#3
user2x
Super Member
  • Total Posts : 352
  • Reward points : 0
  • Joined: 2011/02/10 20:43:36
  • Location: 0
  • Status: offline
Re: PIC24FJ64GA702 -- No output on pin RA4 2019/11/10 19:32:37 (permalink)
0
Just looking at the 3rd function of this pin = PWRLCLK.
 
I cannot find anywhere if this needs to be disabled and if so, how.
 
I am out of ideas on this one.
 
post edited by user2x - 2019/11/10 19:45:16
#4
ric
Super Member
  • Total Posts : 24638
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: PIC24FJ64GA702 -- No output on pin RA4 2019/11/10 19:42:40 (permalink)
0
Maybe because you mispell the name.
PWRLCLK not PWRCLK

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#5
user2x
Super Member
  • Total Posts : 352
  • Reward points : 0
  • Joined: 2011/02/10 20:43:36
  • Location: 0
  • Status: offline
Re: PIC24FJ64GA702 -- No output on pin RA4 2019/11/10 19:44:53 (permalink)
0
No not because of that.
 
But I did fix it here further up.
 
post edited by user2x - 2019/11/10 19:46:46
#6
dan1138
Super Member
  • Total Posts : 3290
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re: PIC24FJ64GA702 -- No output on pin RA4 2019/11/11 14:42:58 (permalink)
4 (1)
The behavior of RA4 is controlled by bits in the configuration words that select the secondary oscillator (enabled by default), the RTCC clock input selector and perhaps the ANSELA register.

I mention the ANSELA register even though the data sheet says that the ANSELA register does not contain a bit for RA4 I have found that some controllers in the PIC24F family have active bits in these registers even when the data sheet say not.

If you could post a complete example showing all of the configuration words and clock setups with RA4 failing to act as an input or output it would help.
#7
user2x
Super Member
  • Total Posts : 352
  • Reward points : 0
  • Joined: 2011/02/10 20:43:36
  • Location: 0
  • Status: offline
Re: PIC24FJ64GA702 -- No output on pin RA4 2019/11/12 17:36:38 (permalink)
0
Well, yes, it appears that it is. But there is no way to figure that out from the DS.
 
What is needed is: 
#pragma config SOSCSEL = OFF            // SOSC Power Selection Configuration bits (Digital (SCLKI) mode)
 
The default is on. But nowhere can one see that this actually controlling or changing the RA4 operation. Or at least, I was not able to find that.
post edited by user2x - 2019/11/12 18:06:20
#8
ric
Super Member
  • Total Posts : 24638
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: PIC24FJ64GA702 -- No output on pin RA4 2019/11/12 17:45:53 (permalink)
0
I never trust "default" settings for CONFIG bits.
Just set ALL of them how you require, and you won't get caught by unexpected "default" values.
DEBUG is the only one you should leave unset, as you cannot set it manually anyway.

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#9
Antipodean
Super Member
  • Total Posts : 1778
  • Reward points : 0
  • Joined: 2008/12/09 10:19:08
  • Location: Didcot, United Kingdom
  • Status: online
Re: PIC24FJ64GA702 -- No output on pin RA4 2019/11/13 07:25:29 (permalink) ☄ Helpfulby mpgmike 2019/11/13 09:18:27
5 (1)
user2x
Well, yes, it appears that it is. But there is no way to figure that out from the DS.
 

 
Umm, yes there is.
 
In your first post you note that the pin is "SOSCO/PWRLCLK/RA4". If you haven't already picked up that the Microchip convention is that pins work from the left hand function to the right hand function as the pin priority of functions, then now is the time to learn this.
 
So SOSCO is the highest priority, and therefore the default function for this pin, so you need to find out how to disable that.
 

 


Do not use my alias in your message body when replying, your message will disappear ...

Alan
#10
user2x
Super Member
  • Total Posts : 352
  • Reward points : 0
  • Joined: 2011/02/10 20:43:36
  • Location: 0
  • Status: offline
Re: PIC24FJ64GA702 -- No output on pin RA4 2019/11/13 13:34:28 (permalink)
5 (1)
I know that.
But the ONLY reference in the DS regarding oscillator and port pin operation that I could find was
that #pragma config OSCIOFN = ON.
 
And I had done that. The rest was not identifiable.
 
Fact that nobody commented the actual solution supports the lack of this knowledge.
 
 
post edited by user2x - 2019/11/13 13:35:32
#11
dan1138
Super Member
  • Total Posts : 3290
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re: PIC24FJ64GA702 -- No output on pin RA4 2019/11/14 01:32:05 (permalink)
0
user2x
I know that.
But the ONLY reference in the DS regarding oscillator and port pin operation that I could find was
that #pragma config OSCIOFN = ON.
 
And I had done that. The rest was not identifiable.
 
Fact that nobody commented the actual solution supports the lack of this knowledge.

It seems that you have reached the limits of your experience and knowledge.
 
The configuration word setting controlled by #pragma config OSCIOFN = ON has no affect on the SOSC use of RA4.
 
The data sheet for the PIC24FJ64GA702 does a very bad job in explaining how to set up the primary and secondary oscillators.
 
If you would take the time to describe in short sentences what you would like to see RA4 do I can post a complete example of a C language program that compiles using XC8 v2.05.
 
Please describe the target circuit you would use for testing:
  • Do you want to use the internal Fast RC (8MHz)?
  • Do you want to use the primary crystal oscillator? If so what frequency?
  • Do you want to use the 96MHz PLL to make the PIC24FJ64GA702 execute at 16 MIPS?
  • Do you want yo use the 4x, 6x, 8x PLL to make the PIC24FJ64GA702 execute at 16 MIPS?
  • Do you want any of the features mapped by the PPS selected on specific PORT pins?
If you would care to answer the above questions it would allow me to make a more relevant example.
#12
Jump to:
© 2019 APG vNext Commercial Version 4.5