| View previous topic :: View next topic |
| Author |
Message |
lucasromeiro
Joined: 27 Mar 2010 Posts: 167
|
| PLEASE HELP-ME |
Posted: Wed Nov 21, 2012 8:14 pm |
|
|
PLEASE HELP-ME
DONT WORK |
|
 |
andrewg
Joined: 17 Aug 2005 Posts: 316 Location: Perth, Western Australia
|
|
Posted: Wed Nov 21, 2012 11:53 pm |
|
|
I am currently working on a project using an 18F67K22, including the RTC function. I'm using an external 32.768kHz crystal, with 15pF load caps. They're probably a bit big, but everything is working OK.
The relevant fuses I've used are: SOSC_LOW and RTCOSC_T1. According to the data sheet, SOSC_HIGH is the preferred option over SOSC_LOW as it is compatible with more crystals and provides a generally more reliable operation.
Start with SOSC_HIGH and RTCOSC_T1 first.
Apart from that I just called "setup_rtc(RTC_ENABLE, 0)" and off it went. According to a GPS reference my clock is 60ppm off, well within calibration correction range.
Apart from that, make sure your power supply is stable and clean. You should have 0.1uF bypass caps everywhere VDD and VSS come out of the chip (i.e. five - one on each side, plus I have one on the AVDD and AVSS).
The tracks between the crystal and micro must be *short* and should have a ground guard ring. See "2.6 External Oscillator Pins" in the data sheet, and also the Application Notes referred to there as well.
HTH,
Andrew _________________ Andrew |
|
 |
lucasromeiro
Joined: 27 Mar 2010 Posts: 167
|
|
Posted: Thu Nov 22, 2012 5:29 am |
|
|
| andrewg wrote: | I am currently working on a project using an 18F67K22, including the RTC function. I'm using an external 32.768kHz crystal, with 15pF load caps. They're probably a bit big, but everything is working OK.
The relevant fuses I've used are: SOSC_LOW and RTCOSC_T1. According to the data sheet, SOSC_HIGH is the preferred option over SOSC_LOW as it is compatible with more crystals and provides a generally more reliable operation.
Start with SOSC_HIGH and RTCOSC_T1 first.
Apart from that I just called "setup_rtc(RTC_ENABLE, 0)" and off it went. According to a GPS reference my clock is 60ppm off, well within calibration correction range.
Apart from that, make sure your power supply is stable and clean. You should have 0.1uF bypass caps everywhere VDD and VSS come out of the chip (i.e. five - one on each side, plus I have one on the AVDD and AVSS).
The tracks between the crystal and micro must be *short* and should have a ground guard ring. See "2.6 External Oscillator Pins" in the data sheet, and also the Application Notes referred to there as well.
HTH,
Andrew |
HI Andrew,
I understood their explanations, I'll try to do that today.
Here could post the code you used to make the external clock work perfectly?
My internal functions normally, but when I switch to the external, nothing happens, everything is stopped. As if no crystal pin.
Could you post your code here? Something simple that works, I may be missing in other FUSES, so I want to compare your code with mine etc.
Because I tried EVERYTHING and not incremented [spam] RTC. As if disabled.
PLEASE HELP ME |
|
 |
lucasromeiro
Joined: 27 Mar 2010 Posts: 167
|
| HEPLP !!!!!!!!!!!!! |
Posted: Thu Nov 22, 2012 11:49 am |
|
|
not yet succeeded. = (
Can someone help me?
If someone has a basic code that works, please send me! |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Nov 22, 2012 12:37 pm |
|
|
1. Post your CCS compiler version. It's given at the top of the .LST file,
which will be in your project directory after a successful compile.
It's a number in this format:
http://www.ccsinfo.com/devices.php?page=versioninfo
2. Post the manufacturer and part number of your 32.768 KHz watch
crystal. Post a link to the website where you bought it.
3. Using a camera, take a photograph of the PIC circuit on your board.
We need to see the area of the circuit with the 32.768 KHz watch crystal.
Make sure the photo is in focus and has good brightness. Then post the
photo on a free image hosting service and post a link to it here on the forum. |
|
 |
lucasromeiro
Joined: 27 Mar 2010 Posts: 167
|
| TKS for HELP |
Posted: Thu Nov 22, 2012 1:36 pm |
|
|
| PCM programmer wrote: | 1. Post your CCS compiler version. It's given at the top of the .LST file,
which will be in your project directory after a successful compile.
It's a number in this format:
http://www.ccsinfo.com/devices.php?page=versioninfo
2. Post the manufacturer and part number of your 32.768 KHz watch
crystal. Post a link to the website where you bought it.
3. Using a camera, take a photograph of the PIC circuit on your board.
We need to see the area of the circuit with the 32.768 KHz watch crystal.
Make sure the photo is in focus and has good brightness. Then post the
photo on a free image hosting service and post a link to it here on the forum. |
Hi PCM programmer,
my version is: V: 4.134
have a good time we bought the crystal, but I believe it is this:
http://www.farnellnewark.com.br/cristaloscilador32768000khz,product,9509690,4443946.aspx
The images:
http://imageshack.us/photo/my-images/842/201211220007.bmp/
http://imageshack.us/photo/my-images/705/201211220014.bmp/
observations:
I tested continuity between the crystal pins and the pins of the pic. all OK
I tested with oscilloscope generated if the crystal frequency and generates no (logical level is high) on both pins.
Note that I'm not using capacitors, already tested them and nothing changed.
've tried to ground the carcass of the crystal and nothing worked
Already swapped crystal several times and nothing worked
already swapped board with all components and nothing worked.
Using the internal oscillator works perfectly, but the accuracy is poor in 12 hours a plaque delays another 1 hour and 15 minutes advance.
So I believe that is the problem or FUSE configuration.
Need a configuration code, I've tried everything I found, of all shapes and did not work.
Please help me! |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Nov 22, 2012 2:11 pm |
|
|
Post the manufacturer and part number of your board. Also post a link
to the webpage for the board. |
|
 |
lucasromeiro
Joined: 27 Mar 2010 Posts: 167
|
|
Posted: Thu Nov 22, 2012 2:31 pm |
|
|
| PCM programmer wrote: | Post the manufacturer and part number of your board. Also post a link
to the webpage for the board. |
The board did myself.
everything works normally, nothing special. |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Nov 22, 2012 2:47 pm |
|
|
But the photos show traces connected to the pins on the 18F67K22
that you are using for the crystal. Where do these traces go ?
What external circuits or components are connected to the traces ?
I see the traces leave the edge of the photo. Where do they go ? |
|
 |
lucasromeiro
Joined: 27 Mar 2010 Posts: 167
|
|
Posted: Thu Nov 22, 2012 2:56 pm |
|
|
| PCM programmer wrote: | But the photos show traces connected to the pins on the 18F67K22
that you are using for the crystal. Where do these traces go ?
What external circuits or components are connected to the traces ?
I see the traces leave the edge of the photo. Where do they go ? |
I'm using the pins c0 and c1 to connect the crystal
as other connections are connecting lcd, font, etc..
The pic works normally and everything happens as expected.
But the RTC function shall not work with external clock.
I can not show the entire plate to be a commercial project. there is what I can show.
The rest is all right. the problem is the same external crystal for the internal RTC.
somehow this is not working.
Really think it's software problem |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Nov 22, 2012 2:59 pm |
|
|
I don't want the entire board or schematic. I want to know where do
those two traces go ? Are they connected to other devices or components
that are loading down the circuit so the crystal does not oscillate ?
You did not answer that question. |
|
 |
lucasromeiro
Joined: 27 Mar 2010 Posts: 167
|
|
Posted: Thu Nov 22, 2012 3:05 pm |
|
|
| PCM programmer wrote: | I don't want the entire board or schematic. I want to know where do
those two traces go ? Are they connected to other devices or components
that are loading down the circuit so the crystal does not oscillate ?
You did not answer that question. |
sorry, forgot to answer this question.
these tracks went for 2 leds but they were cut for place a crystal. |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Nov 22, 2012 3:43 pm |
|
|
| Quote: | | set_tris_c(0b10111001); |
I notice that you have this line in your posted code snippets. The SOSC
oscillator uses pins C0 and C1. You have pin C1 set as an output.
I can't find anywhere in the PIC data sheet that says to do this.
Maybe you should leave both pins as inputs.
In your code snippets, you have this line above.
But the 18F67K22 data sheet says to use SOSC_HIGH.
See the data sheet statements below:
| Quote: |
14.5 SOSC Oscillator
The SOSC crystal oscillator drive level is determined
based on the SOSCSEL<1:0> (CONFIG1L<4:3>) Configuration
bits. The Higher Drive Level mode,
SOSCSEL<1:0> = 11, is intended to drive a wide variety
of 32.768 kHz crystals with a variety of Capacitance
Load (CL) ratings.
|
|
|
 |
lucasromeiro
Joined: 27 Mar 2010 Posts: 167
|
|
Posted: Thu Nov 22, 2012 3:48 pm |
|
|
| PCM programmer wrote: | | Quote: | | set_tris_c(0b10111001); |
I notice that you have this line in your posted code snippets. The SOSC
oscillator uses pins C0 and C1. You have pin C1 set as an output.
I can't find anywhere in the PIC data sheet that says to do this.
Maybe you should leave both pins as inputs.
In your code snippets, you have this line above.
But the 18F67K22 data sheet says to use SOSC_HIGH.
See the data sheet statements below:
| Quote: |
14.5 SOSC Oscillator
The SOSC crystal oscillator drive level is determined
based on the SOSCSEL<1:0> (CONFIG1L<4:3>) Configuration
bits. The Higher Drive Level mode,
SOSCSEL<1:0> = 11, is intended to drive a wide variety
of 32.768 kHz crystals with a variety of Capacitance
Load (CL) ratings.
|
|
I've done these 2 tests.
already commented the line: set_tris_c (0b10111001);
Have I put: SOSC_HIGH.
But nothing changed. |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Nov 22, 2012 4:04 pm |
|
|
I don't know if I can do anything more right now. Today is a holiday in
the U.S. Tomorrow morning, I could try to make it work in hardware.
I don't have your K22 series PIC, but I think I may have another PIC
that has SOSC and RTCC in it. I could try to make that work. But this
won't happen until tomorrow. |
|
 |
|