Question regarding external oscillator and PWM-measurement with CY8C5888AXI

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous91
Level 1
Level 1
First reply posted First question asked Welcome!

Hi all,

I am using a PSOC5 Cy8C5888AXI for a project and have encountered some problems regarding clocks with an external oscillator and with measuring the duty-cycle of a pwm signal.

For the oscillator im using an HC49US8.000MABJ-UB 8MHz crystal unit. I checked XTAL in the clock settings and entered the frequency, accuracy and the capacities as specified in the data sheet. I also checked "Use default startup timeout" and "Halt on XTAL startup error". My problem is that the connected crystal does not work this way. According to the debugger, after switching on I end up in the function CyClockStartupError which means there is an error during clock configuration. I have already tried to increase the timeout time, but this has not led to any change. Is there anything else I have to do to get the external oscillator working? Due to this problem, i tested my software with the internal oscillator of the psoc device.

The second question concerns pwm. Within the scope of the project, an integrated circuit generates a 400 kHz pwm signal from which the psoc is to determine the duty cycle. I know that the frequency of the pwm signal is quite high, but the hardware is already there. I have tried the solution from post https://community.cypress.com/t5/PSoC-5-3-1-MCU/PSoC-5LP-Duty-Cycle/m-p/213916 and for low frequencies it works so far. For higher frequencies or the target frequency, however, it looks like so many interrupts are generated that the psoc no longer leaves the isr and freezes as long as the signal is present. Since I have no more ideas myself and have not found any other working solutions, I would like to ask everyone if anyone can help me with this problem. The workspace is attached to this post. (The other stuff in the project is working as intended)

Thank you for your help.

 

Best regards,

Andreas

0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Andreas,

Let's first try to solve your first issue (Ext Osc @ 8 MHz).

I've attached a modified version of your project that correctly assigns a digital input as the External Oscillator source.

Here's my steps:

  • Added new schematic page in your TopDesign called Ext_Oscillator.
  • Added a new Digital_Input component with a wire trace called EO_8M.
    Len_CONSULTRON_0-1623084221640.png
  • Make the pin assignment for this new input.  For example you can chose P15[0] or P15[1].
  • Changed the System Clocks assignment by
    • deselecting the XTAL check box. 
    • selecting the Digital Signal check box
    • Select the "..." to the right of the Name: field.
    • Selected the EO_8M signal in the "Select source clock" window.
      Len_CONSULTRON_2-1623084478912.png
    • Added "8 MHz" in the Frequency: field.
    • Select "OK" to go back to the "Configure System Clocks" window.

  • Len_CONSULTRON_1-1623084390973.png
  • Select the "Osc"  selection in the "IMO" box.
  • Change the "Input:" field to "Digital Signal" in the "PLL" box.

These changes Application Builds without errors.

Give it a try.

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
3 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Andreas,

Let's first try to solve your first issue (Ext Osc @ 8 MHz).

I've attached a modified version of your project that correctly assigns a digital input as the External Oscillator source.

Here's my steps:

  • Added new schematic page in your TopDesign called Ext_Oscillator.
  • Added a new Digital_Input component with a wire trace called EO_8M.
    Len_CONSULTRON_0-1623084221640.png
  • Make the pin assignment for this new input.  For example you can chose P15[0] or P15[1].
  • Changed the System Clocks assignment by
    • deselecting the XTAL check box. 
    • selecting the Digital Signal check box
    • Select the "..." to the right of the Name: field.
    • Selected the EO_8M signal in the "Select source clock" window.
      Len_CONSULTRON_2-1623084478912.png
    • Added "8 MHz" in the Frequency: field.
    • Select "OK" to go back to the "Configure System Clocks" window.

  • Len_CONSULTRON_1-1623084390973.png
  • Select the "Osc"  selection in the "IMO" box.
  • Change the "Input:" field to "Digital Signal" in the "PLL" box.

These changes Application Builds without errors.

Give it a try.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Anonymous91
Level 1
Level 1
First reply posted First question asked Welcome!

Dear Len,

thank you very much for your quick reply. I must say that i am a little confused about the quartz and the answer. From the data sheet I have seen that pins 15[0] and 15[1] are for the connection of an external crystal.
The colleague who designed the hardware has connected the above-mentioned crystal with the corresponding capacitances to these two pins. Is that correct as far as it goes (Because at the moment the quarz is connected to those two pins with the capacitors mentioned in its datasheet)?
I have checked the hardware again and tried the suggested solution, but i still end up in function xx after supplying the hardware and the controller. Since it could also be the quartz itself, I ordered a new one and will try again.

Regardless of this, the bigger problem in my eyes is the issue with the 400 kHz signal. I don't really have any idea how to measure this with the Psoc. I would be very grateful for any suggestions for solutions.

Many thanks and greetings,

Andreas

0 Likes

Andreas,

I'd like to first apologize.  My project modifications were based on your statement that you were using an "external oscillator".  In my experience an external oscillator is different than an external crystal. 

I see from the part number you supplied it is a crystal.  My project modifications were based on this incorrect understanding.  Ignore there modifications.  They apply to an external oscillator configuration.

About your 400KHz PWM duty cycle measurement:

What is the desired accuracy of the duty cycle you wish to measure?  +/- 10%, +/-5%, +/-1%?

Let's say you want +/- 1%.  Therefore you need at least 100x the target frequency (in this case it is the 400 KHz of the PWM.)  Therefore, at a very minimum, you would need a input clock to a counter or timer to be 400 KHz * 100 = 40 MHz.

Since your BUS_CLK is set to 48 MHz, this should be sufficient enough.

How do you measure the duty cycle?   I have provided to this forum a tutorial on 8 different ways to measure frequency.  Each method is illustrated in a project.  The projects go from simpler but less accurate to more complex but more accuracy.

Here is a link to this tutorial:  Multi-Input-Frequency-Measurement-Tutorial 

This tutorial should be useful for you to measure the duty cycle but you would have to make a couple of changes.  1) You have to trigger the timer value read on both edges.  2) The count value you obtain from the trigger has to be sync'd to the edge that caused it (ie. Is it the low width or the high width?).

I hope this helps.

 

Len
"Engineering is an Art. The Art of Compromise."
0 Likes