The default configuration for the 1611 runs the MCU at 4 MHz (main clock, 
MCLK). The USART which does SPI runs off SMCLK (sub-main clock) which is set to 
MCLK/4. That's on the telosb, I don't know if the shimmer platform does the 
same. The default setup does about 30-40 KB/sec, if I remember correctly. Of 
course, the flash writes also take time.

You can speed things up by increasing the clock frequencies. SMCLK can be run 
at the same speed as MCLK, but  the USART clock generator has a miminum divider 
of 2. The 1xx series has a maximum clock speed of 8 MHz, which would give you a 
4 MHz SPI clock. Theoretically that'd max out at 0.5 MB/sec if you had zero 
overhead. Note that you'll need a 3.6 V supply if you want to run at 8 MHz. It 
may work at a lower voltage, but then you're outside the specs.

You'll want to study chapter 14 of the x1xx series user 
guide<http://www.ti.com/lit/ug/slau049f/slau049f.pdf>. That has all the nitty 
gritty details on the USART's SPI mode. Note that TimerA is also clocked from 
SMCLK, and that's used to generate the microsecond timer in TinyOS. If you 
change SMCLK, you'll probably want to adjust the divider for TimerA so that 
still runs at 1 MHz.

If you want to go faster still, while still using an MSP430 based platform, you 
could consider using one of the newer models like the Zolertia 
Z1<http://www.zolertia.com/ti> or our 
G-Node<https://www.sownet.nl/index.php/products/gnode> which both use a 2xx 
series microcontroller. Those will run at 16 MHz, but neither comes with an 
onboard SD card slot, but both have the necessary I/O connections to add one. I 
don't know if there's already off-the-shelf nodes that use the 5xx series 
microcontrollers, some of which will do 25 MHz.

Hope this helps,
Michiel

From: tinyos-help-boun...@millennium.berkeley.edu 
[mailto:tinyos-help-boun...@millennium.berkeley.edu] On Behalf Of Avishay Meron
Sent: Tuesday, January 01, 2013 09:52
To: Eric Decker
Cc: tinyos-help@millennium.berkeley.edu
Subject: Re: [Tinyos-help] Shimmer SD write speed

Hi Eric.
Thank you very much for you quick response.
I guess I need to dig up. I'm using defaults...
Anyway, I assume the default configurations you refer to are not set to about 
20 times lower than max possible.
20 is the factor of improvement I'm looking for (at least!).
I hope I'm not chasing pavements here...
On Tue, Jan 1, 2013 at 5:32 AM, Eric Decker 
<cire...@gmail.com<mailto:cire...@gmail.com>> wrote:

How fast are you clocking the 1611 cpu?

How fast are you clocking the SPI feeding the SD card?

That will tell you the max theoretical rate you can transfer data.

The high data rates to the SD assume the parallel 4 bit wide SD protocol rather 
than the SPI single bit stream that is probably used on the Shimmer or on my 
cards.

On Mon, Dec 31, 2012 at 2:55 PM, Avishay Meron 
<avishay.me...@mail.huji.ac.il<mailto:avishay.me...@mail.huji.ac.il>> wrote:
Hi all.
Searching google and the mailing list, I haven't found an explicit answer to my 
problem. Here goes:
I'm trying to test SD logging max write speed on a shimmer2r. I've tried using 
the FatFS but got unsatisfying results.
So, I decided to write directly to the SD. Using a simple application (see code 
below), I found that the max rate of SD writing is about 20kB/s. Is that it? is 
this the maximum rate possible? I was hoping to get at least 0.5 or 1 MB/s. Any 
suggestions?

Happy new year to you all...

Here is my test code...

-----------------TestSDP.nc-------------------
#include "TestSD.h"

module TestSDP{
    uses{
        interface Leds;
        interface Boot;
        interface SD;
        interface StdControl as SDStdControl;
    }
}

implementation{

    uint8_t resetData[SECTOR_SIZE], dummyData[SECTOR_SIZE];
    int8_t data=0xff;
    uint32_t beginSector=1000000, numOfIt=20000, currSector;

    //Using numOfIt=20000, it took the application 17 min and 47 sec to run,
    //from which 8 min and 51 sec to write dummyData.
    //The rest of the time the application Formated the sectors.
    //This means writing at about 20kB/s

    event void Boot.booted(){
        call Leds.led2Toggle();
        call SDStdControl.start();
        memset(resetData, 0, SECTOR_SIZE);
        memset(dummyData, data, SECTOR_SIZE);
        call Leds.led2Toggle();
    }

    void FormatSectors()
    {
        uint32_t i=0;
        currSector=beginSector;
        for (i=0; i<numOfIt; i++, currSector++)
        {
            call SD.writeBlock(currSector, resetData);
        }
    }

    void WriteDummyData()
    {
        uint32_t i=0;
        currSector=beginSector;
        for (i=0; i<numOfIt; i++, currSector++)
        {
            call SD.writeBlock(currSector, dummyData);
        }
    }

    async event void SD.available(){
        call Leds.led0Toggle();
        FormatSectors();
        call Leds.led0Toggle();
        call Leds.led1Toggle();
        WriteDummyData();
        call Leds.led1Toggle();
        call Leds.led2Toggle();
    }

    async event void SD.unavailable(){
    }
}

-----------------TestSDC.nc-------------------

configuration TestSDC{
}
implementation{
    components MainC, LedsC, SDC, TestSDP as app;
    app.Boot -> MainC.Boot;
    app.Leds -> LedsC;
    app.SD -> SDC;
    app.SDStdControl -> SDC;
}

-----------------TestSD.h-------------------
#ifndef TEST_SD_H
#define TEST_SD_H
#define SECTOR_SIZE 512
#endif /* TEST_SD_H */

Best
Avishay

_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu<mailto:Tinyos-help@millennium.berkeley.edu>
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help



--
Eric B. Decker
Senior (over 50 :-) Researcher



--
Best
Avishay
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to