Skip to main content
ZKURT.1
Senior
December 16, 2021
Question

There is no DWT in the M0/M0+ kernel.

  • December 16, 2021
  • 8 replies
  • 4898 views

Hi. I am using stm32l01c6tx. I want to use a very simple microsecond function. Libraries I have added below. "DWT" "CTRL" etc. when I included the libraries. It says not defined. But they are all in the "core_cm4.h" library. This library is in Drivers-> CMSIS->Include.

The STM32L010C6TX uses M0+ cores, not M4 cores. so it uses "core_cm0plus.h".

There is no DWT in the M0/M0+ kernel. My question is DWT, CTRL etc. What can I use instead? Can I use these functions for STM32L0 Series?

This topic has been closed for replies.

8 replies

ZKURT.1
ZKURT.1Author
Senior
December 16, 2021
waclawek.jan
Super User
December 16, 2021

Cortex-M0/M0+ (or, more precisely, any ARMv6-M implementation, but that's probably only Cortex-M0 and M0+) does have a DWT unit, but it's different from the Cortex-M3/4/7 one, and does not have the CYCCNT register, which you are looking for.

You have to use some of the timers for this sort of functionality, or SysTick, but given 'L0 have no 32-bit timers, this is a bit less convenient, you have to account for the wraparound at 16 bits.

JW

ZKURT.1
ZKURT.1Author
Senior
December 17, 2021

So how can I do it using a timer? https://www.youtube.com/watch?v=SqC0IhLKJ9o&ab_channel=ControllersTech I did as it shows in the video but the program didn't work. Most likely APB2, prescaler, counter mode etc. I have an error in the values. How do I write those values?

TDK
December 16, 2021
"If you feel a post has answered your question, please click ""Accept as Solution""."
ZKURT.1
ZKURT.1Author
Senior
December 17, 2021

So how can I do it using a timer? https://www.youtube.com/watch?v=SqC0IhLKJ9o&ab_channel=ControllersTech I did as it shows in the video but the program didn't work. Most likely APB2, prescaler, counter mode etc. I have an error in the values. How do I write those values?

ZKURT.1
ZKURT.1Author
Senior
December 17, 2021

..