• AVR Freaks

Helpful ReplyProblem with 4-SMD Crystal / PIC16f1575

Author
LenHar
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2019/07/24 03:10:42
  • Location: 0
  • Status: offline
2019/09/10 05:39:21 (permalink)
0

Problem with 4-SMD Crystal / PIC16f1575

Hi, 
 
Im trying to work with 32Mhz 4-SMD Crystal. (ASX3F-32M-FA100A4) with two capacitors: 10pf (Attached Datasheet)
The IC i choosed is the PIC16f1575. And using MPLABX-IDE MCC
I performed the connection as in the pictures below.
 
When i select INTOSC in MCC everythings works fine, but if i change the selection INTOSC to ECH in MCC as at the picture below the IC doesnt work. 
 
its only LED blink code in main loop.
 
void main(void){
SYSTEM_Initialize();
INTCONbits.GIE = 1;INTCONbits.PEIE = 1;
while (1)
{LED_Toggle();__delay_ms(500);}}
 
1-) is there a wrong connection between pic and crystal?
2-) İs that crystal not suited for this usage?
3-) or something missing on the code?
 
thanks a lot.
 
Rest of the configuration Code; 
// CONFIG1
#pragma config FOSC = ECH // Oscillator Selection Bits->ECH, External Clock, High Power Mode (4-32 MHz); device clock supplied to CLKIN pin
#pragma config WDTE = OFF // Watchdog Timer Enable->WDT disabled
#pragma config PWRTE = OFF // Power-up Timer Enable->PWRT disabled
#pragma config MCLRE = ON // MCLR Pin Function Select->MCLR/VPP pin function is MCLR
#pragma config CP = ON // Flash Program Memory Code Protection->Program memory code protection is enabled
#pragma config BOREN = ON // Brown-out Reset Enable->Brown-out Reset enabled
#pragma config CLKOUTEN = ON // Clock Out Enable->CLKOUT function is enabled on the CLKOUT pin
// CONFIG2
#pragma config WRT = OFF // Flash Memory Self-Write Protection->Write protection off
#pragma config PPS1WAY = ON // PPSLOCK bit One-Way Set Enable bit->PPSLOCKED Bit Can Be Cleared & Set Once
#pragma config PLLEN = OFF // PLL Enable->4x PLL disabled
#pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable->Stack Overflow or Underflow will cause a Reset
#pragma config BORV = LO // Brown-out Reset Voltage Selection->Brown-out Reset Voltage (Vbor), low trip point selected.
#pragma config LPBOREN = OFF // Low Power Brown-out Reset enable bit->LPBOR is disabled
#pragma config LVP = OFF // Low-Voltage Programming Enable->High-voltage on MCLR/VPP must be used for programming
 
And Initialization;
 
void OSCILLATOR_Initialize(void)
{
// SCS FOSC; SPLLEN disabled; IRCF 8MHz_HF;
OSCCON = 0x70;
// TUN 0;
OSCTUNE = 0x00;
// SBOREN disabled; BORFS disabled;
BORCON = 0x00;
}
 
 

Attached Image(s)

#1
mbrowning
USNA79
  • Total Posts : 1797
  • Reward points : 0
  • Joined: 2005/03/16 14:32:56
  • Location: Melbourne, FL
  • Status: online
Re: Problem with 4-SMD Crystal / PIC16f1575 2019/09/10 11:33:28 (permalink)
+2 (2)
I guess you didn’t read the datasheet oscillator section where it’s spelled out that you have the option of external clock or internal clock. No crystal only options listed
#2
LenHar
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2019/07/24 03:10:42
  • Location: 0
  • Status: offline
Re: Problem with 4-SMD Crystal / PIC16f1575 2019/09/10 12:04:38 (permalink)
0
Thanks for reply. Does it mean i can use square wave oscillator instead of crystal?

If so, just want to ask for make it clear for me, does standart oscillators works too?

Can you advice me a component code?
#3
ric
Super Member
  • Total Posts : 28433
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: Problem with 4-SMD Crystal / PIC16f1575 2019/09/10 13:23:00 (permalink)
+1 (1)
LenHar
Thanks for reply. Does it mean i can use square wave oscillator instead of crystal?

Yes.
Observe the comment in your config settings:

#pragma config FOSC = ECH // Oscillator Selection Bits->ECH, External Clock, High Power Mode (4-32 MHz); device clock supplied to CLKIN pin


If so, just want to ask for make it clear for me, does standart oscillators works too?

Yes, anything that will provide a valid clock signal to the CLKIN pin.
 

Can you advice me a component code?

Anything that produces the right frequency, and sufficient voltage drive, will work.
"Sufficient voltage drive" means it obeys the normal voltage limits for a digital input on this chip. That's probably lower than 0.2Vss and higher than 0.8Vdd.
 

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!
#4
LenHar
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2019/07/24 03:10:42
  • Location: 0
  • Status: offline
Re: Problem with 4-SMD Crystal / PIC16f1575 2019/09/10 14:37:50 (permalink)
0
Thanks for your help. Most things have been clarified.
 
Datasheet tells "ECH - High power, 4-20 MHz" at sector 5.2.1.1 but MCC says "ECH - High power, 4-32 MHz"(attached picture) what am i missing, is it a situation that normally happens?
 
And by "Sufficient voltage drive" and "Anything that produces the right frequency", then we can use 3.3V oscillators for 5V PIC, right? (ofc, if we suply the oscillator with 3.3V)
 
#5
dan1138
Super Member
  • Total Posts : 3865
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re: Problem with 4-SMD Crystal / PIC16f1575 2019/09/10 15:13:02 (permalink)
+1 (1)
LenHar
Datasheet tells "ECH - High power, 4-20 MHz" at sector 5.2.1.1 but MCC says "ECH - High power, 4-32 MHz"
What am i missing, is it a situation that normally happens?

The information in the PIC16(L)F1574/5/8/9 data sheet DS40001782C, ©2016 Microchip Technology Inc. has conflicts.
 
On page 1 it states:
Operating Speed:
- DC – 32 MHz clock input
- 125 ns minimum instruction cycle
 
On page 287 table 27-7: CLOCK OSCILLATOR TIMING REQUIREMENTS it states:
 
OS01 FOSC External CLKIN Frequency DC  —    0.5 MHz  External Clock (ECL)
                                   DC  —    4   MHz  External Clock (ECM)
                                   DC  —   20   MHz  External Clock (ECH)
OS02 TOSC External CLKIN Period    50  —   inf.  ns  External Clock (EC)
OS03 TCY Instruction Cycle Time    200 TCY  DC   ns  TCY= 4/FOSC
 
Something is wrong, what is specified on page 1 is contradicted on page 287.
 
If you care you, get the Microchip technical support to resolve this for you.
#6
ric
Super Member
  • Total Posts : 28433
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: Problem with 4-SMD Crystal / PIC16f1575 2019/09/10 15:16:52 (permalink) ☄ Helpfulby LenHar 2019/09/10 15:20:55
+1 (1)
LenHar
Datasheet tells "ECH - High power, 4-20 MHz" at sector 5.2.1.1 but MCC says "ECH - High power, 4-32 MHz"(attached picture) what am i missing, is it a situation that normally happens?

MCC is wrong.
The specifications page at TABLE 27-7 makes clear that the maximum external clock input is 20MHz.
(There is also an incorrect reference to external 32MHz under "5.1 Overview".)
The only way to get 32MHz from an external clock is to input 8MHz and pass it through the 4x PLL.
 
 

And by "Sufficient voltage drive" and "Anything that produces the right frequency", then we can use 3.3V oscillators for 5V PIC, right? (ofc, if we suply the oscillator with 3.3V)

Wrong.
If the PIC is supplied with 5V, then "0.8Vdd" is 4V, so your 3.3V oscillator will never get high enough.
 

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!
#7
LenHar
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2019/07/24 03:10:42
  • Location: 0
  • Status: offline
Re: Problem with 4-SMD Crystal / PIC16f1575 2019/09/10 15:23:01 (permalink)
0
it's all clear now.
 
Thank you for your interest. :)
#8
ric
Super Member
  • Total Posts : 28433
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: Problem with 4-SMD Crystal / PIC16f1575 2019/09/10 15:32:50 (permalink) ☄ Helpfulby LenHar 2019/09/11 00:19:34
+1 (1)
Disclaimer.
I don't KNOW that a 32MHz clock input doesn't work.
I'm trusting specifications OS01 and OS03 in the datasheet, which both specify a 20MHz limit.
There are enough mentions of 32MHz input elsewhere to cast a bit of doubt on this.
I suspect the reality is that 20MHz  will work for a signal that only just meets the other requirements (i.e. 20% and 80% of Vdd), but a good quality rail-to-rail 32MHz input will probably also work fine.
 
However, it's just as easy to feed in 8MHz and use the PLL if you require a high precision clock or external synchronisation. If a 1% accurate clock is sufficient, use the internal one.

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
Jump to:
© 2020 APG vNext Commercial Version 4.5