Is there a way to provice a set clock speed to a custom UDB-based component?

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

cross mob
user_443952341
Level 1
Level 1

Essentially what the question in the title says - I'm making a driver for a peripheral which uses a custom communication scheme with a set clock speed - so it would be pretty silly to give the component user the choice over that clock speed. I want to set the rate for the component - i.e. have an component-internal clock.

I'm building the component using the UDB Editor but I'd be happy using the Datapath editor if that's the only way to accomplish this.

0 Likes
1 Solution

You can make that a hidden component

How does one do that? I saw no option to "hide" a component in PSoC Creator and a web search yields no results.

http://www.cypress.com/file/137436/download

The CAG is your friend.  Page 37:

Doc.CatalogVisibilityExpression – Used to enter an expression to show the symbol in the Component Catalog. If this expression evaluates to 'false' and the "Show Hidden Components" option (Tools > Options > Design Entry > Component Catalog) is not enabled, the symbol (or schematic macro) will not be displayed in the Component Catalog.

That said, it generally is a bad choice to bury a clock like this as it isn't clear that you're using a resource. 

I was planning to make that consumed resource clear in the component datasheet.

It still makes sharing the clock difficult if there's other logic they can key off of it.  Or if they have a design wide clock they want to use, or external crystal for less jitter.  Burying the clock artificially restricts the user in multiple ways, not just the one you're thinking of.

It is generally better to query the clock at code generation time and give the user an error if the specified clock is out of spec.

How one would go about doing that? Would that be something done with a Control File? If so, do you know any good resources / examples of writing control files? The build-in PSoC help seems very high-level.

You need to do the query in C# code.  If you import the USB component you can probably find sample code to do this, as the USB component will trigger an error if the clock is set incorrectly.  Furthermore, I would encourage you to make it a warning rather than an error, as a user may want to debug at a slower speed with a logic analyzer or for some other reason.

Developing components is hard.  You probably should read through the component author guide and understand all of what is offered.

View solution in original post

0 Likes
3 Replies
ScottA_91
Employee
Employee
10 solutions authored 100 replies posted 50 replies posted

Components can be implemented in several ways.

Verilog

UDB file

Schematic

So let's say your communication component (foo) is implemented using a UDB file (via the UDB editor).  You can make that a hidden component and create another one (bar) that is implemented using a schematic.  In that schematic, you can place foo down and the clock you desire.

That said, it generally is a bad choice to bury a clock like this as it isn't clear that you're using a resource.  It is generally better to query the clock at code generation time and give the user an error if the specified clock is out of spec.

0 Likes

You can make that a hidden component

How does one do that? I saw no option to "hide" a component in PSoC Creator and a web search yields no results.

That said, it generally is a bad choice to bury a clock like this as it isn't clear that you're using a resource. 

I was planning to make that consumed resource clear in the component datasheet.

It is generally better to query the clock at code generation time and give the user an error if the specified clock is out of spec.

How one would go about doing that? Would that be something done with a Control File? If so, do you know any good resources / examples of writing control files? The build-in PSoC help seems very high-level.

0 Likes

You can make that a hidden component

How does one do that? I saw no option to "hide" a component in PSoC Creator and a web search yields no results.

http://www.cypress.com/file/137436/download

The CAG is your friend.  Page 37:

Doc.CatalogVisibilityExpression – Used to enter an expression to show the symbol in the Component Catalog. If this expression evaluates to 'false' and the "Show Hidden Components" option (Tools > Options > Design Entry > Component Catalog) is not enabled, the symbol (or schematic macro) will not be displayed in the Component Catalog.

That said, it generally is a bad choice to bury a clock like this as it isn't clear that you're using a resource. 

I was planning to make that consumed resource clear in the component datasheet.

It still makes sharing the clock difficult if there's other logic they can key off of it.  Or if they have a design wide clock they want to use, or external crystal for less jitter.  Burying the clock artificially restricts the user in multiple ways, not just the one you're thinking of.

It is generally better to query the clock at code generation time and give the user an error if the specified clock is out of spec.

How one would go about doing that? Would that be something done with a Control File? If so, do you know any good resources / examples of writing control files? The build-in PSoC help seems very high-level.

You need to do the query in C# code.  If you import the USB component you can probably find sample code to do this, as the USB component will trigger an error if the clock is set incorrectly.  Furthermore, I would encourage you to make it a warning rather than an error, as a user may want to debug at a slower speed with a logic analyzer or for some other reason.

Developing components is hard.  You probably should read through the component author guide and understand all of what is offered.

0 Likes