Skip to main content
LK_it
Associate II
September 23, 2022
Solved

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

  • September 23, 2022
  • 1 reply
  • 1529 views

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.

This topic has been closed for replies.
Best answer by John E KVAM

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;
}
 

1 reply

John E KVAM
John E KVAMBest answer
ST Employee
November 7, 2022

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;
}