cancel
Showing results for 
Search instead for 
Did you mean: 

STSW-IMG035 Minimum Resource Requirements (DMIPS) on HOST MCU

LK
Associate II

Hi all,

i'd like to know the typical resource requirements (mainly required computing power / DMIPS value) of running the TouchLessControl library (STSW-035) library on a host MCU.

The GestureEVK-UM.pf mentions a typical RAM and FLASH footprint :

0693W00000Sw5bFQAR.pngI know that the library is also availble for Cortex-M0...

But I can not find maximum usage of (D)MIPS, required to run the STSW-035 SW stack.

Even if its may hard to give an exact value due to mapping of DMIPS to real world algorithms -  There are interrupts, DMA, peripherals, RTOS, .... - an indicative DMIPS range would be quite helpful.

1 ACCEPTED SOLUTION

Accepted Solutions
John E KVAM
ST Employee

That's a tricky one to answer.

But the biggest expenditure of time is the I2C traffic. You will need to tranfer 64 16-bit distances, 64 32-bit signal strenghts, 64 8-bit target numbers and 64 8-bit status values. And there are 15 of these per second.

So keep that in mind.

But rather than give you a number I want to give you some code.

Figure out where you want to measure and add the code.

If you use the STSW-IMG035_F401 it runs at 84MHz,

I know I'm making you do the work. But everyone should know this trick.

  • john

Just add these defines in your code and then the functions.  Simply call the stopwatch_reset to both enable the counter and it resets it to 0.  Then do the stopwatch_getticks to get the current value.  I also add in my watch expressions the *0xE0001004, so if I put in a break point, I can see the current value of the counter.
 
// Defines to be added
#define DEMCR_TRCENA    0x01000000
 
/* Core Debug registers */
#define DEMCR           (*((volatile uint32_t *)0xE000EDFC))
#define DWT_CTRL        (*(volatile uint32_t *)0xe0001000)
#define CYCCNTENA       (1<<0)
#define DWT_CYCCNT      ((volatile uint32_t *)0xE0001004)
#define CPU_CYCLES      *DWT_CYCCNT
 
// Functions to be added.
static inline void stopwatch_reset(void)
{
    /* Enable DWT */
    DEMCR |= DEMCR_TRCENA;
    *DWT_CYCCNT = 0;
    /* Enable CPU cycle counter */
    DWT_CTRL |= CYCCNTENA;
}
 
static inline uint32_t stopwatch_getticks(void)
{
    return CPU_CYCLES;
}
 


Our community relies on fruitful exchanges and good quality content. You can thank and reward helpful and positive contributions by marking them as 'Accept as Solution'. When marking a solution, make sure it answers your original question or issue that you raised.

ST Employees that act as moderators have the right to accept the solution, judging by their expertise. This helps other community members identify useful discussions and refrain from raising the same question. If you notice any false behavior or abuse of the action, do not hesitate to 'Report Inappropriate Content'

View solution in original post

1 REPLY 1
John E KVAM
ST Employee

That's a tricky one to answer.

But the biggest expenditure of time is the I2C traffic. You will need to tranfer 64 16-bit distances, 64 32-bit signal strenghts, 64 8-bit target numbers and 64 8-bit status values. And there are 15 of these per second.

So keep that in mind.

But rather than give you a number I want to give you some code.

Figure out where you want to measure and add the code.

If you use the STSW-IMG035_F401 it runs at 84MHz,

I know I'm making you do the work. But everyone should know this trick.

  • john

Just add these defines in your code and then the functions.  Simply call the stopwatch_reset to both enable the counter and it resets it to 0.  Then do the stopwatch_getticks to get the current value.  I also add in my watch expressions the *0xE0001004, so if I put in a break point, I can see the current value of the counter.
 
// Defines to be added
#define DEMCR_TRCENA    0x01000000
 
/* Core Debug registers */
#define DEMCR           (*((volatile uint32_t *)0xE000EDFC))
#define DWT_CTRL        (*(volatile uint32_t *)0xe0001000)
#define CYCCNTENA       (1<<0)
#define DWT_CYCCNT      ((volatile uint32_t *)0xE0001004)
#define CPU_CYCLES      *DWT_CYCCNT
 
// Functions to be added.
static inline void stopwatch_reset(void)
{
    /* Enable DWT */
    DEMCR |= DEMCR_TRCENA;
    *DWT_CYCCNT = 0;
    /* Enable CPU cycle counter */
    DWT_CTRL |= CYCCNTENA;
}
 
static inline uint32_t stopwatch_getticks(void)
{
    return CPU_CYCLES;
}
 


Our community relies on fruitful exchanges and good quality content. You can thank and reward helpful and positive contributions by marking them as 'Accept as Solution'. When marking a solution, make sure it answers your original question or issue that you raised.

ST Employees that act as moderators have the right to accept the solution, judging by their expertise. This helps other community members identify useful discussions and refrain from raising the same question. If you notice any false behavior or abuse of the action, do not hesitate to 'Report Inappropriate Content'