Hi Zhiyi, the original telosb doesn't have an accelerometer, but in general you can contribute by putting your code in "tinyos-2.x-contrib" [1]. If it is only about the msp430adc12_channel_config_t you might as well just send that code snippet to tinyos-help mailing list.
Jan [1] http://docs.tinyos.net/tinywiki/index.php/Contributing_Code_to_TinyOS On Tue, Nov 29, 2011 at 1:57 AM, zhiyi <zhu...@cs.otago.ac.nz> wrote: > Jan, > Thanks for help. My program works now. Actually it is a bit embarrassed to > say the reason was that the sensor board was not plugged tightly enough on > the mote. > > Also I noticed there was no adc12 modules for accelerometers on telosb. > Could I make such a module and contribute to the code tree of telosb? I > tested my module works fine for ADXL321. > Cheers, > Zhiyi > > > > On 28/11/2011, at 11:15 PM, Jan Hauer wrote: > >> Your configuration seems identical to the telosa/b configuration >> (S1087-01 light sensor on port A5). There is already a component (have >> you tried it?) -> >> tinyos-main/tos/platforms/telosa/chips/s10871/HamamatsuS10871TsrC.nc >> >> Jan >> >> On Sun, Nov 27, 2011 at 11:52 PM, zhiyi <zhu...@cs.otago.ac.nz> wrote: >>> >>> Sorry for kicking the old dirts. I followed this thread but have not >>> found >>> what I needed. >>> >>> I have the similar problem with ADC: I can't read proper data from light >>> sensors or any sensor on the sensor board EM1000. >>> >>> I have tried Oscilloscope and it works for the InternalTemperature and >>> InternalVoltage. What I did was I create a new sensor configuration >>> similar >>> to these two templates. My configuration is: >>> >>> const msp430adc12_channel_config_t config = { >>> inch: INPUT_CHANNEL_A5, >>> sref: REFERENCE_VREFplus_AVss, >>> ref2_5v: REFVOLT_LEVEL_1_5, >>> adc12ssel: SHT_SOURCE_ACLK, >>> adc12div: SHT_CLOCK_DIV_1, >>> sht: SAMPLE_HOLD_4_CYCLES, >>> sampcon_ssel: SAMPCON_SOURCE_SMCLK, >>> sampcon_id: SAMPCON_CLOCK_DIV_1 >>> } >>> >>> A5 is supposed to be the channel for S1087-01 light sensor on EM1000. >>> What I >>> read are the values gradually decreased and then within a few seconds >>> stayed >>> at a almost constant value (no change even if I changed the light). I >>> tried >>> HOLD_64, but there was no difference. I even took off the sensor board, >>> there was no difference. >>> >>> My mote was CM4000, by the way. I placed my sensor configuration under >>> tos/chips/msp430/sensors, which I worked fine in terms of compilation. >>> >>> Could you please shed some light what I could try next? >>> >>> Many thanks for your help. >>> >>> Zhiyi >>> >>> >>>> Are there any of the "standard" telosb external sensors >>>> (Humidity/Temperature/Light) available on your telosb ? Can you test >>>> whether they give you good readings (or test your code with the >>>> internal sensors of the msp430). >>>> >>>>>> 2) open tinyos-2.x/tos/chips/msp430/adc12/Msp430Adc12.h and comment >>>>>> out "ADC12_P6PIN_AUTO_CONFIGURE". Now the Ax PINs are not >>>>>> automatically configured, so you should (e.g. in Boot.booted()), do >>>>>> this: >>>>>> >>>>>> call Port61.selectModuleFunc(); >>>>>> call Port61.makeInput(); >>>>>> >>>>>> (in your configuration: >>>>>> components HplMsp430GeneralIOC; >>>>>> MyDriverC.Port61 -> HplMsp430GeneralIOC.Port61;) >>>>> >>>>> >>>>> I'm not sure I understand - should I create a new driver myself? Based >>>>> on an existing module? >>>>> >>>> >>>> The pin(s) on the msp430 to which your sensor is attached must be >>>> configured to be in input and module (ADC) function mode. This is done >>>> automatically if ADC12_P6PIN_AUTO_CONFIGURE is defined (which is the >>>> default). But the pins are switched to module function mode just >>>> before the conversion and back to IO function mode afterwards. Maybe >>>> there is a timing issue, so you could try to disable the default >>>> behaviour and try to take care of the pin configuration yourself. >>>> >>>> >>>> Jan >>> >>> >>> > > ======================= > Zhiyi Huang > Dept of Computer Science > University of Otago > Email: h...@cs.otago.ac.nz > Phone: 0064-3-4795680 > Fax: 0064-3-4798529 > _______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help