A little help with understanding custom component in the example CE204087

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

cross mob
SaKrst
Level 3
Level 3
5 likes given First like received First like given

Hi,

I am trying to understand the way to create the custom component like in example of CE204087 ​​that has NVRAM_SPI component.

The part that is troublesome for me to understand is how to create a component like NVRAM_SPI in which I could, for example, change the frequency of the clock component, or the spi mode of the spi master component that are contained as a part of the NVRAM_SPI component.

What I figured out so far, is that by changing the values of the symbol parameters of the mentioned example in NVRAM_SPI.cysym I get different values in the schematic of the component, but if I try to make component from scratch by myself the value of the clock remains the same as it was, and spi mode as well, so I think I'm missing how to make a link between components that are on NVRAM_SPI.cysch and parameters in NVRAM_SPI.cysym

I hope I managed to explain what bothers me, and I apologize if I missed similar topic on community as well.

Thanks,

Sava

1 Solution

Sava,

Attached is demo project showing how to pass a parameter from custom component to internal component (e.g. clock). It is simple, but takes time to explain. Please follow steps below.

1.  Custom component have simple parameter "Frequency" (1000 kHz), which we want to pass to internal Clock_1 (which has default setting 12 MHz):

Set parameter_A.png

Basic Dialog:

Dialog_A.png

2. Let's create a component "myComponent" and add parameter "Frequency".

Component symbol:

myComponent_symbol_A.png

Component parameters:

Component_Parameters_A.png

Component schematic

Component schematic_A.png

3. Now we need some magic to be able to pass this Frequency parameter to Clock_1.

First we need to update Project->Options:

Project Options_A.png

4. Now lets set Clock_1 parameters. Open Clock_1 settings:

Clock_settings_01a.png

5. First change MHz to kHz:

Clock_settings_kHz_A.png

6. Now is the trick: Use Left-mouse button over Basic parameters and notice a drop-down menu. Now select "Show Expression View":

Express view_A.png

This is what shows up:

Expression view_B.png

7. Replace "12" with parameter "$Frequency":

Ezpression view_Frequency.png

Done! Now Clock_1 in the myComponent set to 1000 kHz. Project attached.

/odissey1

View solution in original post

5 Replies
Ekta_N
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hello SaKr_2051156,

In order to change the frequency, spi mode, etc associated with component you would have to add these as parameters to the component.

To do so, go to the cysym file of the custom component you have created > Right click and Select Symbol parameters...

pastedImage_1.png

Add the desired parameters in the parameter definition dialog box as shown in the figure below:

pastedImage_0.png

Set the 'Hardware' flag to "True" in the Misc settings field. This exposes the parameter to the Verilog code so that the UDB hardware can use it.

Please refer to the Adding parameter section (on page 23) of the  Designing PSoC Creator Components with UDB Datapaths: https://www.cypress.com/file/41531/download

for detailed steps to add parameter.

Please let me know if this resolves the issue.

Regards

Ekta

0 Likes
SaKrst
Level 3
Level 3
5 likes given First like received First like given

Hi EktaN_26​,

Thanks for the fast reply. I have tried to set the 'Hardware' flag to "True" and it did not work for me. This is the case when I try to make my own component that is like in the CE204087 project. The parameters that are on symbol page are not changing anything on the schematic page of the component.

Further more, when deleting the parameter spi_frequency on the symbol page of the CE204087 project it gives me this on the schematic page of the component

PSoC_Creator.jpg

which would mean that that SPI_CLK component, and SPIM component are somehow altered to take the values of the parameters that are defined on the symbol page(spi_mode and spi_frequency).

My question would be, how to connect the parameters on the symbol page with the components that are on the schematic page?

This looks like somehow the symbol of the clock component from CyPrimitives has modified parameters of desired_freq and desired_freq_unit. I assume desired_freq takes the value of the 2*spi_frequency, and that desired_freq_unit is set to 3 so it can be in kHz. Only I don't understand how to do this since CyPrimitives can't be edited, and this seems like a local instance of the component which I don't know how to make. I hope this didn't get more confusing then it already is 

Thanks,

Sava

0 Likes

Sava,

Attached is demo project showing how to pass a parameter from custom component to internal component (e.g. clock). It is simple, but takes time to explain. Please follow steps below.

1.  Custom component have simple parameter "Frequency" (1000 kHz), which we want to pass to internal Clock_1 (which has default setting 12 MHz):

Set parameter_A.png

Basic Dialog:

Dialog_A.png

2. Let's create a component "myComponent" and add parameter "Frequency".

Component symbol:

myComponent_symbol_A.png

Component parameters:

Component_Parameters_A.png

Component schematic

Component schematic_A.png

3. Now we need some magic to be able to pass this Frequency parameter to Clock_1.

First we need to update Project->Options:

Project Options_A.png

4. Now lets set Clock_1 parameters. Open Clock_1 settings:

Clock_settings_01a.png

5. First change MHz to kHz:

Clock_settings_kHz_A.png

6. Now is the trick: Use Left-mouse button over Basic parameters and notice a drop-down menu. Now select "Show Expression View":

Express view_A.png

This is what shows up:

Expression view_B.png

7. Replace "12" with parameter "$Frequency":

Ezpression view_Frequency.png

Done! Now Clock_1 in the myComponent set to 1000 kHz. Project attached.

/odissey1

Hi BoTa_264741​,

Yes, that is what I tried to figure out this whole time! I did read the PSoC Creator Component Author guide, but either I overlooked it or it's not there, and is in another document about PSoC Creator for example. This is fairly simple, yet I couldn't find it.

Thank you very much

Sava

P.S. I also have question about using custom NVRAM component and external memory interface address map but I'll open another topic about that.

Sava,

Unfortunately, this useful feature is not covered by any of manuals. It came by the word of mouth from Bob Marlowe:

Re: Component creation. Part 1 of ?

/odissey1