Hi Oliver, See my answer about printf below. I'm not enough expert with timer accuracy but there are known issues with xtimer, maybe have a look at related issues/PRs on github ?
----- Le 31 Juil 19, à 15:02, oliver [email protected] a écrit : > 1 Question: > > I try to calculate some floating point digits on the SAMR21-xpro Board. > When I print the floating point digit it shows me nothing. > > My Code: > ================================================================= > uint32_t time_diff = 554; > > double distance = (33./2000.) * time_diff; > printf("distance = %f cm\n",distance); > ================================================================= > > Output: > ================================================= > 2019-07-31 14:36:58,631 - INFO # distance = cm > ================================================= > > Stack Overflow [1] tells me that floating point are disabled by default > on arm-gcc. > Whats the trick ?? > What should I add to the Makefile ? Just add USEMODULE += printf_float to your application Makefile. Note that this will noticeably increase the generated firmware size. Alex > > > 2. Question: > > If I try to print (using printf) uint64_t variables I have the some > problem as above. > > > 3. Question: > > How precise is the current system time on RIOT ?? > I set a GPIO HIGH and LOW with a time difference of 100 and less > microseconds. Before I set the GPIO HIGH and LOW, I call function [2]. > If I compare the time with an oscilloscope I get horrible deviations. > What is the best way to measure microseconds and on RIOT with the > highest accuracy. > > > > > [1] > https://stackoverflow.com/questions/12703307/arm-none-eabi-gcc-printing-float-number-using-printf#25723994 > [2] static uint32_t xtimer_now_usec() > > > -- > Best Regards > > Oliver Koepp > _______________________________________________ > users mailing list > [email protected] > https://lists.riot-os.org/mailman/listinfo/users _______________________________________________ users mailing list [email protected] https://lists.riot-os.org/mailman/listinfo/users
