It looks like you forget to call SplitControl.start() (provided by
ActiveMessageC or SerialActiveMessageC) ...

Jan

On Tue, Sep 27, 2011 at 7:10 PM, Juan Verdu <juan.ve...@gmail.com> wrote:
> Hello everyone,
>
> I am working with a MSP430F2617 microcontroller  and a radio CC2420 under
> the Zolertia driver.
>
> I am making an application to read the internal temperature of the
> microcontroller, and later I will send the information to a base station
> under the Basestation application.
>
> My application performs Send () correctly but this application fails
> AM.sendDone (), if I change the component SerialActiveMessageC by
> ActiveMessageC, the same problem will happen. In this case, I do not use a
> radio. I use the serial port and I wouldn´t use the BaseStation application.
>
> The code is as follows:
>
>
> Makefile
>
> COMPONENT=TestAdcAppC
> CFLAGS += -DADC12_TIMERA_ENABLED
> CFLAGS += -DADC12_ONLY_WITH_DMA
> include $(MAKERULES)
> CFLAGS += -DCC2420_DEF_CHANNEL=20
>
> TestAdc.h
>
>
> #ifndef TEST_SERIAL_H
> #define TEST_SERIAL_H
> typedef nx_struct test_serial_msg {
>   nx_uint16_t counter;
> } test_serial_msg_t;
> enum {
>   AM_TEST_SERIAL_MSG = 0x89,
> };
> #endif
>
> TestAdcC.nc
>
> #include "Timer.h"
> #include "TestAdc.h"
>
> module TestAdcC
> {
>   uses interface Boot;
>   uses interface Leds;
>   uses interface Timer<TMilli> as Timer0;
>     uses interface Msp430Adc12Overflow as overflow;
>   uses interface Msp430Adc12SingleChannel as adc;
>   uses interface Resource;
>   uses interface SplitControl as Control;
>   uses interface Packet;
>   uses interface AMSend;
> }
>
> implementation
> {
> #define BUF_SIZE 100
>   uint16_t buf[BUF_SIZE];
>  message_t packet;
>
> uint16_t counter = 0;
> uint16_t Data;
>
> void configureSingle();
> msp430adc12_channel_config_t adcconfig = {
>     inch: SUPPLY_VOLTAGE_HALF_CHANNEL,
>     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
>   };
>
>   event void Boot.booted()
>   {
> call Resource.request();
>    }
> async event void overflow.conversionTimeOverflow(){
>        }
>   async event void overflow.memOverflow(){
>       }
>
>   async event uint16_t *adc.multipleDataReady(uint16_t *buffer, uint16_t
> numSamples){
>             return buffer;
>   }
>  task void send(){
>     test_serial_msg_t* rcm = (test_serial_msg_t*)call
> Packet.getPayload(&packet, sizeof(test_serial_msg_t));
>     // call Resource.release();
>     call Leds.led0Toggle();
>      rcm->counter = Data;
>     if(  call AMSend.send(AM_BROADCAST_ADDR, &packet,
> sizeof(test_serial_msg_t)) == SUCCESS)
>         call Leds.led1Toggle();
>     }
>   async event error_t adc.singleDataReady(uint16_t data){
>     Data = data;
>     post send();
>           return SUCCESS;
>   }
>     event void Resource.granted(){
>     configureSingle();
>     call Timer0.startPeriodic(2048);
>   }
>   void configureSingle(){
>     error_t e;
>     e = call adc.configureSingle(&adcconfig);
>       }
> event void Timer0.fired()
>   {
>     call adc.getData();
>   }
> event void AMSend.sendDone(message_t* bufPtr, error_t error) {
>     call Leds.led2Toggle();
> }
> event void Control.startDone(error_t err) {
>       }
>
>  event void Control.stopDone(error_t err) {
>     }
> }
>
> TestAdcAppC.nc
>
> #include "TestAdc.h"
> configuration TestAdcAppC {
> }
> implementation
> {
>   components MainC,
>              TestAdcC,
>              LedsC;
>  components ActiveMessageC as AM;
>  components new TimerMilliC() as Timer0;
>  components new Msp430Adc12ClientAutoDMAC() as Lectura;
>   TestAdcC.overflow -> Lectura;
>   TestAdcC.adc -> Lectura;
>   TestAdcC.Resource -> Lectura;
>    TestAdcC -> MainC.Boot;
>   TestAdcC.Leds -> LedsC;
>   TestAdcC.Timer0 -> Timer0;
>   TestAdcC.Control -> AM;
>   TestAdcC.AMSend -> AM.AMSend[AM_TEST_SERIAL_MSG];
>   TestAdcC.Packet -> AM;
> }
>
> Could someone help me?
>
> Escribe texto o la dirección de un sitio web, o bien, traduce un documento.
> Cancelar
>
> traducción del español al inglés
>
> A greeting and thank you very much
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>

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

Reply via email to