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

0 Members and 1 Guest are viewing this topic.

Offline randsl

  • Contributor
  • Posts: 40
Hi,

For a project I need a small microcontroller (to add a LCD + some buttons, ADC to read some analog inputs, to do some calculations), two crystal oscillators with some odd frequency (5.441 MHz & 5.510 MHz) and some logic gates & flip flops to implement a state machine.

I thought to use a PSoC chip from Cypress and based on their description everything what I need is available on the chip except two crystals. The two oscillators have to be crystal ones, need stable & low cost solution....

I gave try to implement the following crystal oscillator circuits on PSoC creator with this development board http://www.cypress.com/?rID=92146... but seems not working.
https://drive.google.com/file/d/0B0JYi6oszi-FNDBTejBJa2x4dzg/view?usp=sharing..( the NAND gate is implemented inside the PSoC chip and rest of the stuff remains off the chip)

But when I implement it with a real logic gate chip (www.ti.com/lit/ds/symlink/sn74aup1g00.pdf), the same circuit works really well and generates a nice square wave with the crystal frequency from the output of NAND gate.

Is it possible to use logic gates from a PSoC chip to create a crystal oscillator?
Could anyone give some advice about this one please.

I tried the same thing with a FPGA too... implemented a NAND gate inside a FPGA and took two pins out to connect the rest of the stuff.
Only once it worked and gave a square wave output, but the frequency was different than the crystal freq.

Am I trying something impossible? or are these gates inside these chips are not 'real' ones?

Thanks,
« Last Edit: October 15, 2014, 11:31:25 am by randsl »
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Quote
Is it possible to use logic gates from a PSoC chip to create a crystal oscillator?

If you can configure it to produce a NOT / NAND gate, it would oscillate.

Your issue may be due to wrong configuration / load capacitance / wiring /...
================================
https://dannyelectronics.wordpress.com/
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Must be a pin configuration problem, I'll put an example in 6 hours or so when I get home from work.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 3072
  • Country: us
Isn't implementing a NOT gate on a PSOC pretty much like doing it on a PAL?  That means you don't just have a few cmos transistors worth of inverter; you've got input logic, a big and/or array, and output logic.  I wouldn't be surprised if that makes it unusable for implementing a crystal oscillator...
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
This document has all you want to know and maybe even more on how to configure the PSoC 4 pins

http://www.cypress.com/?docID=49248

Also this is a less detailed explanation about clocks

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

your output clock pin should look like this:

but instead of hooking the out_clk to an internal clock you should hook it to the output of the NAND gate.


But to use an external oscillator to begin with you probably need a different approach and hook it up as an external oscillator to the PSoC chip:
http://www.cypress.com/?rID=37884

I'm not sure you could drive the crystal directly.
 

Online PA0PBZ

  • Super Contributor
  • ***
  • Posts: 4153
  • Country: nl
I just tested a NOT gate on my Cy8KIT-50, connected to P3.6 and P3.7.
On the breadboard (not the best thing to do) a 4Mhz Xtal and a 1M resistor over the pins, and a 27p cap from each pin to ground.



Works fine.

Keyboard error: Press F1 to continue.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
But he wants to drive the oscillator directly, not just to use it as an external crystal.

 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
nevermind, from my own link before:
http://www.cypress.com/?rID=37884

on the AN54439.pdf doc:

 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
I couldn't find a xtal to do this so I used the internal clock to illustrate the setting of the output clock pin for a PSoC 4.

On the PSoC 3, 5 & 5LP you can just use the pin directly, on the PSoC 4 however you have to configure the output pin so it will use an external clock. Or you can use a flip-flop but that will half the frequency like in BIT_pin depicted here (I left the output mode on that pin to be transparent).



The Clock pin will toggle at the original external frequency with a tiny delay, unless you choose to sync it, then it will be delayed until the next clock and rise at the same time as the external clock but one cycle delayed.

For the external clock yo have to select the Clocking tab on the output pin configuration and select external, also you have to provide a logic high to the pin driver as illustrated on the previous image.



Finally under Pins/Output you might want to change the Output mode from Transparent (default) to Clock.



But I can't test if this will work how you set it up, I have found some oscillators on an old video card but I didn't find the energy to desolder them just yet.


But if you want just to get the external oscillator in, you should just the app notes that cypress provides to hook an external clock.
« Last Edit: October 16, 2014, 03:05:45 am by miguelvp »
 

Offline randsl

  • Contributor
  • Posts: 40
Thanks miguelvp, PA0PBZ, westfw, dannyf for your replies....

hi miguelvp,

Thanks a lot for your valuable ideas and sharing your knowledge....

I modified the pins as per your advice and please see below schematic.


Still I don't get a proper operation. I tried several crystals, with only one of those the circuit tries to start oscillation. The clock is not stable at all. It's changing phase/frequency all the time ( Not able to get a stable trace on the oscilloscope at all). Other crystals does not work at all...

I don't know why it's not working...

I raised the same question in Cypress PSoC4 forum http://www.cypress.com/?app=forum&id=4749&rID=101519&message=posted... I received some replies telling that it's not possible to do this one due to the additional internal stuff around the pin and they stops building an oscillation...

Does the additional internal stuff around the pin stops building an oscillation as mentioned there?

I'm bit confused...

cheers,
« Last Edit: October 16, 2014, 02:41:18 pm by randsl »
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #10 on: October 16, 2014, 02:35:18 pm »
The serial resistor is way too small - I would start with 470k and going down from there.

The feedback resistor is kind of small as well - you can go as high as 10M.

The load capacitors of 0.1uf is insanely large. try 22pf or not use one at all.
================================
https://dannyelectronics.wordpress.com/
 

Offline randsl

  • Contributor
  • Posts: 40
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #11 on: October 16, 2014, 02:43:53 pm »
The serial resistor is way too small - I would start with 470k and going down from there.

The feedback resistor is kind of small as well - you can go as high as 10M.


Thanks dannyf, I'll try that one as well...

The load capacitors of 0.1uf is insanely large. try 22pf or not use one at all.

Actually I tried 18pF, not 0.1 uF.. Only the value shown in the schematic was a mistake. I corrected that... sorry about that...
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #12 on: October 16, 2014, 02:44:56 pm »
I was just showing two ways to generate clocks from the chip.

You don't need the flip flop it was just for illustration.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #13 on: October 16, 2014, 02:49:28 pm »
but it wont hurt, sorry just woke up.

You might need to use it as an external clock and then use it internally, not drive it directly.
 

Offline mrflibble

  • Super Contributor
  • ***
  • Posts: 1947
  • Country: nl
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #14 on: October 16, 2014, 02:56:47 pm »
Using a flip-flop like that as a divide-by-two does have the added benefit of giving you a 50% duty cycle. So even if your ring/whatever oscillator produces something way off 50/50, then you still get a somewhat decent output clock. At half the original clock frequency obviously.
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #15 on: October 16, 2014, 03:05:01 pm »

I raised the same question in Cypress PSoC4 forum http://www.cypress.com/?app=forum&id=4749&rID=101519&message=posted... I received some replies telling that it's not possible to do this one due to the additional internal stuff

Westfw was the only one here who mentioned that and I have a feeling him and the Cypress guys may be right. All those switches and mux can't be good for high frequency operation. What does the Cypress spec say about propagation delays? 4mhz don't seem that high but it would be surprising to see this succeed.

A lot of internet talk is more about what somebody "thinks" should work instead of actually reliable information. That series resistor for example. At those frequencies I can't see how that high resistance could possibly work. Ice cubes chance in hell comes to mind. Those are mainly to assist low power operation and I suspect none at all would be best.  I would try it myself but not setup for PSOC right now.
 

Online PA0PBZ

  • Super Contributor
  • ***
  • Posts: 4153
  • Country: nl
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #16 on: October 16, 2014, 07:01:21 pm »
I don't know who is right or wrong, but here is the 'proof':





Keyboard error: Press F1 to continue.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #17 on: October 16, 2014, 07:45:05 pm »
PSoC 5LP has different pin capabilities than the PSoC 4.

on the 5, 5LP, 3 and even 1 you can assign a clock to a pin directly and leave it transparent.

On the 4 it takes a bit more of setup, so might not be possible to drive it directly.

The PSoC 4 however allows you to use an external crystal oscillator (ECO) but not sure if you can just put a crystal (XTAL) directly, have to dig deeper in the documentation, I put the acronyms they use in case someone has free time to look at the documentation before me, since today is a busy day at work.
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #18 on: October 16, 2014, 07:53:31 pm »
Ahaa... I suspected no series might be the key. It would be interesting to see if those caps are needed too. Generally they serve little purpose with modern hf crystals unless absolute accuracy is needed. This shows what excellent circuitry is hidden behind those tiny PSOC walls. I wonder what the fastest speed possible might be. 8mhz? 16mhz?
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #19 on: October 16, 2014, 11:39:50 pm »
Ahaa... I suspected no series might be the key. It would be interesting to see if those caps are needed too. Generally they serve little purpose with modern hf crystals unless absolute accuracy is needed. This shows what excellent circuitry is hidden behind those tiny PSOC walls. I wonder what the fastest speed possible might be. 8mhz? 16mhz?

Hardware no software controlled you can get the full 48MHz at the output pin named "Clock", the other one with the flip-flop outputs 24MHz.


Software controlled because of output port stall the fastest would be 4 clocks for on and 4 for off if you unroll the signal. so 12MHz for a 50% duty cycle, loop controlled you could achieve a period in 14 cpu cycles so 24/7 MHz so ~3.428 MHz

All those are +- 2% I believe.

PWM controlled 16 bits I will have to test it, but should be up there.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #20 on: October 17, 2014, 02:39:44 am »
PWM I can get 24MHz at 50% duty cycle with a count of 1 and a compare value of 1.

If you use the unconfigured TCPWM it's fully runtime programmable.

I can chose a count of 5 (0-5 is 6) to get 8MHz but then I can select the duty cycle by changing the compare value from 1 to 5 at 1/6 increments  so 16.666% duty for 1, 33.333% for value 2, 50% for 3 etc.

But there are also other alternatives like a fully programmable clock instance including the usage of an external clock, I'm still trying to find an example (hardware connection) to use an external oscillator for the PSoC4, it seems you just have to use the crystal with a physical NAND gate to and then feed that to the chip and add it into the clocks.

To the OP, any reason you won't use the internal clock?
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 7242
  • Country: us
    • SiliconValleyGarage
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #21 on: October 17, 2014, 03:00:01 am »
Why do you want to do it with crystals ? 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.
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #22 on: October 17, 2014, 05:13:58 am »
I replied to your cypress thread because, well... I'm close to get one of those nice port authority silk sports shirts ;)
Here is what I had to say:

Quote
From AN79953
 
"A 0 to 48-MHz external clock (EXTCLK) can be supplied through I/O pin (P0.6)."
 
The only problem is that the Configure System Clocks only allows integer clocks in MHz, so either 7 or 8, or any other integer from up to 48.
 
However you can then derive clocks from an external clock if you feel the built in system clock is not accurate for your needs.
 
Since the PSoC4 output pins are different than the rest of the PSoCs you might need to make it oscillate externally and use only one pin (P0.6).
 
Maybe the attached project will work by making the output pin a clock driveable output, but I'm not sure if this will work to make an oscillator.
 
I removed your 2nd oscilator and this project is non bootable but you should be able to copy and paste the schematic. I also added the EXTCLK in the test_osc_single.cydwr by selecting the clocks tab and double clicking to configure the clocks, so that the output clock is available if you hook it to P0.6.
 
Please let us know on the answer from your case. Or if changing the output pin to this output configuration makes it oscillate.
 
Thanks.

Attached is also a picture of the schematic to test but I have my doubts it will oscillate, but this is as close as you can do to make a PSoC 5LP output pin that drives a XTAL I think.



But I think this won't work because of the inner workings. So if you need a more precise clock than the internal 48MHz one you could just build the oscillator externally and feed it to the EXTCLK pin (P0.6) but you have to select a non fractional clock from 1 to 48 MHz in 1MHz increments. After you hook up the external clock in your system clocks, then you can use that to derive the lower clocks you desire. Or just stick with the internal 48MHz clock.

This is the Configure System Clocks with the EXTCLK activated if the external clock was the maximum allowed at 48MHz: (edit, updated image to show maximum clock speed and extclk selection)

But as stated you might need to drive it from an external oscillator already oscillating on it's own.
« Last Edit: October 17, 2014, 05:22:36 am by miguelvp »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #23 on: October 17, 2014, 07:00:26 am »
According to this thread

No Crystal Oscillator in PSoC4?
http://www.cypress.com/?app=forum&id=4749&rID=80466

You'll need a crystal oscillator not just a crystal on the PSoC 4, that's why P0.6 is the only pin available for an external clock as a single pin input.


« Last Edit: October 17, 2014, 07:02:31 am by miguelvp »
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #24 on: October 17, 2014, 07:41:42 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.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • 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: 5549
  • 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
  • **
  • Banned!
  • 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.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 3072
  • 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: 5549
  • 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
  • **
  • Banned!
  • 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: 5549
  • 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
  • **
  • Banned!
  • 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: 5549
  • 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
  • **
  • Banned!
  • 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: 5549
  • 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
  • **
  • Banned!
  • 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
  • **
  • Banned!
  • 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: 8229
  • 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: 5549
  • 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
  • **
  • Banned!
  • 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: 5549
  • 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
  • **
  • Banned!
  • 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: 5549
  • 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
  • **
  • Banned!
  • 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: 5549
  • 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
  • **
  • Banned!
  • 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: 5549
  • 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
  • **
  • Banned!
  • 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: 5549
  • 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.
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #50 on: October 19, 2014, 03:08:31 am »
PSoC 4, that they OP is trying to use, can't do it because the datasheet doesn't even mention it

I'm not sure if you refer to internal oscillator support or inability to implement an inverter. If the latter then just because it's not mentioned don't mean it can't be done. I assume the sheet don't expressly forbid creating an inverter with a DFB.

Your constant mention of "driving" a crystal is  a bit confusing. Crystals aren't so much driven as used as frequency element in an oscillator which only requires an inverter between two pins. I was under the impression this was possible with PSOC4 but admit to having little experience with digital block here. You are more up to speed on these and may know something I don't.

It would not only solve the OP issue but also overcome what might be considered the only major drawback for this particualr part. Namely lack of dedicated crystal support like present on virtually all other MCUs.
 

Offline lgbeno

  • Frequent Contributor
  • **
  • Posts: 349
  • Country: 00
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #51 on: October 19, 2014, 03:27:02 am »
2 oscillators and a Max 10 FPGA and the OP's design would be done already....
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #52 on: October 19, 2014, 03:31:33 am »
Not referring to the Internal Oscillator at all.

The PSoC 3, 5 & 5LP on their datasheet have XTAL pins.
The PSoC 4 only has and EXTCLK pin meaning that it can take an external clock, but you can't connect a crystal directly to it, this is done by design.

Is there a way to use, say, analog input and output pins to do it, or some obscure configuration? maybe, but that's not intended so it can't be regarded as a solution.

So he can add a darlington based crystal clock and feed the external generated clock to the chip for 5 cents more on parts than hooking it directly, or forget about it.

By driving it I mean making the XTAL resonate and give the needed clock frequency. The PSoC 4 is not designed to do that, but it does however take an external clock to override the internal RC clock.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #53 on: October 19, 2014, 03:35:55 am »
2 oscillators and a Max 10 FPGA and the OP's design would be done already....

The OP already has the clocks oscillating with his NAND gates, he just needs to feed those clocks to the PSoC, no need to add an FPGA, although I want Arrow to get their act straight and get some MAX 10 in stock. Will like to see what analog goodies it has to offer.

BTW, not sure the Max 10 FPGA will allow the OP to implement a Pierce Oscillator with just two caps and a crystal. That's the whole problem the OP brings about if these fabric logic gates act the same as hardware dedicated ones.
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #54 on: October 19, 2014, 03:53:10 am »
Haha... $30 fpga to drive a $2 chip. I'm sure that was intended as humor.

Is there a way to use, say, analog input and output pins to do it, or some obscure configuration? maybe, but that's not intended so it can't be regarded as a solution.

I'm not sure that Cypress dictates exactly what their circuits can and cannot be use for. According to docs the op amps can definitely be routed as an inverter between two pins and will definitely function as an oscillator. Highly unlikely gain bandwidth supports 48mhz or any useful clock frequency.

We know there is a clock input otherwise there would be no constant mention of external clocks. The simple question is can a digital gate be connected between two pins. It looks like I'm not the only one here unable to answer that.
 

Offline lgbeno

  • Frequent Contributor
  • **
  • Posts: 349
  • Country: 00
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #55 on: October 19, 2014, 04:05:01 am »

2 oscillators and a Max 10 FPGA and the OP's design would be done already....

The OP already has the clocks oscillating with his NAND gates, he just needs to feed those clocks to the PSoC, no need to add an FPGA, although I want Arrow to get their act straight and get some MAX 10 in stock. Will like to see what analog goodies it has to offer.

BTW, not sure the Max 10 FPGA will allow the OP to implement a Pierce Oscillator with just two caps and a crystal. That's the whole problem the OP brings about if these fabric logic gates act the same as hardware dedicated ones.

Yeah, IMO it's a clever trick to try to drive a crystal with a NAND gate (internal or discrete) but also a risk. 

Sure a proper oscillator adds some cost but  it is tested and proven to work over time, temperature, process variation, etc, etc, etc.

Just bite the bullet and he probably won't look back and regret the decision.  Do the math: what is the volume, how much extra does it cost to do it right?  How does that number compare to what it would cost to deal with an issue that crops up in production or worse yet, when the product is in the field...  How much does your time cost fiddling around with something when the other approach is a drop in?  Have much does a cup of coffee at Starbucks cost?  If that all makes sense then I'm all for solving the original problem.

The reason that I suggested a proper FPGA is that they for sure have multiple clock domains so they easily meet the OP's criteria listed.  I don't know much about PSOC4 but it sounds like it doesn't.  Just to be clear I'm suggesting to replace the psoc with max 10.

I have not played with max 10 either but it does look slick.  I'd wait for the dev board to be available from Terasic and go that route.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #56 on: October 19, 2014, 04:41:16 am »
They do, for example this is a reference of the external Xtal on the 5LP

And this is a reference to the EXTCLK on the PSoC 4

On the 5LP on the pin names there are 4 XTAL pins, 2 for the High frequency clock to override the IMO and 2 for the low frequency clock to override the ILO.


On the PSoC 4 pins there is not one named XTAL only one named EXTCLK


Of course on the datasheet they don't even mention the EXTCLK in the block diagram this is the only reference to it, other than their specification of frequency and duty cycles.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #57 on: October 19, 2014, 04:59:11 am »
I have not played with max 10 either but it does look slick.  I'd wait for the dev board to be available from Terasic and go that route.

Well, thanks to this thread I noticed that Arrow finally had some stock.(Even if I did setup an alert it never notified me)
But I did order one for $30.

http://parts.arrow.com/item/detail/arrow-development-tools/bemicromax10

The problem with Arrow is usually they are a bit behind with documentation and sample code so I wouldn't recommend their kit for someone starting. Plus they have their own proprietary GPIO pins although one of them is Terasic compatible, and then the edge connector is proprietary as well. It doesn't hurt that I already have an interposer for the 80 pin connector.

 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #58 on: October 19, 2014, 05:14:41 am »
Of course on the datasheet they don't even mention the EXTCLK in the block diagram this is the only reference to it, other than their specification of frequency and duty cycles.

Actually along with clearly labeling  EXT_CLK on P0.6 they do mention further:

Quote
The clock system for the PSoC 4100 consists of the IMO and the
ILO internal oscillators and provision for an external clock.

Also additionally described as an option for use as the HFCLK CPU system clock along with detailed frequency and duty cycle specs for it. This was never in dispute. No crystal would be crippling but without an input a truly fatal flaw.

The single actual question is and always was whether an inverter can be implemented between two pins. It's gratifying to see I'm not the only one learning how these things work.

« Last Edit: October 19, 2014, 05:17:58 am by paulie »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #59 on: October 19, 2014, 05:54:46 am »
External Clock being a single pin on the PSoC 4. Edit: and by no mention in the block diagram I mean the block diagram. The IMO internal RC clock sits by itself in that diagram, no mention of the EXTCLK, but yeah the document does explain you can place an external (already oscillating) clock on pin P0.6 and I did point that out many times in this thread.

No provisions for an inverter on the PSoC 4 for an external XTAL, no mention of XTAL other than the glossary but without any other references through the datasheet, unlike the PSoC 3, 5 & 5LP where they mention it and label the pins.

So, as far as the datasheet is concerned, there is no support for what the OP wants to do.

I don't think 16 cents at most for an external part is a show stopper, there is no much needed to oscillate an external crystal without having the MCU do it for you (and using the extra pin at that).

« Last Edit: October 19, 2014, 05:58:22 am by miguelvp »
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #60 on: October 19, 2014, 06:11:24 am »
External Clock being a single pin on the PSoC 4. Edit: and by no mention in the block diagram I mean the block diagram. The IMO internal RC clock sits by itself in that diagram, no mention of the EXTCLK

? ? ? ? ? That was interesting reading. Internal? RC? My quotes and the diagram you posted with EXT_CLK are pretty clear. Maybe review your own attachment:



ps. Anyway I have a pretty good picture right now where everybody in this thread sits regarding hardware and software competence and state of mind. Probably not much more to discuss at this time and so let's give it a rest for now.

« Last Edit: October 19, 2014, 06:20:41 am by paulie »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #61 on: October 19, 2014, 06:22:07 am »
External Clock being a single pin on the PSoC 4. Edit: and by no mention in the block diagram I mean the block diagram. The IMO internal RC clock sits by itself in that diagram, no mention of the EXTCLK

ps. Anyway I have a pretty good picture right now where everybody in this thread sits regarding hardware and software competence and state of mind. Probably not much more to discuss at this time and so let's give it a rest for now.
Whatever you say.

Here is their Datasheet diagram, as I mentioned, no signs of the EXTCLK next to the IMO


Edit: but most importantly no mention of Xtal or external crystals anywhere in the document.
« Last Edit: October 19, 2014, 06:30:31 am by miguelvp »
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #62 on: October 19, 2014, 06:24:33 am »
My quotes and the diagram you posted with EXT_CLK are pretty clear. Maybe review your own attachment:

 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #63 on: October 19, 2014, 06:32:37 am »
My quotes and the diagram you posted with EXT_CLK are pretty clear. Maybe review your own attachment:



Yes, IT does support an External Clock, no one denies that, at least not me. Edit: I've been saying all along you can use pin P0.6 to do so!.
They Don't support an external XTAL you gotta make that clock oscillate externally and then hook it into P0.6 and everyone is happy. No inverter between two pins, just a single clock pin to override the internal RC clock.
« Last Edit: October 19, 2014, 06:34:49 am by miguelvp »
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #64 on: October 19, 2014, 01:09:05 pm »
Quote
IMO it's a clever trick to try to drive a crystal with a NAND gate (internal or discrete) but also a risk. 

Not sure why it is a "clever" trick: it is done every day gazillion times in pretty much every mcu / crystal oscillator. That's the way it is.

You cannot get any simpler / plainer than that.
================================
https://dannyelectronics.wordpress.com/
 

Offline randsl

  • Contributor
  • Posts: 40
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #65 on: October 19, 2014, 01:38:17 pm »
Hi all,

Thanks a lot for your efforts & thoughts to answer the question raised by me...

Hi miguelvp,
I tried the project you posted in Cypress forum. That one is also does not work.

I understand that my idea is not going to work with PSOC4.
The two frequencies needs to be stable and 2% accuracy with the internal osc. is not enough for my application.

Initially I planned to use a MSP430 micro on the system with two oscillators built up with NAND gate & Xtals.
I think it's easier for me to switch back to my initial plan with MSP430 and gave up on PSoC4 idea.

Thanks again for your thoughts and help.

cheers,
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #66 on: October 19, 2014, 04:19:47 pm »
Quote
The two frequencies needs to be stable and 2% accuracy with the internal osc. is not enough for my application.

A typical way to generate frequencies out of a mcu is to use pwm. You may have to work out the math to see what the error rates are for your set-up.

Otherwise, using an external oscillator or two crystals + NAND gates would work.

I don't know the specific chip but many mcus offer the ability to trim its internal oscillators. And some mcus offer internal oscillators of high precision - I think some PICs have 0.1% intosc.

Moving to a different chip due to frequency generation seems to be too drastic of an approach to me.
================================
https://dannyelectronics.wordpress.com/
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #67 on: October 19, 2014, 05:58:15 pm »
I agree with dannyf (yikes!) that it's silly to resort to other chips or any extra components at all. Moving to an fpga that costs 20x more don't strike me as a smart move either.

Miguel does not seen to get the point. Might be language barrier or maybe friday and saturday nights are not a good time to try explaining things like this. Just for the benefit of anyone who might be more familiar with PSOC4 programming here it is again for about the tenth time:

The chip has an external clock input. If an inverter can be implemented between two other pins using a digital block then a crystal can be attached which will oscillate and drive that input. This will overcome the lack of dedicated internal crystal oscillator and allow PSOC4 to perform like other MCUs.

PWM, d-flops, internal RC, etc have nothing to do with this. The question is can an inverter be implemented between two pins on this chip. If you don't understand what I am saying please don't respond again with more irrelevant or repeated comments. Just ignore me. One last time:

The chip has an external clock input. If an inverter can be implemented between two other pins using a digital block then a crystal can be attached which will oscillate and drive that input.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #68 on: October 19, 2014, 08:13:39 pm »
Short answer is no you can't.

The PSoC 4 has a High Speed I/O Matrix (HSIOM) that the PSoC 3,5&5LP didn't have. As seen in the bottom part of the block diagram:

PSoC 4 (ignore the highlights, just didn't feel like uploading new pictures)


The PSoC 5 connects the pins directly to the digital interconnect: (ignore the highlights, just didn't feel like uploading new pictures)


There might be a way to configure the HSIOM, feel free to dig through the TRMs I/O System to find out (section 7.6 High-Speed I/O Matrix)

PSoC 4 TRM (look at the I/O Sytem section 7)
http://www.cypress.com/?docID=48637

PSoC 5LP TRM (I/O system section 19)
http://www.cypress.com/?docID=46050

I don't know how much delay that HSIOM module produces but what is clear is that the pins are no longer connected directly to the digital system interconnect.

There "might" be a trick, there are so many configuration options including drive modes and clocks, the OP could set the input pin to be driven with an external clock (inverted) and connect that to the output port. That might do the trick but again I doubt it.
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #69 on: October 19, 2014, 08:29:06 pm »
It's not possible to build an inverter between two pins? As far as "digital building blocks" go I must say I'm not impressed. End of story.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #70 on: October 19, 2014, 08:36:35 pm »
Hi all,

Thanks a lot for your efforts & thoughts to answer the question raised by me...

Hi miguelvp,
I tried the project you posted in Cypress forum. That one is also does not work.

I understand that my idea is not going to work with PSOC4.
The two frequencies needs to be stable and 2% accuracy with the internal osc. is not enough for my application.

Initially I planned to use a MSP430 micro on the system with two oscillators built up with NAND gate & Xtals.
I think it's easier for me to switch back to my initial plan with MSP430 and gave up on PSoC4 idea.

Thanks again for your thoughts and help.

cheers,

If you configured a 42MHz external oscillator to drive the PSoC external clock you can get the 5.441MHz with a 7+23/32 fractional divider that is sync'd to the system clock. Meaning it wouldn't matter how accurate your clocks are if they fall out of sync from your MCU.
Then use an external oscillator with to bring in the 5.510Mhz clock.

Also I thought of something. You could setup the input pin to be inverted (under the clock selection) or to be an external clock inverted. and wire it to the output pin directly without the NOT gate because it should already be inverted, but I have the feeling the Hight Speed I/O Matrix gets in the way regardless.

Analog pins can bypass it I think but not enough bandwidth for your clock.

Maybe you could ask the PSoC Sensei blog: http://www.cypress.com/?id=2401
in the comments for http://www.cypress.com/?rID=80799&cache=0

Or Asha Ganesan at the cypress forums seems to know about the HSIOM module
http://www.cypress.com/?app=forum&id=4749&rID=89410
But has not been active since January.




 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #71 on: October 19, 2014, 08:44:00 pm »
It's not possible to build an inverter between two pins? As far as "digital building blocks" go I must say I'm not impressed. End of story.

You CAN build an inverter between two pins, probably not to get a crystal to oscillate,but for all other intents and purposes it's a non issue. If you have a digital signal (even a clock) coming in and you need to invert it, it will handle that just fine.

Or use the PSoC 3 or 5LP, that doesn't have that HSIOM module. But that module brings more features not possible on the other 2 chips.

Or study what the HSIOM can do, maybe you find a way.
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #72 on: October 19, 2014, 08:58:42 pm »
You CAN build an inverter between two pins, probably not to get a crystal to oscillate

If you place a crystal across an inverter I personally guarantee it will oscillate. Maximum frequency depends on propagation delay.

Unfortunately I'm not in a position ATM to investigate how to make an inverter. It looks like no one else is either and since OP has left the building let's put this thread to rest.
 

Offline mrflibble

  • Super Contributor
  • ***
  • Posts: 1947
  • Country: nl
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #73 on: October 19, 2014, 09:22:50 pm »
Unfortunately I'm not in a position ATM to investigate how to make an inverter. It looks like no one else is either and since OP has left the building let's put this thread to rest.
Alternatively, you could give it a rest and let the rest just keep on going. :) You already know everyone's relative strength and weaknesses regarding hardware + software, so what new things could you possibly learn in this thread? Those of us who are less skilled however still find use for the information in here as presented by miguelvp. And yes I can actually read, thanks for asking. And on a good day I (and I suspect a good many other people as well ;) ) can even reason about what I just read, so no need to jump to the "rescue" about what you perceive to be the correct way to present information about the oscillatory goodness inside PSOC3/4/5. Thanks! :-+
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #74 on: October 19, 2014, 09:33:47 pm »
You are welcome. And I'm glad you could take advantage of miguelvp's "expertise". But unless you can contribute to the original purpose of this thread which was to find a way to use crystals on a chip that can't do that then why not follow your own advice.

So far "oscillatory goodness" might not be the phrase to accurately describe this chip.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #75 on: October 19, 2014, 10:39:23 pm »
Anyway, insults aside (I'm married and my kids are past their teens now, so I'm used to worse, thank god they outgrew that phase :phew:).

Regarding if you can add an inverter between two pins, you can.

This is the schematic on a PSoC 4 (since I don't really want to setup an external clock I took the liberty to use the internal one).


This is the output: Chan 2 is BIT_pin or Pin_1, Chan 1 is the output inverted in Clock_2

Not sure why that glitch is there, I did use a ground wire instead of the ground clip and measured at the pin.
Chan 2 I used a ground clip because I only have two hands, also I used just 2 MHz so the ringing doesn't look awful because I didn't want to do a more elaborated setup.

Yeah I could have use better names but it was a quick test just to prove it does indeed invert.

Edit, didn't measure the delay, but looks like it's around 10ns.
« Last Edit: October 19, 2014, 10:58:33 pm by miguelvp »
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #76 on: October 19, 2014, 11:27:10 pm »
There appears to be out of phase signal like complementary PWM or outputs under program control but don't quite see an inverter between two pins. What are the two pins? Where is the inverter?

ps. If an inverter is implemented between two pins I guarantee the crystal will oscillate. 10ns delay should allow extremely accurate frequencies up to several mhz. This would be a major improvement in usefulness for this part. Do you have a hex file?
« Last Edit: October 19, 2014, 11:36:27 pm by paulie »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #77 on: October 19, 2014, 11:37:49 pm »
Bottom signal is the input signal located in pin P0[1] and the output signal is on P1[0], the inverter is that NOT gate in between.

The blue dashed wire is an external wire. (it doesn't do an internal connection).

The bottom part of the schematic is just to generate the signal.

The top part that takes then input signal inverts it and outputs in out in Clock_2 is what you are seeing in the scope capture.

Note the voltage levels are different so it's not the same signal phased.
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #78 on: October 19, 2014, 11:44:10 pm »
Did you mean P0_0 and P0_1? It really don't matter where the input test signal comes from and what pins are used. And eventually the output would be wired to P0_6. If you have a hex file I can check this with a real crystal.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #79 on: October 20, 2014, 12:10:25 am »
No I used just what the system selected, but I can configure it to anything.

If you want to test it, let me know what input pin you want, also what output pin and if you need the image to be bootloadable or not. Also I'm using Cypress Creator 3.0 with the newly released Service Pack 2.

I'll zip a project instead of the hex file so you can compile it yourself. Right now I'm using a CY8C4245PVI-482 (28 pin SSOP)

 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #80 on: October 20, 2014, 12:39:01 am »
Unfortunately I can flash using the python script but unable to run creator ATM due to SSD resource limitations. Usually it's better to deal with hex to minimize compiler configuration differences etc but my chip is CY8C4244PVI-442 ssop8 so I don't how that will work out. Any two pins except 0[6] should be OK but might be a good idea to keep them close to that one. In any case it's worth a try considering the benefits if this succeeds.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #81 on: October 20, 2014, 01:10:33 am »
Should be easy, what is the external clock frequency (1-48)MHz at 1 MHz increments are allowed.

I can place the inverter between P0[0] and P0[1]

I'll then use the EXTCLK to drive the system and put the full clock signal out on P1[1] and half clock via a flip-flop giving 50% duty cycle on P1[0]






Give me the value for the clock and I'll create the HEX file.
« Last Edit: October 20, 2014, 01:13:07 am by miguelvp »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #82 on: October 20, 2014, 01:29:01 am »
Timing results from the above setup:


Edit: If I turn the pin P0[1] output mode to transparent it might not work but set to clock it adds an extra 13.097ns delay
« Last Edit: October 20, 2014, 01:46:33 am by miguelvp »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #83 on: October 20, 2014, 02:02:45 am »
Since the clock frequency shouldn't matter I'll just upload the one created with those settings.

Let me know if you want a version with P0[1] set to transparent instead of clock but when I do that it disappears from the timing results.
Going to test a bit with the internal clock like I did before to see if still produces the inverse signal and will measure the delay in the scope.
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #84 on: October 20, 2014, 02:26:50 am »
Half of what you say makes no sense to me as I've not dealt with digital blocks at all. To be clear the inverter is connected with input to 0_0 and output to 0_1 and no other connections. Once oscillation is verified an external wire can be added from the output to 0_6 which is configured for external clock. This should allow the chip to run off a crystal. Does this sound right?
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #85 on: October 20, 2014, 02:42:32 am »
Yes, the inverter is connected from 0_0 to 0_1. If you get oscillation (but not sure if the chip even work until there is a clock on EXTCLK) then that will feed a clock to 0_6.

1_0 and 1_1 will output half the XTAL frequency at 50% duty cycle and the Full XTAL frequency at whatever duty cycle it comes from 0_6


But I think that for the inverter and the output port 0_1 the chip has to have already a clock, if that's the case it just won't work as you think it will. But I might be wrong.
Maybe I shouldn't disable the internal clock but use the EXTCLK for the system clock and let the IMO run doing nothing.
« Last Edit: October 20, 2014, 02:46:29 am by miguelvp »
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #86 on: October 20, 2014, 02:53:58 am »
If it's true that the digital blocks don't function until the processor runs then this has no chance of being useful. An external oscillator can be hooked up to EXT_CLK input and the inverter tested to check this. Anyway I will try it when I get to the shop tomorrow to see what works and what don't.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #87 on: October 20, 2014, 03:06:59 am »
I made a version that has both the IMO and the EXTCLK enabled but selected the EXTCLK for the HFCLK and SYSCLK, maybe that has a better chance to make it work.



Looking at the block diagram:

I can't tell if the clock is needed or not for the digital blocks
« Last Edit: October 20, 2014, 03:09:34 am by miguelvp »
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #88 on: October 20, 2014, 03:12:12 am »
I'll try them both. Moving wires around and scoping pins may tell us more about how this chip really works. Thanks for taking time to make this investigation possible,
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #89 on: October 20, 2014, 03:43:30 am »
Not a great probing job but wanted to measure the delay from p0_0 to p0_1
Looks like it's around 13ns.


Also If i take out the Clock output mode on p0_1 and leave it transparent, I get nothing of value out of p0_1


I'll see if I can get a 2nd 4200 to generate a signal and test if the invertor works without a signal on EXTCLK and the IMO disabled.
« Last Edit: October 20, 2014, 03:45:36 am by miguelvp »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #90 on: October 20, 2014, 04:04:10 am »
Also this looks promising: I did disable IMO and program it to use the EXTCLK. I'm not feeding a signal at all on p0_6

If I set p0_0 to low, p0_1 goes to high and viceversa.

p0_0 off:


p0_0 on:


So the first HEX file I gave you should act the same as this for your chip.
« Last Edit: October 20, 2014, 04:05:42 am by miguelvp »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #91 on: October 20, 2014, 04:29:59 am »
So I did feed the RIGOL 1KHz test signal and it was still inverting without any clocks feeding the chip. Bottom signal is the test signal, top one (yellow) is the inverter output.


I went to measure the delay and other that for just a 1KHz signal it takes almost 2 micro seconds, I'm not sure why there is a high frequency ringing in there.


Edit: nevermind that's when it reaches the switching voltage, so the delay is way less. The test signal (bottom) doesn't have the quickest rise time :)

I'm going to try to feed it a 4 MHz signal from an external chip to the inverter to see if it behaves better at higher frequencies.
« Last Edit: October 20, 2014, 04:37:35 am by miguelvp »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #92 on: October 20, 2014, 05:47:23 am »
So I took a PSoC 4100 and programmed it to output a 4MHz clock on P2_0.

I feed that to the inverter input P0_0, then I take the inverter output P0_1 and connected that to EXTCLK P0_6, then probed P1_1 and P1_0 for full and half clock.

Setup:


P0_0 (inverter input, 2nd channel) P0_1 (inverter output, first channel):


Delay about 20ns?


P1_1 Full clock based on EXTCLK:


P1_0 Half clock passing EXTCLK via a d flip flop:


So other than I'm not using a crystal, if you can make it oscillate and feed P0_1 to P0_6 it should do the same as this. (if your Xtal is a 4 MHz one that is).



« Last Edit: October 20, 2014, 05:57:31 am by miguelvp »
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #93 on: October 20, 2014, 11:20:31 pm »
This is good news that the CPU don't have to be running for the digital block to function. It eliminates a potential roadblock to PSOC being competitive with other mCUs. Let's hope these oscillator tests work out.

Unfortunately there was not much luck trying out your images. I spent all afternoon. It's not obvious where the problem is. Could be some subtle difference because we are using different chips, something wrong with my PC flashing utility, programmer firmware, or who knows what. Too many variables and it would probably be a good idea for me to get more in step with your results.

So I'm thinking implemented on the same platform on both ends would be better so what about using the $4 board itself? As seen in the photo below I have a crystal test dongle. Originally for another MCU but should work fine here. It's got parallel resistor and caps and allows plugging in any crystal. Speaking of which I've got a pretty big collection with over 60 standard values and twice that many oddball custom frequencies, ceramic resonators and quartz.

Would it be possible for you to put something together for CY8C4245AXI-483 using say 0_4 and 0_5? These are right next to the EXT_CLK pin and that jig would plug right in.

I placed another order for some of those and also several other part numbers including 16 and 8 pin parts. It was amazing to discover prices direct from Cypress were way lower than Mouser or any other distributor. 40 cents for the CY8C4013SXI-400 (single) and less than a buck for some others. And free shipping. Seems too good to be true. Wish I was aware of that last time.

These chips are looking real good again and probably next candidate for the $1 one minute club. Since only one full size setup at a time allowed on my netbook looks like I may have to swap out the STM32 Eclipse with Creator again (sigh). Then maybe see if  I can strip the basics out like with the others.

ps. I was hoping not to get caught up in your religious fanaticism but that plan ain't working out so well. :)

« Last Edit: October 20, 2014, 11:48:40 pm by paulie »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #94 on: October 20, 2014, 11:47:11 pm »
The HEX files I upoaded where targeted for your chip, I later changed the device to mine to do the tests. As far as I can tell (and I will look it up more in detail later) the only difference is that mine have 32K flash and yours 16K.

One thing different is that I upgraded to service pack 2. I'll try with my $4 programmer to make sure the python script still works with SP2.

As for the CY8C4245AXI-483 protoboard do you need the image to be bootloadable? If the problem is because my upgraded toolchain it won't make a difference in your end, so I'll verify SP2 produces HEX files that are compatible with the python programmer first.

The only reason I went for these chips was to connect them to an FPGA and provide the digital/analog blocks in conjuction with the FPGA and also provide a hard ARM core to the FPGA. But I keep on getting side tracked.

One thing I can do is export the project to Eclipse so you can produce your own HEX file, I only tried exporting to Keil and that worked, so it should work with Eclipse as well.
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #95 on: October 20, 2014, 11:55:37 pm »
I'm not sure what the practical implications are for bootloadable vs not. These are just tests so whatever is simpler and most convenient.

As far as toolset I would prefer whatever that standard 600mb Creator download has. Since my initial toying around was in centipede mode I really didn't see what was going on under the hood.  Thought there was some GCC sqeaking around down there so I can maybe extract something more useful later. So it would be best to use the $4 board for now and re-investigate that $4 programmer and SOIC stuff after this is under control.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #96 on: October 21, 2014, 12:35:21 am »
The $4 boards come with a bootloadable program, meaning that if you press the button while powering it up, it will allow you to load a new program, but that program has to be bootloadable as well so you can reprogram it again.

The $4 programmer for example is bootloadable so you can reprogram it later for other uses.

So, if I write a hex file that is bootloadable but also overrides the EXTCLK I'm not sure if it will stay bootloadable, I have to experiment a little with that to make sure I don't override your bootloader.

Using the $4 programmer or the Pioneer with a modified KitProg, allows you to program the chips without the need of them having a bootloadable image.

I did test my $4 programmer with a new hex file and it worked fine. Maybe you had some wires crossed or something like that

From the protoboard to the SSOP I had:
P2.0 connected to P3.2 (SWDIO)
P2.1 connected to P3.3 (SWCLK)
P2.4 connected to XRES
ground and power.

If it's programming the blue LED on the protoboard should be flickering while it programs and verifies, if you don't see flickering then something is wrong and enters the bootloader mode. You need to power it off and on again to start the programmer again.

Edit: I just tried by trying different combinations of disconnection or not paired up to the right pin, and the $4 programmer just starts to blink (no flickering just a steady blink at 3 per second) that means something is not hooked up right.
 


So my question to you is, do you need it bootloadable image, or are you going to use another $4 board to program it?
« Last Edit: October 21, 2014, 12:43:03 am by miguelvp »
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #97 on: October 21, 2014, 12:49:22 am »
I would prefer to use just one demo board by itself programmed via USB and standard Creator package. Mostly right now I would like to see if the inverter oscillates so it don't really matter what the target CPU is doing. Once that is verified it might be nice to feed the output into EXT_CLK so a blinky running there would be convenient. Whatever you decide is easiest path for the above is fine. KISS.

« Last Edit: October 21, 2014, 12:52:13 am by paulie »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #98 on: October 21, 2014, 03:36:42 am »
So I took the SCB_Bootloader blinking sample and added the inverter going from P0_4 to P0_5.



I left the rest alone and verify that if I put P0_4 to ground, P0_5 goes high and viceversa. I attached the project and "extract here" will create the directory SCB_Bootloader_42xx where the project will be at.

Once you extract the project, open SCB_Bootloader.cywrk with PSoC Creator 3.0 SP2 (I got the latest service pack)

Once the project opens, do Build->Build All Projects (F6)

Once that finishes, hold down the user button in the prototype kit while connecting it to your Netbook, or PC, that will activate the bootloader and it will blink fast (3 times per second).

Go to Tools->Bootloader Host and if you have set the serial port you'll see the USB Serial Port with the COM port that you selected.

Under file navigate to where the cyacd file ended up, in my case it's in:
D:\projects\SCB_Bootloader_42xx\Bootloadable Blinking LED.cydsn\CortexM0\ARM_GCC_473\Debug\Bootloadable Blinking LED.cyacd



Press the Program button (F5) and that will program the board, the blinking light will still blink but once per second.

Now P0_5 will output the inverse of P0_4.

That should be enough to check if the crystal will oscillate.
« Last Edit: October 21, 2014, 03:39:41 am by miguelvp »
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #99 on: October 21, 2014, 11:53:41 am »
After a little over 3 hours of various updates and installs Creator was working again and able to build your project. Unfortunately the Cypress USB/serial adapter on the demo board will not function now. After numerous attempts with the Cypress driver and also the USB SDK Kit it shows up as com10. However any attempts to select it with Bootloader Host or change port in Device Manager causes it to stop responding and my PC hangs. I've rebooted the PC a few dozen times and restored the system drives more than once but same thing.

This Cypress adapter beeps a different number of times for each enumeration and randomly enables/disables every few minutes which is not a good sign.

My generic USB/serial (com5) is stable and available as an option but programming results in "can't read target" error. The blue LED does blink slightly faster (exactly 2 hz not 3 as you mention) so the loader seems to be activated. I got further last time so it's a mystery.

Any suggestions?
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #100 on: October 21, 2014, 02:33:55 pm »
I use an USB extension cable instead of hooking it up directly to the PC because the extension cable grips better.

The prototype board as it comes from Cypress has the blinking program on it and blinks at around 1 or 2 Hz, but if you are pressing the button when pluging it in, it should blink at a faster rate. Let me actually measure the frequency but by eye it was about 3 to 4 Hz, I'm ready to go to work so I can't check until Noon.

The thing is that if inserted normally it should blink at a slower rate than when you hold the button while inserting it.

As for the Com5 is that the one built in the computer? and attached to the board bypassing the header?  I have not ever tried to program it with a USB/Serial cable directly.
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #101 on: October 21, 2014, 03:04:06 pm »
The single remaining issue is getting the Cypress USB/serial port installed. What drivers did you use?

The Cypress USB/serial shows up as com10. However any attempts to select it with Bootloader Host or change port in Device Manager causes it to stop responding and my PC hangs. My generic USB/serial (com5) is stable and available as an option but programming results in "can't read target" error.

The blue LED does blink faster (exactly 2 hz measured by scope, 1hz without button pressed) so the loader seems to be activated.

My motherboard com1 and generic USB/serial com5 are available but can't program. Would it be possible for you to test with your com1 or another USB/serial? I would like to program these chips one way or another.

The single remaining issue is getting the Cypress USB/serial installed. I've been trying for several hours and the Cypress port is not functional. Would it be possible for you to try programming with your com1 or another USB/serial?


 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #102 on: October 21, 2014, 03:38:51 pm »
I used PSoC 4 Prototyping Kit Guide

http://www.cypress.com/?docID=48142

And the document installed on the Start menu, under Cypress/Cypress USB-Serial/Documentation/Cypres USB-Serial Driver Installation Guide.pdf might help on the specifics


 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #103 on: October 21, 2014, 04:09:15 pm »
So you installed the entire USB/serial SDK package just for a driver? It takes me close to an hour each time with dotnet and win installer updates.  It's bigger than Creator which is gigabytes. After numerous attempts using that USB SDK Kit it shows up as com10. But selecting it with Bootloader Host or change port in Device Manager causes it to stop responding and my PC hangs.

I sent 3 emails to the various Cypress addresses and opened a website case asking two questions:

1. Is there any other driver package besides Cypress USB/serial SDK?

2. Should it be possible to use a generic USB/serial instead of the Cypress one?

No response since yesterday.


 
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #104 on: October 21, 2014, 04:16:37 pm »
I just took a quick peek on that prototyping kit guide I linked.

Kit Software under Software installation has the link to PSoC Creator and another one for EZ-USB Software Development Kit (SDK)

it has the following link:

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

and the driver is in there (9 MB) requires you to log in to cypress.

You can get the USB-Serial SDK installer from there too. but I guess that's up to you. The USB/UART part of the prototype kit is configurable if you later want to play with other protocols like I2C or SPI, not sure what other modes it allows at the moment with their CY7C65211-24LTXI chip.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #105 on: October 21, 2014, 04:23:42 pm »
From that page you want "USB-Serial Driver Installer" that downloads CypressDriverInstaller.exe
and also get the USB-Serial Windows Driver Installation Guide pdf file for specifics on how to install and configure the driver.

edit: It's been a while since I did install mine so but I usually follow the guide so that's probably what I did. I didn't get the Pioneer until later so I probably only installed the necessary parts, then later on I started to play with the other chip in the board, so I probably got the other piece of software, not sure since it was months ago, sorry.
« Last Edit: October 21, 2014, 04:26:00 pm by miguelvp »
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #106 on: October 21, 2014, 04:28:31 pm »
Yes, I tried all of the above. There are two other guides and other driver packages too. The easiest was to use windows wizard and direct it to \Cypress\Cypress USB-Serial\driver\cyusbserial\bin\wxp\x86. This works some of the time but it still hangs.

Guess I'll wait for Cypress to get back or set aside another couple days to experiment. So far more time spent than all the other ARM chips and tools combined. So far more money spent than all the other ARM chips and tools combined. I should have rechecked the process again before ordering that new batch of chips. Live and learn. In any case thanks for your effort.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #107 on: October 21, 2014, 04:46:11 pm »
I have it installed in three computers and none of them gave me any trouble, including my old XP 32 bit machine.

Is the driver not installing or is it installing but not acting right?

what baudrate and setting do you have that com port at?

I'm sorry your COM port is giving you so much trouble. Do you have more than one USB port?

I'll be home for lunch in 15 minutes or so I'll see how it acts when connected with the button unpressed or when pressed, I think one of the modes brings 2 devices at once, an HID and the USB one but not sure.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #108 on: October 21, 2014, 05:37:04 pm »
When I plug it in with the button pressed windows beeps once, on unplug it beeps twice.

Here are my port settings


Advanced


Driver


Driver Details
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #109 on: October 21, 2014, 06:27:32 pm »
That might be the key. I just used those settings, not for Cypress USB/serial, but for my generic one and it appears to program without errors now and the blinking went back to 1hz which is a good sign. Changed in Dev Mgr and Bootload Host from 9600 to 115k maybe did the trick.

I need to go out with a client right now but when I get back time to fire up the scope. It was very depressing but now I'm excited again. PSOC is GCC plus the lowest cost (albeit 40xx) of all ARMs so I really wanted to get into these. Also maybe cheap $4 programmer or even less if bare chip works with the Python. Fingers crossed and thanks.

 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #110 on: October 21, 2014, 11:40:38 pm »
Back to oscillation then. I just noticed that I can't output a fractional clock since it's aliased by HLFCLK and since that one at the moment is derived from the internal 48MHz or 24MHz IMO, the output clock is not stable.

But a 4MHz crystal should work fine for now. Later if you derive the HLFCLK from the EXTCLK the output pin shouldn't have any trouble outputting the fractional clock, at least that is my hope.

Maybe changing some output pin settings take that dependencies away, but so far I only get a clock if referenced to HLFCLK

 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #111 on: October 22, 2014, 12:41:51 am »
With the 4mhz crystal 4.7meg R and no caps it oscillates at expected frequency. Touching with finger or scope on input stops it so gain probably not as high as a real inverter. With optimum R and caps stability should improve. But it works! You have proven we may be able to overcome the serious omission of internal crystal oscillator at the cost of a digital block. If this can actually drive the CPU then PSOC4 is again in the lead as one of the better choices for ARM MCU.

For a real world test we need to disable the internal clock and run from EXT_CLK. Can you do this? I looked at the code (clock.c?) and none of it  made sense. In fact none of the code resembles C to me. Can you put up an EXT_CLK version or tell me what to change?

ps, Maybe also a good idea to blink at 10hz not 1hz because of the slower clock.
« Last Edit: October 22, 2014, 01:13:00 am by paulie »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #112 on: October 22, 2014, 01:16:07 am »
That's good news and it matches my speculation on the output pin settings needed to generate an output clock.
However when it starts oscillating what HLFCLK is it using? the internal one until EXTCLK is stable? if that is the case then only fractions of 48MHz will work.

Also on the lower frequency ones like the one you have that maxes at 24MHz the IMO can still do 48MHz and so can the HLFCLK, but the SYSCLK has to be divided by at least 2 since it can't get past the 24MHz, however, even if HLFCLK can still run at the full 48MHz they can't run faster than the SYSCLK, and PSoC Creator will complain. Sorry if I lost you on that. Not really that important other than the base clock can be higher than what the MCU is rated at.

Do you still have the $4 programmer setup? If so and since you resolved the serial port problem, you should be able to program the 28 SSOP chip with the first HEX file I posted.

While you work on that I'll try to see if I can make a bootloadable program that will allow for the clock to be EXTCLK. The problem with that is that the bootloader has it's own chip configuration and will use the IMO, then when it loads the bootloadable configuration then it will use the EXTCLK, so not sure how that will affect the crystal while it's transitioning

The good news however, is that you can use a more accurate 48MHz clock regardless.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #113 on: October 22, 2014, 02:29:16 am »
Ok, I did a bootloadable image that switches from the bootloader internal 48MHz IMO, to the bootloadable EXTCLK driven clock.

I also added this so you can measure the crystal freqency in P1[7] and half frequency at 50% duty cycle after passing via a d-flip-flop on P1[6], those are just next to a ground pin so it will be easy to probe without a lot of ringing with a ground wire and no ground lead on the probe.


It's still bootloadable so you can reprogram it, but without the crystal it's free running and actually I get some internal frequency driving the LED (looks like it runs at half intensity), with a 4MHz crystal is supposed to blink at 1 Hz

Weird thing is that without the crystal P1[6] outputs 15.75MHz meaning that internally it think EXTCLK is double that (31.5MHz) not sure why that is happening. P1[7] without a crystal shows just noise, but didnt' measure the frequency of the noise spikes. Edit: unsure now if this is P1[6] might be P1[7] but one of those definitely has a clock driving it even if both are supposed to be based on EXTCLK.

Edit: Not sure why I'm measuring 5 volts on the output either without the crystal in place. Maybe it routes the full VDD to the pin I measure it at. (Had it running for 10 minutes and the chip is ok with it so far) with no crystal, the crystall should bring that signal down to 3.3V (maybe since I don't have any load on that pin)

I'm attaching the project as well. should compile like the other one and you should be able to program it the same way.

Edit: The important thing here is that, if the on board LED blinks once a second with a 4MHz crystal, it's working as it's supposed to. If you want to try other crystals and you want me to change the parameters so it blinks at 1Hz let me know, I would assume that a 1MHz crystal will make it blink once every 4 seconds.
« Last Edit: October 22, 2014, 02:41:25 am by miguelvp »
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #114 on: October 22, 2014, 11:31:54 am »
I get some internal frequency driving the LED (looks like it runs at half intensity), with a 4MHz crystal is supposed to blink at 1 Hz

Not if you are putting a 15mhz signal into the LED which seems to be what my scope shows. I would expect it to show dim. Maybe you forgot that LED is on 1.6 or maybe I don't understand. Anyway I get the same results you describe above but not sure what use it is. Wouldn't it be better to output that clock signal on a different pin, say 1.4?

IMO 1hz ain't the best rate because that's similar to the factory demo and the boot mode indicator. I would want it to go at say 10hz for the fastest clock expected. Also because 4 sec is a long time to wait for results.

Since I had bad luck with the $4 programmer/Python I'm inclined to use the demo board as just a target until the new chips come in. Then there will be more than one target so my plan is to see if I can get that working again at that time. Ultimately port it to a bare chip so it will be a "$2 programmer" and I'll have a backup.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #115 on: October 22, 2014, 04:52:01 pm »
Duh, I guess it didn't realize the PWM is also hooked into the LED, so it took the association away from the PWM.

Double click on "Bootloadable Blinking LED.cydwr"
And change the pins there. Change the one I named Pin_1_6 to use P1[4] and restore LED to use P1[6]
I'll change the project this afternoon after work.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #116 on: October 23, 2014, 02:42:03 am »
I changed the blinking to 10 hertz and the clock to output to P1[4]

Running without a clock still shows a high frequency now on P1[4], also 10 Hz makes the blink run pretty quick so it might not be a good indicator to tell if the EXTCLK is working.

Edit: it will remain at 10Hz if the target clock is 4MHz since it derives the clock based on the EXTCLK
« Last Edit: October 23, 2014, 03:41:03 am by miguelvp »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf