Part Number: CC2640R2F
Tool/software: TI-RTOS
Hi, I'm using a CC2640R2 With the example of Project Zero from simplelink_cc2640r2_sdk_1_50_00_58.
I require to get microseconds timestamp for an integral that I'm doing, then I created this function based on examples it's on milliseconds just to test:
void get_ms(unsigned long * timestamp){
Timestamp_getFreq(&freq);
xdc_runtime_Types_Timestamp64 t_64;
uint32_t t_32 = Timestamp_get32();
Timestamp_get64(&t_64);
timestamp[0] = (unsigned long) ((t_32*1000)/ freq.lo); //Unsigned long = u32
log_i("Freq: %d %d 32= %d 64 = %d %d. ", freq.hi, freq.lo, t_32, t_64.hi, t_64.lo);
}
But when I printed I noticed that the frequency was wrong: Freq: 0 65536
#000003 [ 0.013 ] INFO: (delays.c:26) Freq: 0 65536 t_32= 874 t_64 = 0 874.
#000004 [ 0.013 ] INFO: (EM7180.c:149) Timestamp ms = 13
I found here that this is because it's set to use the RTC, and they suggest to change some lines if he is ok when the clock stalls Since I'm using the Bluetooth example I don't want to change anything in the clock because I don't know if it will stop working.
So I searched for how to get the timestamp from the RTC, but I can only find how to get seconds: here but this is more like the calendar. In the same post the suggest to read the
http://www.ti.com/lit/ug/spruex3u/spruex3u.pdf but in the section 5.5 Timestamp Module, it takes me again to what I did before :/.
Thansk for your help