alias names for component registers

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

cross mob
wwfeldman
Level 3
Level 3
First like received Welcome!

AN84810, page 19:

5. You can use either the absolute address (0x5151) or the alias (Input_Signal_PS) in your code to address the port

pin state register.

You can find out the alias names for the Component registers from the “.h” generated file of the Component.

These files are automatically generated by PSoC Creator when you build the project.

I have several Basic Counters (16 bit up counter) and D FlipFlops (16 bit latch) in a PSoC5LP in KIT-059.

I have built the design.

There are no .h files for these components.

Questions:

1) what components does the ap note refer to when it uses "components"

2) is it possible to capture the count of these counters and DFF via DMA operations?

3) if so, how? details please

4) apparently all logic done in UDBs have registers that (presumably) can be read via DMA

how does one find out which registers are associated with what components built from/in UDBs?

5) if not, any suggestions on how to recover the values?

0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Lawrence,

When you allocate Basic Counters, DFF, AND, OR,  XOR, INVERT   ... etc, elements they are building blocks that are used by the more complex circuits such as the PWM, Timer, Counter.  These building block elements are allocated during the Application Build process.  When you allocate a PWM, Timer, Counter and so on, the component selects the building block elements with other logical connections to make the more complex timer/counter operations.  The building block components are intended to be low-level design elements for you to customize your HW logic.

Q1) The component datasheets aren't always detailed as to what the components actually are.  In the PSoC, there are fixed-function blocks.  ADCs, DFB, OPAMPS, FF Counters are examples.   They are for the most part hard-wired which somewhat limits its functionality but maximizes performance and optimizes space on the IC.  Other functions can be created using UDB elements.  Think of these elements as logic in a large-scale PLD (Programmable Logic Device) which it is in actuality.   Components created by Cypress or even users, can make use of this high-level of flexibility to create very sophisticated HW logic and analog functions.   In fact, it is not unusual for a person to create a component that uses fixed-function blocks with UDB elements to optimize their application.

Q2) Yes, DMA can be used with UDB components.  To do so, you need to allocate components with memory addressable registers.  Reading the input or output of Basic Counter, DFF, AND, OR , XOR, INVERT ... etc is not directly memory addressable.   However see my answer to your Q3)

Q3) You probably noticed that a Basic Counter allocated with a width of 16 has an output of cnt[15:0].  This is an array of individual HW signals that can be broken out to connect to other HW logic.  If you want to read the counter output of this component, you need to attach cnt[15:0] to two Status Registers (one register for each 8 bits).  The CPU (or DMA) can then read the immediate counter by the memory addressable Status Registers.

Q4 & Q5) Some of the more complex components have Status Registers to read current status of logic AND Control Registers control component function either by SW or by DMA.

The easiest way to know which status (or control) registers you need to access with the DMA  is to perform Build Application and then find the registers used if you were to access this information using the SW through the API call.  For example:  If I use a Timer component and want to read the Capture data, I Build the Application and I look at the Timer_ReadCapture() function.

uint16 Timer_ReadCapture(void)

{

   #if(Timer_UsingFixedFunction)

       return ((uint16)CY_GET_REG16(Timer_CAPTURE_LSB_PTR));

   #else

       return (CY_GET_REG16(Timer_CAPTURE_LSB_PTR));

   #endif /* (Timer_UsingFixedFunction) */

}

You see that the return value using SW is reading a 16-bit register with the pointer Timer_CAPTURE_LSB_PTR.  This is the memory-addressable register you would use in your DMA description.

Using DMA is not for the faint-of-heart.  But once you understand its power and limitations, you'll have fun with it.  I know I do.

I hope this helps.

Len

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

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

Lawrence,

You can find all registers name in the cyfitter.h file after project build. The cyfitter file  can be found at the bottom of the project explorer panel.

/odissey1

0 Likes

thank you

that seems to cover the I/O pins and the parts that have DMA built in

and that can be accessed via the DMA wizard

0 Likes
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Lawrence,

When you allocate Basic Counters, DFF, AND, OR,  XOR, INVERT   ... etc, elements they are building blocks that are used by the more complex circuits such as the PWM, Timer, Counter.  These building block elements are allocated during the Application Build process.  When you allocate a PWM, Timer, Counter and so on, the component selects the building block elements with other logical connections to make the more complex timer/counter operations.  The building block components are intended to be low-level design elements for you to customize your HW logic.

Q1) The component datasheets aren't always detailed as to what the components actually are.  In the PSoC, there are fixed-function blocks.  ADCs, DFB, OPAMPS, FF Counters are examples.   They are for the most part hard-wired which somewhat limits its functionality but maximizes performance and optimizes space on the IC.  Other functions can be created using UDB elements.  Think of these elements as logic in a large-scale PLD (Programmable Logic Device) which it is in actuality.   Components created by Cypress or even users, can make use of this high-level of flexibility to create very sophisticated HW logic and analog functions.   In fact, it is not unusual for a person to create a component that uses fixed-function blocks with UDB elements to optimize their application.

Q2) Yes, DMA can be used with UDB components.  To do so, you need to allocate components with memory addressable registers.  Reading the input or output of Basic Counter, DFF, AND, OR , XOR, INVERT ... etc is not directly memory addressable.   However see my answer to your Q3)

Q3) You probably noticed that a Basic Counter allocated with a width of 16 has an output of cnt[15:0].  This is an array of individual HW signals that can be broken out to connect to other HW logic.  If you want to read the counter output of this component, you need to attach cnt[15:0] to two Status Registers (one register for each 8 bits).  The CPU (or DMA) can then read the immediate counter by the memory addressable Status Registers.

Q4 & Q5) Some of the more complex components have Status Registers to read current status of logic AND Control Registers control component function either by SW or by DMA.

The easiest way to know which status (or control) registers you need to access with the DMA  is to perform Build Application and then find the registers used if you were to access this information using the SW through the API call.  For example:  If I use a Timer component and want to read the Capture data, I Build the Application and I look at the Timer_ReadCapture() function.

uint16 Timer_ReadCapture(void)

{

   #if(Timer_UsingFixedFunction)

       return ((uint16)CY_GET_REG16(Timer_CAPTURE_LSB_PTR));

   #else

       return (CY_GET_REG16(Timer_CAPTURE_LSB_PTR));

   #endif /* (Timer_UsingFixedFunction) */

}

You see that the return value using SW is reading a 16-bit register with the pointer Timer_CAPTURE_LSB_PTR.  This is the memory-addressable register you would use in your DMA description.

Using DMA is not for the faint-of-heart.  But once you understand its power and limitations, you'll have fun with it.  I know I do.

I hope this helps.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

thank you

i added the status registers and exceed the macrocell count and the product term count

so i'm looking at solving that one, then back to the DMA

0 Likes

Lawrence,

Many questions can be resolved if you post your project here for review. To do so: (1) Build->Clean. (2) File->Create Worspace Bundle->Minimal. (3) in newly created archive delete Generated_Source folder to reduce file size.

It is better to start developing application by making a small test projects. Once debugged and optimized, combine them into larger application.

/odissey1

0 Likes

not quite ready to post it

still working on figuring it out

thank you

0 Likes

Lawrence,

I generally stay away from using the Basic Counters if I'm going to use DMA with it.  This is because I would need to hook up Status registers at a minimum.  Additionally, extra care needs to exercised with the Status Register configuration to work flawlessly with DMA.

I'd usually prefer to use a Fixed Function Counter if possible.  The Status and Control registers are built into the physical device.  Therefore it doesn't use any UDB Status or Control registers.

If the Fixed Function Counter will not work in my app, I use the UDB version.  This does automatically allocate Status and Control registers as needed.  Which means you could still exceed the UDB macrocell count.

Take a look at your design, you probably are using multiple Timers/Counters/PWM components.  See if these components might be combined or eliminated.  For example, it is a common thing to allocate one or more Timers to perform an interval timeout functions.  The Timer is connected to an ISR when the term count occurs.  If the Timer is occasional and the resolution and latency is not hyper-critical, you might consider using the system SysTick calls.   Usually the SysTick is at 1ms resolution and there are ways to create SysTick server code to internally set flags when a time interval is expired.  This allows for a single SysTick timer to be used for virtually unlimited application interval notifications.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes