Thanks for the pointers, Steve.
 
Incidentally, I was also trying to add Magnetometer gain and sample rate 
settings functionality to the BoilerPlate app (see code snips that i inserted 
below). However, doing this seems to break the magnetometer output (just 
outputs constants). Am i implementing this correctly?
 
regards
 
Chris
 
 
#include "Magnetometer.h"
module BoilerPlateC {
...
...
   task void startSensing() {
      if(stored_config[NV_SENSORS0] & SENSOR_GYRO){
         call GyroInit.init();
         call GyroStdControl.start();
      }
      if(stored_config[NV_SENSORS0] & SENSOR_MAG)
      {
         call MagInit.init();
  /*
  * 0.5, 1, 2, 5, 10 (default), 20, 50hz.  20 and 50 up power burn dramatically
  * values 0 - 6 map to values above, respectively
  */
  call Magnetometer.setOutputRate(ONE_GAUSS);
 
  /*
  * +-0.7, 1.0 (default), 1.5, 2.0, 3.2, 3.8, 4.5Ga
  * values 0 - 6 map to values above, respectively
  */
  call Magnetometer.setGain(TEN_HZ);
         call Magnetometer.runContinuousConversion();
      }
...
...
 

 

> Date: Tue, 14 Jun 2011 15:31:51 -0400
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> Subject: Re: [Shimmer-users] logging magnetometer data to SD card
> 
> hi chris,
> 
> you're in fairly tricky territory here.
> 
> yes, you need to switch bus modes; see any application or driver (hint: 
> the sd driver does!) that uses spi to understand how to wire in 
> usartcontrol to do what you want.
> 
> you're on the right track, but there are a couple of really important 
> things that you should note first. since the msp430 shares one pin that 
> conducts traffic in i2c (sda) and spi modes (simo), and the clock pin, 
> you'll need to disable the card itself, or it will think that you're 
> talking to it when you ask the magnetometer for data.
> 
> if you follow the calls inside the fatfs module to their implementations 
> (diskio layer) you'll find what you need to bring the card up and down 
> while you pull data from the magnetometer. so, you can use the calls 
> that the filesystem uses. you might also try just doing the 
> lowest-level things in the card disable/enable functions.
> 
> you'll also need to consider the timing; writing one disk block takes 
> about 14 ms, so if you're reading the magnetometer at 10hz, then you'll 
> have to slip the (relatively infrequent) disk writes in during the 72 ms 
> that it's idle between samples. sounds easy, but notice that the driver 
> has to pause during start-up for a power cycle (longer than sd spec, but 
> we found that not all cards meet that spec).
> 
> i hope that this helps.
> 
> have fun,
> 
> steve
> 
> On 06/14/2011 03:02 PM, Chris B wrote:
> > Deal all,
> >
> > I am trying to enable SD card logging of timestamp, accelerometer, gyro
> > and magnetometer data on the Shimmer2r + Kinematics board. I'm getting a
> > bit stuck on enabling SD logging of the magnetometer data.
> >
> > To start with, I have essentially extended the Shimmer HostTimeLogging
> > app. I am aware that the Magnetometer and SD card access utilise the
> > same bus USART0, thus i need to switch USART0 between the Magnetometer
> > (I2C mode) and the SD card access (SPI mode) in a timely manner.
> >
> > This seems straightforward for the Magnetometer, i just use calls to
> > Magnetometer.enableBus() or Magnetometer.disableBus(). However, I can't
> > figure out which commands I should be using for the SD card access. I'm
> > not sure whether those within the FatFs interface such as FatFs.mount()
> > and FatFs.unmount() are the correct calls to make in this instance,
> > looking at the lower-level code, they seem to do more than just set up
> > the bus mode. I think i should be using calls such as
> > Usart.setModeSpi(config) but am unsure how to expose these function in
> > the top level code in a safe manner alongside FatFs.
> >
> > Any help on this would be appreciated.
> >
> > regards
> >
> > Chris
> >
> >
> >
> > _______________________________________________
> > Shimmer-users mailing list
> > [email protected]
> > https://lists.eecs.harvard.edu/mailman/listinfo/shimmer-users
                                          
_______________________________________________
Shimmer-users mailing list
[email protected]
https://lists.eecs.harvard.edu/mailman/listinfo/shimmer-users

Reply via email to