Hi to all,

my problem is following: i send a buffer of byte (fill from me) to serial
port. I read tep 113 and i  decided to use the interface SerialByteComm. The
problem is this:
What is the module for a micaz providing this interface?
Do you know  other ways to solve this problem?


For my tests, i modified application BaseStation, and I send to serial the
variable 'letter'

My configuration file is:



/****************CONFIGURATION*********************************************/


configuration BaseStationC {
}
implementation {

  components MainC, BaseStationP, LedsC;

    components ActiveMessageC as Radio, UartC as Serial1;


    MainC.Boot <- BaseStationP;

     BaseStationP.RadioControl -> Radio;




    BaseStationP.SerialControl1->Serial1;
    BaseStationP.SerialByteComm->Serial1;

  BaseStationP.RadioSend -> Radio;
  BaseStationP.RadioReceive -> Radio.Receive;
  BaseStationP.RadioSnoop -> Radio.Snoop;
  BaseStationP.RadioPacket -> Radio;
  BaseStationP.RadioAMPacket -> Radio;

  BaseStationP.Leds -> LedsC;



}


My module  is:




#include "AM.h"
#include "Serial.h"

module BaseStationP {

 uses {
    interface Boot;

    interface SplitControl as RadioControl;



    interface StdControl as SerialControl1;
    interface SerialByteComm;


    interface AMSend as RadioSend[am_id_t id];
    interface Receive as RadioReceive[am_id_t id];
    interface Receive as RadioSnoop[am_id_t id];
    interface Packet as RadioPacket;
    interface AMPacket as RadioAMPacket;

    interface Leds;
  }
}

implementation
{
  enum {
    UART_QUEUE_LEN = 12,
    RADIO_QUEUE_LEN = 12,
  };

  message_t  uartQueueBufs[UART_QUEUE_LEN];
  message_t  *uartQueue[UART_QUEUE_LEN];
  uint8_t    uartIn, uartOut;
  bool       uartBusy, uartFull;


 uint8_t tim_out;




 error_t    stato;
  uint8_t     serial_buffer_send[10];
  uint8_t     index;
  uint8_t     letter;
  message_t  radioQueueBufs[RADIO_QUEUE_LEN];
  message_t  *radioQueue[RADIO_QUEUE_LEN];
  uint8_t    radioIn, radioOut;
  bool       radioBusy, radioFull;

  task void uartSendTask();


  void dropBlink() {
    call Leds.led2Toggle();
  }

  void failBlink() {
    call Leds.led2Toggle ();
  }

  event void Boot.booted() {
    uint8_t i;

   for (i=0;i<10;i++)
    {
    serial_buffer_send[i]=0;

    }

    serial_buffer_send[0]=0x41;//A
    serial_buffer_send[1]=0x44;//D
    serial_buffer_send[2]=0x52;//R
    serial_buffer_send[3]=0x49;//I
    serial_buffer_send[4]=0x41;//A
    index=0;

    letter=0x41;


  stato=SUCCESS;





    for (i = 0; i < UART_QUEUE_LEN; i++)
    uartQueue[i] = &uartQueueBufs[i];
    uartIn = uartOut = 0;
    uartBusy = FALSE;
    uartFull = TRUE;

    for (i = 0; i < RADIO_QUEUE_LEN; i++)
      radioQueue[i] = &radioQueueBufs[i];
    radioIn = radioOut = 0;
    radioBusy = FALSE;
    radioFull = TRUE;

    call RadioControl.start();

 if (  (call SerialControl1.start() ==stato )   )
    {

    uartFull = FALSE;
    }


}




  event void RadioControl.startDone(error_t error) {
    if (error == SUCCESS) {
      radioFull = FALSE;
    }



}












  event void RadioControl.stopDone(error_t error) {}

  uint8_t count = 0;

  message_t* receive(message_t* msg, void* payload, uint8_t len);
//PROTOTIPO DELLA FUNZIONE

//LA FUNZIONE RESTITUISCE IL PUNTATORE AL PAYLOAD DELLA FRAME RX



/******************************************************************************/

//SE RX UN MESSAGGIO DALLA RADIO ESEGUI LA FUNZIONE RECIEVE

event message_t *RadioSnoop.receive[am_id_t id](message_t *msg,
                            void *payload,
                            uint8_t len) {


    //dropBlink();
    return receive(msg, payload, len);
  }

  event message_t *RadioReceive.receive [am_id_t id](message_t *msg,
                            void *payload,
                            uint8_t len) {




    //dropBlink();
    return receive(msg, payload, len);
  }

/**********************************************************************/








/************
IMPLEMENTAZIONE DELLA FUNZIONE RECIEVE:
    1=HO RX UN MESSAGGIO SULLA RADIO
    LO DEVO TRASFERIRE VIA SERIALE


****/

//uartIn TIENE CONTO INDICE DOVE METTERE IL PACCHETTO RADIO CHE E' STATO RX
//uartAut E' L'INDICE DELLA CODA DA DOVE SI PRENDERE IL MESSAGGIO DA MANDARE
SULLA UART



message_t* receive(message_t *msg, void *payload, uint8_t len) {
    message_t *ret = msg; //RET CONTIENE IL PUNTATORE AL MESSAGGIO RX

    atomic {
      if (!uartFull) //UART FULL DICE SE CODA UART PIENA
    {//UART CODA NON PIENA

    ret = uartQueue[uartIn]; //in ret metti il messaggio ultimo di
spedizione sulla seriale

    uartQueue[uartIn] = msg;//sostituisci nel ultimo posto della coda il msg
appena arrivato

      uartIn = (uartIn + 1) % UART_QUEUE_LEN;  //vedi il resto della
divisione e mettilo in uarti

      if (uartIn == uartOut)  //se indice di uartIn = indice Uart out allora
la coda e' piena e
        uartFull = TRUE;  //setta la variabile coda uart piena a VERO

      if (!uartBusy)     //LA UART E' LIBERA? (NESSUNO STA USANDO LA UART)
        {
          post uartSendTask();   //MANDA IL TASK PER SPIDERE IL PACCHETTO RX
SULLA RADIO

        uartBusy = TRUE;     //AVVISA CHE LA UART E' STATA OCCUPATA
        }
    }

    else       //UART CODA PIENA FAI DROPPARE IL LED
    dropBlink();
    }

    return ret;  //RESTITUISCI IL PUNTATORE AL MESSAGGIO PRESENTE NELLA CODA
NEL PENULTIMO POSTO
  }






uint8_t tmpLen;

  task void uartSendTask() {  //INIT TASKS

    uint8_t len;
    am_id_t id;
    am_addr_t addr;
    message_t* msg;




    atomic
      if (uartIn == uartOut && !uartFull)  //SE INDICE CODA ULTIMO MESSAGGIO
ENTARTO E' UGUALE ALL'
    {                 //ALL'INDICE DEL MESSAGGIO DA PRENDERE E LA CODA NON
E' FULL
      uartBusy = FALSE;//ALLORA SIGNIFICA CHE LA CODA E' VUOTA LIBERA LA
UART E RITORNA
      return;
    }

    msg = uartQueue[uartOut];  //SE HO QUALCOSA DA LANCIARE SULLA UART
PRENDI IL MSG INDICATO
    tmpLen = len = call RadioPacket.payloadLength(msg);//DA INDEX uartOut E
SPEDISCILO
    id = call RadioAMPacket.type (msg);  //CARICA ID DEL MESS DA SPEDIRE
    addr = call RadioAMPacket.destination(msg); //CARICA INDIRIZZO AM DEL
MESS DA SPEDIRE



 
/**********************************************************************************************/

/**********************************************************************************************/

/**********************************************************************************************/


call Leds.led0Toggle ();


call SerialByteComm.put(letter);



atomic
    if (msg == uartQueue[uartOut])
      {
        if (++uartOut >= UART_QUEUE_LEN)
          uartOut = 0;
        if (uartFull)
          uartFull = FALSE;
      }






uartBusy =FALSE;
return;
}







/**********************************************************************************************/

 
/**********************************************************************************************/

 
/**********************************************************************************************/



event void RadioSend.sendDone[am_id_t id](message_t* msg, error_t error) {}


async event void SerialByteComm.putDone(){}


async event void SerialByteComm.get(uint8_t data){}






}


and the error message is:

/*******************ERROR MESSAGE*******************************/

make micaz
mkdir -p build/micaz
    compiling BaseStationC to a micaz binary
ncc -o build/micaz/main.exe -Os -finline-limit=100000 -Wall -Wshadow
-Wnesc-all -target=micaz -fnesc-cfile=build/micaz/app.c -board=micasb
-DCC2420_NO_ACKNOWLEDGEMENTS -DCC2420_NO_ADDRESS_RECOGNITION
-DIDENT_PROGRAM_NAME=\"BaseStationC\" -DIDENT_USER_ID=\"xubuntos\"
-DIDENT_HOSTNAME=\"xubuntos-tinyos\" -DIDENT_USER_HASH=0x00f95284L
-DIDENT_UNIX_TIME=0x4766373eL -DIDENT_UID_HASH=0xb69b98a3L
-fnesc-dump=wiring -fnesc-dump='interfaces(!abstract())'
-fnesc-dump='referenced(interfacedefs, components)'
-fnesc-dumpfile=build/micaz/wiring- check.xml BaseStationC.nc -lm
In component `BaseStationC':
BaseStationC.nc:73: component UartC not found
BaseStationC.nc:83: no match
BaseStationC.nc:84: no match
make: *** [exe0] Error 1
[EMAIL PROTECTED]
:/opt/tinyos-2.x/apps/BaseStation_uartc_serialbytecomm$


/****************************************************************************************/

I develop a similar application with TinyOS 1.x used the module HPLUART0M
and the interface HPLUART and the application run properly.


What is the problem?

Thanks for all.


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

Reply via email to