Thank you in advance!
It takes 1 cpu cycle count. maybe 31,25ns. See ARM Information Center
Also the assembler generates alternative instruction which does nothing, such mov r0, r0
You can measure instruction cycles with DWT_CYCCNT
Ah, something like this:
uint32_t cycles = 0;/* DWT struct is defined inside the core_cm4.h file */DWT->CTRL |= 1 ; // enable the counterDWT->CYCCNT = 0; // reset the counterdelayUS(1); // <-- here my Nop()cycles = DWT->CYCCNT;cycles--; /* We subtract the cycle used to transfer CYCCNT content to cycles variable */
Carmine Noviello tutorial How to precisely measure microseconds with STM32
Thank you very much!
I tried to use the TSL2591 Lux sensor with hardware i2c master to no avail. The same hardware i2c master library works excellent with the PCF8583 RTC (normal clock operations, daily alarm and weekdays alarm tested so far) so I know that the library is well implemented (made by Tilen and adapted to my needs).
The TSL2591 Lux sensor works with an Arduino board using Adafruit libraries and works as well using my Nucleo board but I want to program it in C using LL. The Adafruit uses a software i2c library and I thought I may need to use one myself. Also I ordered another Lux sensor, MAX44009, much better but the manufacturer recommends a software implementation of the i2c protocol. So, I have that implementation from MAXIM, which I will adapt to my board, but also this as well GitHub - GouMinghao/STM32_Software_I2C_Master: This program is a project for MCU stm32f103zet6 to achieve I2C communicat…
If MAX44009 doesn't work with the hardware i2c (that would be my first try), I will need the software i2c. So I will need some good delays (well, whatever makes a functional software i2c).
The latest TRM revision is here ARM Cortex‑M3 Processor Technical Reference Manual Revision r2p1 | Preface – Arm Developer
Retrieving data ...