Thank you Janos for the clear explaination and advice. In particular, I tried 
the option of increasing the speed of the SPI bus of the CC2420. 

For the benefit of the help forum and to confirm my ammendments with you, I 
would like to document the changes I made according to your advice. Initial 
results show that I have managed to decrease the time to read the register once 
from 155 us to less than 130 us. This is a start but I am surprised that 
despite 
increasing the SPI bus speed by 400%, I only get an improvement of about 16%.  

Firstly, to set the SMCLK to tick at the DCO frequency ( ~ 4 MHz) - In 
Msp430ClockP.nc and in command void Msp430ClockInit.defaultInitClocks(), 
BCSCTL2 
= DIVS0; instead of BCSCTL2 = DIVS1;. This sets the divisor of SMCLK to 1.


Secondly to change the calibration constants - In Msp430DcoCalibP.nc, Instead 
of enum { TARGET_DELTA = 512, // Since our DCO runs 4 times faster 
MAX_DEVIATION 
= 1  // the error is still kept at 0.35% };  instead of {TARGET_DELTA = 2048, 
MAX_DEVIATION = 7,} and 

// this gets executed 32 times a second
  async event void TimerMicro.overflow()
  {
    uint16_t now = call Timer32khz.get();
    uint16_t delta = now - m_prev;
    m_prev = now;

    if( delta > (TARGET_DELTA+MAX_DEVIATION) )
    {
      // too many 32khz ticks means the DCO is running too slow, speed it up
      if( DCOCTL < 0xe0 )
      {
        DCOCTL++;
      }
 else if( (BCSCTL1 & 1) < 1 )//else if( (BCSCTL1 & 7) < 7 )
      {
        BCSCTL1++;
        DCOCTL = 96;
      }
    }
    else if( delta < (TARGET_DELTA-MAX_DEVIATION) )
    {
      // too few 32khz ticks means the DCO is running too fast, slow it down
      if( DCOCTL > 0 )
      {
        DCOCTL--;
      }
      else if( (BCSCTL1 & 1) > 0 ) //else if( (BCSCTL1 & 7) > 0 )
      {
        BCSCTL1--;
        DCOCTL = 128;
      }
    }
  }
  
The comments represent the old code. Basically, I replaced the 7 with 1s. Is 
this correct? 

Thirdly, for the uart baud rates - using the baud rate calculator 
(http://mspgcc.sourceforge.net/baudrate.html), I added in msp430uart.h, the 
following, 

  UBR_4MHZ_1200=0x0DA7,   UMCTL_4MHZ_1200=0x22,
  UBR_4MHZ_1800=0x091A,   UMCTL_4MHZ_1800=0x84,
  UBR_4MHZ_2400=0x06D3,   UMCTL_4MHZ_2400=0xAD,
  UBR_4MHZ_4800=0x0369,   UMCTL_4MHZ_4800=0x7B,
  UBR_4MHZ_9600=0x01B4,   UMCTL_4MHZ_9600=0xDF,
  UBR_4MHZ_19200=0x00DA,  UMCTL_4MHZ_19200=0xAA,
  UBR_4MHZ_38400=0x006D,  UMCTL_4MHZ_38400=0x44,
  UBR_4MHZ_57600=0x0048,  UMCTL_4MHZ_57600=0x7B,
  UBR_4MHZ_76800=0x0036,  UMCTL_4MHZ_76800=0xB5,
  UBR_4MHZ_115200=0x0024, UMCTL_4MHZ_115200=0x29,
  UBR_4MHZ_230400=0x0012, UMCTL_4MHZ_230400=0x84,
in the typedef for msp430_uart_rate_t, and I ammended the default uart 
configuration to
msp430_uart_union_config_t msp430_uart_default_config = { 
  {
    utxe : 1, 
    urxe : 1, 
    ubr : UBR_4MHZ_57600,//UBR_4MHZ_115200,
    umctl : UMCTL_4MHZ_57600,//UMCTL_4MHZ_115200,
    ssel : 0x02, 
    pena : 0, 
    pev : 0, 
    spb : 0, 
    clen : 1, 
    listen : 0, 
    mm : 0, 
    ckpl : 0, 
    urxse : 0, 
    urxeie : 1, 
    urxwie : 0,
    utxe : 1,
    urxe : 1
  } 
}; 

To this I have a question, is there a reason why the default configuration for 
the uart baud rate is 57600? Does this mean that the uart baud rate is 57600 
for 
all uarts on the TelosB platform? Why then is the java Printf client listen at 
115200 for TelosB motes?

Fourthly, microsecond timers - As it was my goal to increase the CC2420 bus 
speed and not to ammend any other times, I decided to keep Timer A and Timer B 
as they were in Msp430ClockP.nc. This would also mean that I would not have to 
change any of the timer implementations. As Timer A has SMCLK as its source, 
which is now 4 times faster, I changed the input divisor from 1 to 4 to offset 
the increase in SMCLK. 

command void Msp430ClockInit.defaultInitTimerA()
  {
    TAR = 0;

    // TACTL
    // .TACLGRP = 0; each TACL group latched independently
    // .CNTL = 0; 16-bit counter
    // .TASSEL = 2; source SMCLK = DCO/4
    // .ID = 0; input divisor of 1
    // .MC = 0; initially disabled
    // .TACLR = 0; reset timer A
    // .TAIE = 1; enable timer A interrupts
    //TACTL = TASSEL1 | TAIE; //Tobias
    
     TACTL = TASSEL1 | ID_2 | TAIE; //Tobias
  }

I tried to look through the other timer and usart files to see if there were 
any 
other changes to be made but in my opinion, this was all that is to be done. 
Please feel free to mention anything else that I might have left out.

Now there are still some outstanding issues to be fixed. With the new SMCLK 
speed, I am experiencing problems with the printf client. I changed the uart 
configuration in TelosSerialP from ubr: UBR_1MHZ_115200, umctl: 
UMCTL_1MHZ_115200 to ubr: UBR_4MHZ_115200, umctl: UMCTL_4MHZ_115200 
msp430_uart_union_config_t msp430_uart_telos_config = { {ubr: UBR_4MHZ_115200, 
umctl: UMCTL_4MHZ_115200, ssel: 0x02, pena: 0, pev: 0, spb: 0, clen: 1, listen: 
0, mm: 0, ckpl: 0, urxse: 0, urxeie: 1, urxwie: 0, utxe : 1, urxe : 1} }; .

However when running the printf client, I seem to always get a bad packet 
message. Does anyone know what could be the cause of this problem?

Thank you for your help and I would appreciated any advice.

Best Regards,

Tobias  
Tobias Ang
Ruetscher Str. 165 Zi 1415
52072 Aachen
Germany
+49-1797077338




________________________________
From: Janos Sallai <[email protected]>
To: Tobias Ang <[email protected]>
Cc: tinyos forum <[email protected]>
Sent: Mon, October 25, 2010 7:59:38 PM
Subject: Re: [Tinyos-help] Help with RSSI register reading rate on TelosB

Tobias:

On Mon, Oct 25, 2010 at 11:25 AM, Tobias Ang <[email protected]> wrote:
> Hi,
> I am currently working on generating an RSSI profile of a channel using a
> TelosB mote with as high a sample rate as possible. At this moment, I am
> only able to obtain a new RSSI value every 155 us although the CC2420 radio
> provides a new RSSI value after it has been in the receive mode for 0.128ms
> and for each subsequent symbol. I have also read in another paper that the
> RSSI value is obtained at a sample rate of 62.5 KHz or every 16 us but this
> was done on the Tmote Sky platform. I have tried a couple of solutions but
> they do not seem to work. I would like to present them here for discussion.
This sounds like a fun project...

> Initially, I wanted to increase the MSP430 clock rate but it has been
> previously discussed that it is only possible with the Tmote Sky as the Rosc
> is not populated on the TelosB. Please refer
>to 
>http://www.mail-archive.com/[email protected]/msg09808.html.
>.
This is true. I am aware of that. We're stuck with a maximum DCO
frequency of about 3.8-4MHz on the telosb.

> From Figure 6 in the TelosB datasheet, it shows that Timer B is connected
> with CC2420 and I assumed that it determines the clock rate of the SPI bus.
No. It only means that the time of the SFD interrupt can only be
timestamped with the value of timer B. It does not constrain the SPI
speed in any way.

> I also tried to find out if there was a possibilty in increasing the baud
> rate of the SPI bus. After checking msp430usart.h, it seems that the fastest
> configuration of ubr : 0x0002, ssel : 0x02, which means that SMCLK(1 MHz) is
> already the source and that  as its source and with the smallest divisor of
You can set SMCLK to tick at the DCO freq (~4MHz), by changing the
SMCLK prescaler. This has a couple of side effects
(constants/configuration values for DCO calibration, uard baud rate
registers, microsecond timers, etc. need to be altered accordingly),
but is certainly doable.

Janos



      
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to