Logic gate kills clock signal?

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.
Anonymous
Not applicable

Hi All,

   

I'm trying to synchronize two PWM's using an AND gate and Control Reg. My thought was to set the Control Reg to zero by default, which would null the output of the AND gate. Then, in my main function, after both PWM's are initialized, I would set the Control Reg to 1 and active the AND gate to pass the clock signal through it.

   

The PWM's work fine without the AND gate. When the AND gate is added, nothing works. I've tried initializing the Control Reg to 1 and the PWM's still do not work.

   

It seems like a bug, has anyone else experienced this? Can anyone recommend an easy way to synchronized the PWM's?

   

Thanks,

   

Ken

   

 

   

********* main.c code **********

   

#include <device.h>

   

void main()

   

{

   

    CY_SET_REG8(CYREG_MLOGIC_DEBUG, CY_GET_REG8(CYREG_MLOGIC_DEBUG) | 0x40);

   

    PWM_1_Start();

   

    PWM_2_Start();

   

    Control_Reg_1_Write(1u);

   

    while(1);

   

}

0 Likes
8 Replies
Anonymous
Not applicable

 So I dropped the clock frequency down and it seems to run as expected at 1MHz.

   

Maybe there is an issue with the propagation delays at higher frequencies?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Most of the basic components run  up to 48MHz clock, so the issue will be caused by something different. Can you please post your complete project (with the AND-gate) with all of your settings? To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.



Bob
 

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 Files are attached. Thanks for the assistance.

   

 

   

- Ken

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Some thoughts:

   

You disabled the instruction cache?

   

Would be easier to use the enable input for the PWMs to start (and stop) counting instead of gating the clocks

   

You could use a two (2) output configuration which will be synchronus by design

   

You are using a rather old version of creator. I would suggest you to upgrade to version 3.1 or even to 3.2 early access.

   

 

   

Bob

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

It was a bit late yesterday night, so I will explain today my suggested changes:

   

Reset signal must be synchronus to clock

   

TC is one clock pulse

   

=> when tc is internally derived from Clk the rising edge of the reset signal may come too late and will not be seen.

   

 

   

In other words: When deriving the reset signal directly from Tc there might be some tough setup and hold times. Have a look at the diagrams in the PWM datasheet.

   

Problem could be solved by using a Pulse Converter component to get a reset pulse long enough.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

From datasheet reset is synch -

   

 

   

   

 

   

 

   

This shows reset being used directly from Tc.

   

 

   

 

   

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Hi Bob & Dana,

   

 

   

Thanks for such thorough help. I ended up dropping the gate and shifting the control reg to the reset line to get things moving.

   

I didn't want to use the dual output because this is an early stage in a more sophisticated system.

   

Regarding the instruction cache, I used an example project to get things moving and that must have been a remnant from the original program. Where did you see that and how can I re-enable it?

   

 

   

Thanks,

   

Ken

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

 On the *.cydwr file shown in workspace explorer

   

 

   

   

 

   

    

   

          

   

The heap and stack size were reduced in 3.1, try restoring to 3.0 levels 4K and 16K respectively.

   

3.1 default settings are now 128 bytes and 2K.

0 Likes