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

0 Members and 1 Guest are viewing this topic.

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Crystal oscillator with logic gates implemented on a PSoC chip - possible?
« Reply #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
  • **
  • !
  • 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: 5550
  • 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
  • **
  • !
  • 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: 5550
  • 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
  • **
  • !
  • 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: 5550
  • 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: 5550
  • 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: 5550
  • 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
  • **
  • !
  • 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: 5550
  • 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
  • **
  • !
  • 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: 5550
  • 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
  • **
  • !
  • 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: 5550
  • 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: 5550
  • 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: 5550
  • 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: 5550
  • 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
  • **
  • !
  • 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: 5550
  • 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
  • **
  • !
  • 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: 5550
  • 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
  • **
  • !
  • 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: 5550
  • 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
  • **
  • !
  • 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?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf