2017-10-29 05:05 PM
Thank you in advance!
Solved! Go to Solution.
2017-10-30 06:15 AM
Hello,
It takes 1 cpu cycle count. maybe 31,25ns. See
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0337h/CHDDIGAC.html
Also the assembler generates alternative instruction which does nothing, such mov r0, r0
Regards
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2017-10-29 06:10 PM
You can measure instruction cycles with DWT_CYCCNT
2017-10-30 04:59 AM
Ah, something like this:
uint32_t cycles = 0;
/* DWT struct is defined inside the core_cm4.h file */
DWT->CTRL |= 1 ; // enable the counter
DWT->CYCCNT = 0; // reset the counter
delayUS(1); // <-- here my Nop()
cycles = DWT->CYCCNT;
cycles--; /* We subtract the cycle used to transfer
CYCCNT content to cycles variable */�?�?�?�?�?�?�?�?�?
Carmine Noviello tutorial
https://www.carminenoviello.com/2015/09/04/precisely-measure-microseconds-stm32/
2017-10-30 06:15 AM
Hello,
It takes 1 cpu cycle count. maybe 31,25ns. See
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0337h/CHDDIGAC.html
Also the assembler generates alternative instruction which does nothing, such mov r0, r0
Regards
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2017-10-30 07:31 AM
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
https://github.com/GouMinghao/STM32_Software_I2C_Master
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