View previous topic :: View next topic |
Author |
Message |
akohlsmith
Joined: 25 Apr 2012 Posts: 26
|
[solved] 24F32KA304 RA3 and RA4 stuck low? |
Posted: Wed Aug 15, 2012 3:13 pm |
|
|
Another question regarding this device... I have most of the GPIO working, and the peripherals (ADC, SPI, UART) are also working. RA3 and RA4 are being used for GPIO but I don't seem to be able to get them to do what I'd like.
I'm using the regular output_high() to set them high, but they stay low. Neither are open-collector, and I have verified that I didn't accidentally configure RA3 for its analog function. I notice that both these pins share OSCO features, one for the primary oscillator and one the secondary.
As far as I am able to determine I have this secondary function disabled. OSCIO is the fuse for the primary oscillator, but I don't see a specific fuse for the secondary. I have clock switching disabled and as a precaution I have also tried setting the secondary oscillator mode to digital, but both RA3 and RA4 seem to be quite happy to stay at logic 0.
Is there something obvious I'm missing which would allow me to gain use of these pins?
Last edited by akohlsmith on Wed Aug 22, 2012 3:26 pm; edited 1 time in total |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Wed Aug 15, 2012 3:28 pm |
|
|
Post a short complete compilable code which shows us exactly what you're doing.
Then we can test it.
Mike
EDIT.
Don't forget compiler version. |
|
|
akohlsmith
Joined: 25 Apr 2012 Posts: 26
|
|
Posted: Wed Aug 22, 2012 11:38 am |
|
|
Sorry for the late update. I feel it's important to "close" the thread so that others may find some help in the future.
It appears that set_adc_channel() and/or read_adc() will override the pin configs, and I was using the sANx defines instead of the channel number for set_adc_channel(), which could have been buggering up things on the port configuration pretty good. |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Wed Aug 22, 2012 2:54 pm |
|
|
I suggest you edit your initial post to include "solved" in the heading.
That way we all can see it's closed without even looking.
Mike |
|
|
akohlsmith
Joined: 25 Apr 2012 Posts: 26
|
|
Posted: Fri Aug 24, 2012 2:09 pm |
|
|
And for the final bit of info I've learned:
Code: | #fuses NOIESO
#fuses SOSC_DIGITAL |
Is most certainly required to enable RA3/RA4. #use delay() sets up the PLL/drive strength/osc configuration correctly, but those two #fuses lines are what actually enable RA3/RA4 for I/O (as opposed to oscillator output/driver function). |
|
|
|