Multi-implementation Custom Component

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.
cadi_1014291
Level 6
Level 6
25 likes received 10 likes received 10 likes given

Greetings all 😄

   

I have some spare time and i will like to build some custom components that work on PSoC 5LP and PSoC 4 (all or most of the families, 4200, 4M, 4L, 4S), the component is based on a SPI Master plus some other components.

   

My problem is that PSoC 4200 doesn't have the same SPI (SCB based) that PSoC 5LP (UDBs or FF based), so i think i must do a schematic implementation for 4200 and another one for 5LP.

   

I find out that the PWM component have been implemented similar to what i need (see image attached), there's one schematic implementation for each PSoC Architecture(?), but i can't find where or how can Creator 'know' what PSoC we are using on the design, and based on that choose the appropriate implementation.

   

   

Any ideas on how can i solve this problem?, i have not found information about this in the forum or documentation, or maybe i'm not searching properly.

   

Thanks in advance, any suggestion will be welcome :D, attached a Workspace with PWM and SPI components imported to see how the components works internally.

   

Carlos

0 Likes
1 Solution
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Carlos, open some Cypress component files (*.h, *.c, *.v), e.g. Timer, and there are conditional compilation constants for PSoC4, 5, etc.

View solution in original post

0 Likes
4 Replies
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Carlos, open some Cypress component files (*.h, *.c, *.v), e.g. Timer, and there are conditional compilation constants for PSoC4, 5, etc.

0 Likes
cadi_1014291
Level 6
Level 6
25 likes received 10 likes received 10 likes given

Hi odissey1

   

I did open the PWM component, it also have 3 implementations, but the macros you point out are for code generation, my doubt is on how Creator choose the right Schematic Implementation of the component based on the device selected on the project, in the image i did attach there you can see 3 folders, each one with a different schematic implementation based on PSoC 3, 4, and 5LP Architectures.

   

Hope i'm explaning well my doubt, english is not my language and i write the sentences as if it's spanish 😄

   

Thanks for the help

   

Carlos

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

Carlos,

   

afaik in the beginning of creating a new component you are asked whether it is a generic component or family specific. This would result in writing (more: copying) the component to implement it for different PSoCs (3,4,5)

   

 

   

Bob

cadi_1014291
Level 6
Level 6
25 likes received 10 likes received 10 likes given

Hi Bob, yes i was forgetting Creator allow me to choose the specific Architecture, Family and Device i will create the component for.

   

Just for test i start creating a Library, then Add Component Item, give it a name and change the Architecture and Family accordingly, design the Schematic Implementation, and then right-clic on the component name, choose Add Component Item and change the Architecture and Family, did this several times with multiple PSoC Families (see image below):

   

 

   

   

   

This solves my question partially, still have to test the component in projects with different PSoC Devices to see what implementation is chosen, will post the results.

   

 

   

Thanks odissey and Bob for the help, customer support on the forum do PSoC Rocks even more 😄

   

 

   

Carlos

   

0 Likes