the function wiced_get_nanosecond_clock_value does not work

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi

I am trying to call the function "wiced_get_nanosecond_clock_value()" , but I get nothing.

I followed the same code used from apps.snip.

Please see attached code.

your help is really appreciated.

Thanks,

Ramzi

0 Likes
1 Solution
PriyaM_16
Moderator
Moderator
Moderator
250 replies posted 100 replies posted 50 replies posted

Hello,

Please have a look at this thread How to properly print a uint64_t on CYW43907

The function is returning the value but the format specifier used for printing the number seems to be giving the error.

You may print the unsigned long long int value by typecasting it to double and using the float identifier i.e., WPRINT_APP_INFO((" %f", (double)cpu_time_used));

View solution in original post

0 Likes
4 Replies
PriyaM_16
Moderator
Moderator
Moderator
250 replies posted 100 replies posted 50 replies posted

Hello,

Please have a look at this thread How to properly print a uint64_t on CYW43907

The function is returning the value but the format specifier used for printing the number seems to be giving the error.

You may print the unsigned long long int value by typecasting it to double and using the float identifier i.e., WPRINT_APP_INFO((" %f", (double)cpu_time_used));

0 Likes

Did you really test it?

uint64_t cpu_time_used = wiced_get_nanosecond_clock_value();

WPRINT_APP_INFO(("The time taken is %f \n", (double) cpu_time_used));

Above code prints below output:

The time taken is 0.000000

0 Likes

Yes Sir. I think you have not initialized the clock by calling platform_init_nanosecond_clock();

The console output is:

Starting WICED vWiced_006.001.000.0085

Platform CYW943907AEVAL1F initialised

Started ThreadX v5.8

Initialising NetX_Duo v5.10_sp3

Creating Packet pools

WLAN MAC Address : D8:C4:6A:55:73:3E

WLAN Firmware    : wl0: Feb 12 2018 23:35:27 version 7.15.168.108 (r683813) FWID 01-81fd72af

WLAN CLM         : API: 12.2 Data: 9.10.74 Compiler: 1.31.3 ClmImport: 1.36.3 Creation: 2018-02-12 23:30:46

Printing nanosecond clock value

cpu_time: 174586700.000000

The code is:

      wiced_init( );

      uint64_t cpu_time;

      platform_init_nanosecond_clock();

WPRINT_APP_INFO(("Printing nanosecond clock value\n"));

cpu_time= platform_get_nanosecond_clock_value();

  WPRINT_APP_INFO(("cpu_time: %f\n", (double)cpu_time));

ok. It looks good after adding wiced_init_nanosecond_clock().

Thanks.