This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2500 timing measurements

Other Parts Discussed in Thread: CC2500

Hi,

 

I need to transmit 30 bytes in every 2 milliseconds continuously. My transmit function is in the TA ISR. The MCUs master clock is at 8MHz, SPI clock is 8 MHz too. In the ISR, I upload the TXFIFO with 30 bytes, strobe STX , wait for transmission to be done, then strobe an SCAL. To optimize my code, I placed PxOUT 'markers' in the ISR  to pull up and low a dedicated pin thus I can measure the time periods of code sections with a scope. However, my results are rather strange.  The measured time frames are the following (starting from t1 since t0 is not implemented yet):

t0 - read out 30 bytes from an external SPI device (unknown)

-----------------------------------------------------------------

 t1 - upload 30 bytes to FIFO 265 us

t2 - send strobe STX 115 us - pretty high

t3 -CC2500 IDLE>TX 160 us instead of  88.4 us 

t4 - TX 484 us that's fine

t5 - TX>IDLE N/A the datasheets gives 0.1 us

t6 - send strobe SCAL 114.6 us - pretty high

t7 - IDLE>SCAL N/A but would be nice to know

t8 - SCAL can't measure it but the datasheet gives 721 us

t9 - SCAL>IDLE N/A but would be nice to know

 

I understand that  t1, t2 and t6 periods merely depends on my code which could be optimized. The total known time is 1860 us which is dangerously close to 2000 usecs, where the next cycle should come and t0 is still not included yet. The calibration takes place from t7 to t9 and it has to be finished by t1, theoretically. My questions are:

What happens when CC2500 is still calibrating when I start to upload the TXFIFO? If it works in parallel, I'll have an extra 265 us time period before strobing STX.

Why has t3 such a double value of 160 us?

Is there a way to capture the end of the calibration procedure ?(there is no similar way like TX/RX at GDO0)

 

Any help would be greatly appreciated.

  • Greg,

    The FIFO can operate independent of the radio, i.e. you can be loading up the next 30 bytes while the first 30 bytes are going out (assuming you are using fixed length transmissions).  Further, you may want to set the radio to auto-calibrate after TX to save you the overhead of having to strobe the radio there as well.  Assuming you do, then after you load up the first 30 bytes and strobe TX to the radio you have almost the entire 2ms remaining to accomplish your t0 task and uplaod the next 30 bytes.  Then simply check to see that the transmit is complete (or assume it is by design) and wait for the next event to happen (i.e. exit the isr and wait for it to be re-entnered).

    It looks like you are doing quite a bit of waiting on the hardware when you could be doing other things while you are waiting.  Could you set up DMA's to manage loading the FIFO (triggered via the timer) and then in your ISR all you need to do is strobe the TX.  Depending on the requirements of the t0 task, it too could possibly benifit from a DMA which would make the code almost trivial once you get it set up.  Of course I'm assuming significant amounts about your system but it does have many similarities with many other systems I've worked on.

    As far as the time measruements, is it possible you may be measuring some code overhead as well as the radio operational periods?  Where are you toggling your I/O bit relative to when the radio on the other end of the SPI port is actually getting and initiating the command strobe?

    Keep us posted as to your progress,

    Jim

     

  • Jim,

     

    thank you for the answers. Somehow, I didn't notice the TX>IDLE autocal option which is now implemented in my code. In this design, I am using a 2274 chip so there is no DMA functionality I could use. I also considering to change the code to run manual calibration in parallel with t0 readout/upload FIFO and then TX it. There are several options to make it more efficient.

    On the measurements, I simply use this setup:

    PxOUT |=BITx;

    Sendstrobe (STX)

    PxOUT &=~BITx

     

    The Sendstrobe function is a simple one byte SPI write code, with CS low/shiftout byte/CS high, and I got 115 us in the above code. Not optimized by the compiler. For the code it is 114 us as the SPI clock was 8 MHz. On the scope, channel 1 was set to Px.BITx, channel 2 was GDO0. In the above setup, after Px.BITx goes low, there is a 160 us gap before GDO0 rises. The trigger was set to Px.BITx rising edge.

    Anyway, I think I will set PxOUT &=~BITx after the SPI code CS high command and measure it again.

     

    Thx, G

  • Greg,

    I don't know exactly how you have GDO0 setup but if it is supposed to go high at the SFD, then the delay you are seeing may simply be the time where the preamble is sent before the SFD.  If you are really looking for when transmission begins, i.e. when the preamble starts being sent, then set the GDO pin mode to 27 (0x1B) which outputs a PA_PD signal.  This signal is used to tell an external power amplifier when to be on and off.  It will be high for off and low for on as this is a positive logic signal for the PA Power Down (PD) signal.

    Regards,

    Jim

     

  • Jim,

     

    thank you for your quick reply, I really appreciate your help. I use 0x06 for GDO0 and there is a good chance that the delay is coming from what you've described. I will change to 0x1B and check it again.

     

    Thx again,

     

    G

  • Done. The cause of the delay was the preamble bytes. Thanks Jim.

     

    PS. I also discovered a 100 us delay loop in my SendStrobe code which has been left there unintentionally. After commenting it out the whole SendStrobe function went below 20us.

  • Greg,

    Excellent!  It's always good to know when accomplishments are achieved.

    Regards,

    Jim