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

PSoC™ 6 Forum Discussions

PaSw_2578827
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

I have a project for which the underlying codebase was developed in PSoC Creator but the user will be using a higher level programming interface to do some simple setup. One of the things they can do is create an encoder object. In order to do this I need to setup a TCPWM instance directly in code by calling the PDL functions and similarly assign the inputs via the trigger multiplexer. This all seems perfectly fine, but the issue is that I can't figure out a way to guarantee that I don't potentially break (by trying to reuse) trig mux channels that the PSoC Creator has already configured? The same applies to TCPWM channels, but at least they seem relatively easy to find in the component generated source.

0 Likes
1 Solution

Hello PaSw_2578827​,

As the CM0p and CM4 projects are completely unrelated, there might not be a way to confirm that there will not be any conflict in the allocation of hardware resources. The best way is to assign the right hardware resource in each project and debug the project to see if there are any conflicts. For assigning the Trig Mux group please refer to Figure 23-4. PSoC 6 MCU Trigger Multiplexer Block Architecture in PSoC 6 MCU Architecture TRM, Page 229.

You can also try assigning interrupts to the hardware block used and then change the state of the pins in the interrupt handlers.

Hope this helps,

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B

View solution in original post

3 Replies
Rakshith
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello PaSw_2578827​,

According to my understanding, you want to guarantee that you do not reconfigure the mux channels that are already used. Will you be using the Top Design in your project or is the entire hardware initialized through the code?

As you are using a PSoC 6 device, it is easier to use the Hardware Abstraction Layer (HAL) provided with ModusToolbox. HAL internally maintains a record of the resources used so that the user need not worry about it.

Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes

Thanks for the response, your understanding is exactly correct.

Right now I'm using the Top Design for part of the project and then initializing the rest in code (within a different IDE). Basically the M0p code is built in PSoC Creator (using a Top Design) but the M4 code is developed outside of PSoC creator and then the two elf files are linked. It all works quite well with the exception of keeping track of used resources. I haven't used ModusToolbox at all yet and was trying to avoid having to migrate to that right now, I've been referencing the PDL for the code development required on the M4.

The M0p code is fairly static so once its developed it shouldn't change much, my solution is a little hacky but acceptable in that thus far, for the TCPWM I've just been checking what timer blocks the M0p is using (this info is in cyfitter.h) and making sure they were reserved on the M4. I can't figure out where to find that info for the TrigMux though.

Thanks

0 Likes

Hello PaSw_2578827​,

As the CM0p and CM4 projects are completely unrelated, there might not be a way to confirm that there will not be any conflict in the allocation of hardware resources. The best way is to assign the right hardware resource in each project and debug the project to see if there are any conflicts. For assigning the Trig Mux group please refer to Figure 23-4. PSoC 6 MCU Trigger Multiplexer Block Architecture in PSoC 6 MCU Architecture TRM, Page 229.

You can also try assigning interrupts to the hardware block used and then change the state of the pins in the interrupt handlers.

Hope this helps,

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B