Author Topic: Crystal oscillator with logic gates implemented on a PSoC chip - possible?  (Read 38030 times)

0 Members and 1 Guest are viewing this topic.

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #25 on: October 17, 2014, 08:05:12 am »
PSOC4 does have an internal oscillator as demonstrated in this thread. It just requires a digital block. The question is what is the maximum frequency. 4mhz seems to work but 48mhz is unlikely. If anybody can provide an elf file I have a huge collection of crystals and would be willing to test.

maximum frequency is 48MHz if no software control is needed. If software control then I can get 24 MHz if not exact 50% duty cycle is needed.  software control and 50% duty cycle the max will be 12MHz.

This is the PWM 1 period (0 and 1) and 1 count meaning half the input frequency gives. To make it truly 50% duty cycle I can only do 12MHz if software controlled. (Edit: by PWM)


Hardware set, you can get 48MHz.

Non PWM based and using a clock output pin, don't know yet, but should go to at least 24MHz if not the full 48MHz.

Edit: a clocked output pin is fully programmable by code I believe.
« Last Edit: October 17, 2014, 08:12:11 am by miguelvp »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #26 on: October 17, 2014, 08:15:17 am »
I also don't get why you mention that you have a huge collection of XTALs if you are asking about the internal oscillator.

If you mean external oscillators then the maximum allowed is 48MHz so same results other than maybe closer to 50% duty cycle without the flip flop and at full frequency.
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #27 on: October 17, 2014, 08:19:56 am »
There is some confusion here and I'm not sure if it's you or me. You are certainly more up to speed on PSOC4 than me. Correct me if I'm wrong.

We are discussing using a built in inverter with external crystal to implement and oscillator because the PSOC4 don't have a dedicated oscillator. I don't see where PWM, external oscillator, or any of these other things enter into it.
 

Online westfw

  • Super Contributor
  • ***
  • Posts: 4192
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #28 on: October 17, 2014, 08:30:45 am »
IIRC, the original question was whether you could use the configurable logic to implement TWO crystal oscillators for frequencies unlikely to be derivable from a single reference.
We seem to have gotten a bit off track...
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #29 on: October 17, 2014, 08:34:15 am »
There is some confusion here and I'm not sure if it's you or me. You are certainly more up to speed on PSOC4 than me. Correct me if I'm wrong.

We are discussing using a built in inverter with external crystal to implement and oscillator because the PSOC4 don't have a dedicated oscillator. I don't see where PWM, external oscillator, or any of these other things enter into it.

The PSoC 4 has a 48 MHz internal oscillator built in with +-2% accuracy.

You can also feed and external clock up to 48MHz on pin 0_6 to drive the chip without using the internal oscillator.

You can't drive an external crystal directly but it will take an external oscillator up to 48 MHz at only 1MHz increments.

You can use an output pin as a driving clock that is fully programmable and you can change the frequency using the internal or external oscillators with 16 bits counters and dividers so you should be able to achieve any target clock you wish.

It also has lower frequency clocks on the 32.768 KHz fixed range for an external low frequency clock, aimed at a precision timer. the built in low frequency clock has a lot of error but can be trimmed to a +- 10%.

I have yet to play with the analog outputs or the derived internal digital clocks.

And to answer westfw, the answer is no, it only takes a single high frequency oscillator but you can't drive a crystal directly. Unless the clock driven output works then maybe it can drive an external crystal directly without the need of an oscillator.

Edit: but if the external oscillator is accurate enough, you can derive internal clocks from that, I believe up to 8 or 16 clocks can be derived, will have to look at the details, but definitely can derived 2 clocks from the main clock.
« Last Edit: October 17, 2014, 08:41:19 am by miguelvp »
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #30 on: October 17, 2014, 08:43:29 am »
IIRC, the original question was whether you could use the configurable logic to implement TWO crystal oscillators for frequencies unlikely to be derivable from a single reference.
We seem to have gotten a bit off track...

I'm not sure who "we" are but that is exactly the subject I was on. The impression was OP had solved his problem with the diagram he posted. All this talk of flops and PWM had little to do with it. I'm curious how high the digital block inverter can oscillate. Not very with that series resistor miguel and dannyf like to tack on. I'd be surprised if the oscillator worked at 48mhz let alone with ANY resistor in there. On the other hand OPs circuit looked ok to me.

As far as using the internal RC clock 10% or 1% ain't going to get you 5.441 MHz & 5.510 MHz needed by OP. You will be a couple orders of magnitude off.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #31 on: October 17, 2014, 08:58:25 am »
The OP has not solved the issue.

The OP question was if the internal logic of the UDBs in the PSoC or the fabric in FPGAs don't act the same as the real thing, and by the real thing he meant a hardware NAND gate.
The answer to that is NO on the PSoC4, yes on the rest of the PSoC series at least on the 5LP as PA0PBZ demonstrated.

So the remaining issues are, can we achieve those frequencies with an external/internal oscillator? I don't know, only played briefly and got 6.024MHz but it's almost 4am so it's past my bed time (I do have to go to work tomorrow).

I'll wait for the OP to see if the clock driving output works with a not gate, that might work but I doubt it.

Till then there is an alternative to use the internal oscillator.
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #32 on: October 17, 2014, 09:10:07 am »
The OP has not solved the issue.

Based on his diagram and scope trace I thought he had. So you are saying that he did not use one of the digital block NAND gates? This is disappointing. Any MCU that cannot function with an external crystal is severely handicapped. One can generally purchase 20-30 crystals for the cost of an oscillator. This ratio is pretty consistent whether custom or standard frequencies.

The RC internal oscillator is not even close to accurate enough for frequencies mentioned in post #1.
« Last Edit: October 17, 2014, 09:11:45 am by paulie »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #33 on: October 17, 2014, 09:19:10 am »
Scope trace is not the OP. It's someone using a PSoC 5LP based dev kit, the OP is using a PSoC 4.

The thing is that using these dividers: 7429 & 7523 using the internal 48MHz clock the OP could acheive 5.441162109375 Mz and 5.51 MHz by using the built in frequency dividers Edit: +- 2%

The PSoC CAN function with an external crystal, the OP wanted the PSoC to drive the crystal directly to make it oscillate. I think you should read the thread more carefully. Edit: what MCU can be used as a NAND gate or NOT gate to drive the crystal directly?

The original question is if one could use the programmable UDBs or FPGAs blocks to substitute a real hardware NAND gate. The answer is yes on the PSoC 5LP. That doesn't mean you can't feed an external clock, he wants the MCU to generate the clock by hooking it to a couple of pins in the MCU. So probably not since there is internal fabric.

Someone is confused and it's not me, and I've been drinking wine and it's past 4 am ;)

« Last Edit: October 17, 2014, 09:34:00 am by miguelvp »
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #34 on: October 17, 2014, 09:33:16 am »
using the internal 48MHz clock the OP could acheive 5.441162109375 Mz and 5.51 MHz by using the built in frequency dividers Edit: +- 2%

LOL. Apparently we are using different definitions of accuracy and/or percent.

The PSoC CAN function with an external crystal, the OP wanted the PSoC to drive the crystal directly to make it oscillate. I think you should read the thread more carefully.

"can function" but needs to  "drive the crystal"? Not sure what use a crystal is without oscillation. I've read that several times and still makes no sense at all.

Someone is confused and it's not me, and I've been drinking wine and it's past 4 am

Hooo...kay.... That explains a lot.

Anyway it's bad news if PSOC4 cannot make use of an external crystal. Hard to tell because your last comment and your outside link are in direct conflict. Out of more than a dozen other ARM chips recently toyed around with none were missing this capability. Many apps cannot tolerate 2% accuracy. Makes one question the utility of this part. Particularly in view of the cost.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #35 on: October 17, 2014, 09:39:07 am »
What MCU can you use to hook a crystal directly to a couple of pins and put a NOT or NAND gate within the pins internal to the MCU? as in programmable within the MCU

That's what the OP wants to achieve.

Please post a link to such MCU instead of doing this roundabout.

Edit: oscillator and oscillation are different things, the first is just the crystal, the second is already generating the signal that the PSoC 4 can use in pin P0.6
« Last Edit: October 17, 2014, 09:44:09 am by miguelvp »
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #36 on: October 17, 2014, 09:48:38 am »
What MCU can you use to hook a crystal directly to a couple of pins and put a NOT or NAND gate within the pins internal to the MCU? as in programmable within the MCU

Virtually ALL devices have a "not" gate (we call them inverters) between two pins. It's called crystal oscillator feature. Whether PSOC4 can achieve similar capability using a digital block is in question. If so then it's not totally crippled and I would be curious if it can function at similar frequencies. Obviously this is not going to be answered here anytime soon. I'll just follow the thread and see what falls out.

Get something to eat and rest and maybe we can discuss this with better result later. meanwhile I gotta go to work too.

 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #37 on: October 17, 2014, 09:55:11 am »
oscillator and oscillation are different things, the first is just the crystal, the second is already generating the signal

Not sure what use a crystal is without oscillation. I've read that several times and still makes no sense at all.

Get something to eat and rest and maybe we can discuss this with better result later.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #38 on: October 17, 2014, 03:10:42 pm »
Quote
Simply make a frac-n synthesizer in the psoc. All you need is an accumulator and two registers. a 16 bit accumulator should do nicely for what you need. no doubt the psoc has that on board.

Then implemented it yourself and report back.
================================
https://dannyelectronics.wordpress.com/
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #39 on: October 17, 2014, 05:40:49 pm »
\Anyway it's bad news if PSOC4 cannot make use of an external crystal. Hard to tell because your last comment and your outside link are in direct conflict. Out of more than a dozen other ARM chips recently toyed around with none were missing this capability. Many apps cannot tolerate 2% accuracy. Makes one question the utility of this part. Particularly in view of the cost.

Even if it can't use an external crystal it can use an external clock of up to 48MHz on P0.6, I just don't see what the big deal is on using internal resources and consuming 2 pins vs driving the crystal externally and using just one pin instead, if you want a more stable CPU clock.
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #40 on: October 17, 2014, 07:11:01 pm »
I'm well aware of the difference between an external oscillator and an internal oscillator with crystal as can be seen by reading posts carefully:

Any MCU that cannot function with an external crystal is severely handicapped. One can generally purchase 20-30 crystals for the cost of an oscillator.

Two external oscillators as required here would cost several times more than the chip itself (and these chips are not cheap). So you can say it's no big deal and for you and others to whom cost is no object this may be true. For the rest of the world lack of an internal crystal oscillator actually is a big deal.

Personally I would be curious to know if Crystal oscillator with logic gates implemented on a PSoC chip is possible and how high it can go. It don't look like anyone here has the ability or motivation to investigate.

Don't bother bringing up the internal RC again. It won't work for this application and many others. No need for more "roundabout". I think with clear head in the cold light of day you may be finally getting my point. If not it may be a good idea as you hinted to going back a few posts and review. I did and it was quite entertaining. :)
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #41 on: October 17, 2014, 08:53:40 pm »
I really don't think a transistor is going to cost as much as 19-29 crystals.

https://www.google.com/search?q=single+transistor+crystal+oscillator+circuit+diagram&tbm=isch

Those will give you 100 ppm accuracy timing.

As for the other clocks you can bring them in and use them, the P0.6 is just for driving the system clock, that doesn't prevent you from using GPIOs to input and use other clocks.

Also with an external 42MHz clock you can use a clock divider to get the 5.441MHz with a 7+23/32 divider
then derive a 26Mhz clock from the 42MHz one, and then use 4+23/32 to obtain the 5.510MHz clock. You have 12 16 bit clock dividers built in.
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #42 on: October 17, 2014, 09:20:53 pm »
Not surprising those outside the manufacturing industry underestimate production costs. Even if it were only one transistor (which it is not) that would still cost significantly more than a crystal. I won't bore you with details about per hole cost and commodity availability or the technical issues that arise.

So let's just agree to disagree. Admittedly those with romantic attachments and/or hobby interest only suffer less embracing these band aid fixups. If or when I ever setup for PSOC4 again one of the first things worth investigating is to see if Crystal oscillator with logic gates can be implemented. And how fast it can spin.

So for me no crystal slips PSOC a little further down the list. Sort of like TINY13 did when similar deficiency arose. It didn't slip as far though costing just pennies instead of dollars. They are both interesting devices.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #43 on: October 18, 2014, 03:25:38 am »
The other PSoC families don't have that limitation.
 
As for the extra cost, you already need the caps and resistors so yeah, it's just a transistor to do your inverter and you free up a pin, and the transistor can be a surface mount one, exaggerating to 30 times the cost is what causes confusion to begin with.

Maybe I'm wrong and you can really purchase 29 Xtals for 5 cents.
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #44 on: October 18, 2014, 05:46:48 am »
Looks like you have confused my comment about commercial oscillators costing 20-30 times more than crystals with mine about your transistor CIRCUITS costing "significantly more". You need to read these posts more carefully. I found them worth reviewing if only for entertainment value.

Anyway it's not so much component cost which is quite huge for the circuits you linked but also technical details like the fact there is no chance of operation at 48mhz or even a lot less. Not without multiple transistors and inductors. Believe it or not those internal inverters are more than an NPN and resistor. I might suggest you search for schematics of off the shelf 4 pin oscillators. Highly educational for none hardware experts.

Although it's not what I said it wouldn't be a surprise to see cost actually end up 20-30x more than a crystal. FYI those crystals run about 2-2.5 cents for standard frequencies 12mhz or over. Below that a little more. Below 2mhz they get quite expensive.

ps. Personally I would like is to see if Crystal oscillator with logic gates can be implemented in PSOC4. Although it would chew up a chunk of those valuable digital blocks it would be a more effective solution.
« Last Edit: October 18, 2014, 05:54:03 am by paulie »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #45 on: October 18, 2014, 06:17:59 am »
I already linked this:

http://www.cypress.com/?rID=37884

It only applies to PSoC 3, 5 & 5LP. So nope it won't work on the 4, it only allows external clocks. The datasheet has no mention on hooking crystals directly unlike the datasheets for the other chips. If it works by doing some configuration changes then it's a fluke they are not designed to work that way.

I wouldn't go as far as making my own OCXO like this blog
http://romanblack.com/xoven.htm

But getting something at 100ppm even by using his existing 74AUP1G00 chips (surface mount NAND gates) that he already has them running will feed those clocks just fine.
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #46 on: October 18, 2014, 06:37:54 am »
So we are graduating to integrated circuits now. Closer but still no cigar. Certainly not cheaper than a transistor. You will probably eventually revolve back to commercial oscillators but again that ugly cost issue rears it's ugly head.

Sorry but when you poked that 1.5k series resistor into your diagram it pretty much revealed the status as a hardware designer. At least it was a major improvement over dannyfs 470k. LOL. Those are a great benefit for ultra low power and ultra low frequency watch crystal circuits but will stop oscillation dead at HF.

The internet is filled with expert advice that unfortunately describes how someone THINKS it should work rather than actually does. Probably not wise to believe everything I say either but maybe this discussion will motivate viewers to research the subject on their own.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #47 on: October 18, 2014, 07:35:47 am »
It's not my diagram, I took the OP's design and changed the pin characteristics, didn't bother to retouch the off chip elements since my point was how to output a clock on the PSoC 4.

Edit, Not sure why you have to bring out dannyf now, well, you got issues I guess :)
« Last Edit: October 18, 2014, 07:40:18 am by miguelvp »
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #48 on: October 19, 2014, 02:33:07 am »
LOL. Yes there do seem to be issues but maybe not so much from this direction. For unknown reason dannyf jumped on me during my very first post in this forum and several more attacks in my $1 thread. I understand there are personality types but really don't mind because as I said some of these threads get very entertaining.

Anyway let's not deflect from the main point which is some of these suggestions and diagrams have no chance of working. Worth mentioning as a public service to maybe save some tail chasing for those who are not "experts".

BTW it was PA0PBZ not OP that put up a correct oscillator diagram and scope trace in reply #16. It appears to be implemented in a PSOC and would be interesting to see what frequency is possible. This is what I referred to when offering to check with my rather large collection of crystals. Interesting that post was pretty much ignored in favor of "personality" discussions.

 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #49 on: October 19, 2014, 02:54:17 am »
On post #4 i mentioned that I wasn't sure you could drive the crystal directly because  AN54439 showing how, only referred to PSoC 3, 5 & 5LP.

PA0PBZ tried it on his Cy8KIT-50 and got it to work, but that's because it's a 5LP, so when he showed his proof on post #16 I did reply on post #17 that the 5LP has different capabilities than the PSoC 4. and that it does allow the use of using an external crystal oscillator.

The PSoC can output clocks with some pin configuration settings but the datasheet doesn't show any support to drive a XTAL directly (unlike PA0PBZ's Cy8KIT-50 that has a 5LP).

Best bet is to use his NAND gates or use an external gate inverter, that are cheap anyways.

So the skinny is that the PSoC 4, that they OP is trying to use, can't do it because the datasheet doesn't even mention it unlike the other PSoC families.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf