I try to measure with internal Timer A from MSP430FG4618 (Experimenter’s Board) the time for execution command rxRecvPacket(). I use as Code:
while(TRUE){
halTimerARestart();//TAR = 0;
rxRecvPacket(data, &payloadLength);
stamp[i][0] = TAR;
stamp[i++][1] = faches;
++counter;
if( (counter > numberpaket_int) )
break;
}
for(i=0; i<numberpaket_int; i++){
ausgabe = " ";
sprintf(ausgabe,"%d %d", stamp[i][1], stamp[i][0]);
ausgabe[sizeof(ausgabe)-2]= 0x0D;//CR
ausgabe[sizeof(ausgabe)-1]= 0x0A;//LF
halUartWrite(&ausgabe[0],sizeof(ausgabe));
The functions rxRecvPacket and halTimerARestart are content of TI application Notes AN049. The receiver works together with transmitter module CC2500 over SPI. So, I'm measuring the duration for receiving a packet. Then the time duration is saved in an array. The problem is that the saved duration times are the same for different interframe spacings (duration between two packets).
Can someone explain why the read time value does not change when the period of sending changed? The Read time value only changes when the send packet length changed.
I don't know th elow-level functions you're calling and what they do, so I cannot answer your question.
However, the approach seems a bit odd.Personally, I would reset TAR before entering the loop and write down the current value of TAR after each received package, then calculate the differences.But I don't know what rxRecvPacket actually does. Does it really wait until a new packet is availabble? Or does it jsut read, whether there is a packet or not (so it reads the first packet over and over again)?
For the prin, there is a bad msitake. the sprintf generates a string, then you over write the last two chars of the string by CR/LF, whcih overwrites the last two digits of stamp[i][0]. You do not reserve space for these two bytes in the string.You can as well do "%d %d\r\n" as format string, directly including the CR/LF to the string.
_____________________________________Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.