[Tinyos-help] UARTComm and UART0
Hi, I am trying to connect 2 tmote sky devices over the UART0 expansion pins. I looked at the UARTComm example. It achieves the functionality of communicating to and fro with the PC over the UART1 serial link. Is it possible to modify this to send data over UART0 instead? If not, is there a way to communicate over UART0 to another mote? I implemented a simple send mechanism. But I haven't been able to figure out a way to receive over UART0 via an interrupt/event. Thanks! Bhavish ___ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] UART0 Rx tmote sky
Hi, I'm using tmote sky. I want to exchange data between 2 motes over the UART0 bus of expansion connector. I've connected the 2 grounds together and connected UART0TX of 1st mote to UART0RX of other mote and vice versa. I'm able to use the sample given in http://www.moteiv.com/community/Boomerang_UART0_Sample to send data over UART0 keeping in mind shared bus. But I am unable to receive data at the other mote. I've written code which handles a rxdone event. But i'm not clear what the error is and can't find sufficient documentation for the same. I'd be thankful for some guidance on the code. Bhavish The code to receive is as under: UART0Rx: configuration UART0Rx { } implementation { components SPC , LedsC , new MSP430ResourceUART0C() as ResourceCmdC , HPLUSART0M , Main , UART0RxP ; Main.StdControl -> UART0RxP; UART0RxP.ResourceCmd -> ResourceCmdC; UART0RxP.UartControl -> HPLUSART0M; UART0RxP.Leds -> LedsC; } UART0RxP: module UART0RxP{ provides{ interface StdControl; } uses{ interface ResourceCmd; interface Leds; interface HPLUSARTControl as UartControl; interface HPLUSARTFeedback as UartFeedback; } } implementation{ uint8_t data = 'z'; command result_t StdControl.init(){ return SUCCESS; } async event result_t UartFeedback.rxDone(uint8_t rxdata){ call Leds.yellowOn(); call ResourceCmd.release(); } async event result_t UartFeedback.txDone(){} event void ResourceCmd.granted(uint8_t rh) { call UartControl.setClockSource(SSEL_2); call UartControl.setClockRate(UBR_SMCLK_9600, UMCTL_SMCLK_9600); call UartControl.enableUARTRx(); if((call UartControl.enableRxIntr())){ call Leds.redOn(); } if((call UartControl.isUARTrx())){ call Leds.greenOn(); } while(data != 0x12){ data = call UartControl.rx(); } } command result_t StdControl.start(){ call ResourceCmd.request( RESOURCE_NONE ); return SUCCESS; } command result_t StdControl.stop(){ return SUCCESS; } } ___ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] UART0 Feedback
Hi, I'm using the UART0 interface on the expansion connector of the tmote sky to receive data. I'm able to receive data by polling for it. The code is attached. But when I try and use HPLUSARTFeedback interface to receive data via interrupts using rxDone, nothing happens. I'm not sure whether it is possible to use interrupts on the UART0 line. If not, would I2C be more suitable? I'll be thankful for any guidance Bhavish ___ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] GIO interrupt on tmote sky
Hi, I'm trying to use the GIO0 pin as a hardware interrupt. I read about the mechanism to do this. The archives and documentation says that I have to join the R14 ends together and then I can use it as interrupt. I'm not sure about this method. Also, what interface will I use to generate the interrupts? I'll be very thankful for any ideas/guidance. Bhavish ___ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] TOS_Msg size
Hi, I've been trying to send a TOS_Msg struct over wires between 2 tmote sky nodes. One thing I am not sure about is what is the size of TOS_Msg packet that will be transmitted? I will be extremely thankful for any help on this issue. To transmit, I am doing the following: typedef struct{ uint8_t val; }datanew; TOS_MsgPtr msg; body = (datanew*) msg->data; body->val = 1; packet = (uint8_t*) msg; length = sizeof(msg); while(length > 0){ call UartControl.tx(packet[sendCount]); while (! call UartControl.isTxEmpty() ) ; length--; sendCount++; } ___ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] Leds issue
Hi, I am facing a very strange issue with Leds. In the following code, the leds light up when i give a constant value. But not when I give a variable. Can somebody help me with this. Bhavish The code is: uint8_t count = 0; while(!(call UartControl.isRxIntrPending())); length = call UartControl.rx(); size = length; while(size > 0){ while(!(call UartControl.isRxIntrPending())); packet[length - size] = call UartControl.rx(); count++; size--; } call Leds.set(2 /*if i replace 2 by "count", the leds don't light up*/); ___ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] Stream voice over 802.15.4
Hi, I want to stream voice from one computer to another over tmotes connected to either comp over usb. I couldn't find a way to send streams over the radio. How can I achieve this? Would I have to put the data in the mote memory first or is there a way to stream directly from the usb to radio. I would really appreciate some help on this issue. Thanks, Bhavish ___ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
Re: [Tinyos-help] Private key encryption in Tinyos
Hi, There is hardware encryption available in msp430. You might want to look at that. Though I haven't been able to get it working ;) Bhavish On Jan 13, 2008 3:12 PM, Huzaifa Al Nahas <[EMAIL PROTECTED]> wrote: > Hello, > Is there any private key encryption algorithms available for TinyOS? > > Thanks, > Huzaifa > > > ___ > 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
[Tinyos-help] Basestation-Basestation communication
Hi, I'm trying to communicate between 2 basestations attached to the same host computer. I bound a SerialForwarder to each Basestation. Now, I ran TestSerial with one SerialForwarder as it's packet source and net.tinyos.tools.Listen on the other SerialForwarder. While the BaseStation sending packets over radio toggles the red LED (indicating packets bridged from serial to radio), th other BaseStation doesn't seem to receive anything. Is this because of a Group ID issue? I am able to receive using net.tinyos.tools.Listen on a BaseStation when the other mote is running BlinkToRadio (the BaseStation toggles it's green LED, indicating transfer from radio to serial). Any insights into this would be very helpful. Thanks Bhavish ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
Re: [Tinyos-help] Basestation-Basestation communication
Hi, I solved my problem. I was setting the AM packet size to be 34 in one mote and sending 34 bytes and leaving the default 28 on the other. Thus the other mote drops all packets it receives. I am testing mote-mote communication over wireless and thus did a loopback. Bhavish On Feb 19, 2008 9:33 PM, Siirtola Harri <[EMAIL PROTECTED]> wrote: > > I think these apps strip packets originating from their own ID. That's > something that shouldn't occur in a mesh network anyway. > > Why do you want a loopback situation like that? > > Regards, > > Harri > > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Bhavish Aggarwal > Sent: Tuesday, February 19, 2008 12:34 PM > To: tinyos-help@millennium.berkeley.edu > Subject: [Tinyos-help] Basestation-Basestation communication > > Hi, > > I'm trying to communicate between 2 basestations attached to the same > host computer. I bound a SerialForwarder to each Basestation. Now, I ran > TestSerial with one SerialForwarder as it's packet source and > net.tinyos.tools.Listen on the other SerialForwarder. While the > BaseStation sending packets over radio toggles the red LED (indicating > packets bridged from serial to radio), th other BaseStation doesn't seem > to receive anything. Is this because of a Group ID issue? > > I am able to receive using net.tinyos.tools.Listen on a BaseStation when > the other mote is running BlinkToRadio (the BaseStation toggles it's > green LED, indicating transfer from radio to serial). > > Any insights into this would be very helpful. > > Thanks > > Bhavish > ___ > 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
[Tinyos-help] USB UART capacity
Hi, I am trying to ascertain the maximum rate at which packets can be sent from mote to PC via USB. I'm using the tinyos-2.0 BaseStation app on both the sender mote and receiver mote. At the sender, I'm using TestSerial to send packets via USB to the mote in a loop without any sleep in between successive sends and without the ACK mechanism in Packetizer.java. Given that the mote to PC UART communication is "best effort", I would expect the number of packets transferred to the PC to be equal to the number of packets incoming from the radio at the receiver. But the number of packets received on the PC (using the Listen app) is less than the number of packets sent. What is the bottleneck in this case? I would really appreciate any ideas. Thanks, Bhavish ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] Re: USB UART capacity
I also tried using TestSerialBandwidth. I commented out the code in TestSerial.java which sends packets to mote. Thus, I'm only sending packets to the PC from mote. Using the "as fast as possible" mode, I can send packets at the rate of approx 100Hz in the direction mote to PC. What limits the rate from being higher? Bhavish On Tue, Feb 26, 2008 at 1:52 AM, Bhavish Aggarwal <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to ascertain the maximum rate at which packets can be sent > from mote to PC via USB. I'm using the tinyos-2.0 BaseStation app on > both the sender mote and receiver mote. At the sender, I'm using > TestSerial to send packets via USB to the mote in a loop without any > sleep in between successive sends and without the ACK mechanism in > Packetizer.java. > > Given that the mote to PC UART communication is "best effort", I would > expect the number of packets transferred to the PC to be equal to the > number of packets incoming from the radio at the receiver. But the > number of packets received on the PC (using the Listen app) is less > than the number of packets sent. What is the bottleneck in this case? > > I would really appreciate any ideas. > > Thanks, > > Bhavish > ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] Basestation app
Hi, I'm sending AM packets to a mote from a PC via USB at a rate of 20 ms with data payload = 33 bytes. I've disabled the ack mechanism in the PC to mote USB transfer. But only a fraction of the packets I send reach the mote (I am incrementing a counter in the UartReceive.receive event). On the other hand, if I comment out the "post radiosendtask()", all packets I send from the PC reach the mote. Is the radio send api call taking more than 20 ms to send out 33 bytes of data? A simple back-of-envelope calculation using the data rate of 250kbits/sec over the radio shows that a packet of 33 bytes should take 1 ms to send out. I'd really appreciate any help on this issue. Thanks, Bhavish ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] CC2420 Send interface
Hi, I have to send packets over the CC2420 radio on tmote sky at a fast rate. I tried using the "AMSend" interface but this takes roughly 15ms per packet. I have not been able to figure out the reason for this high value. One possible reason could be that the AMSend addresses the packets so it might take a lot of overhead. There is an alternate "Send" interface which sends without addressing. But I couldn't find any component implementing it. Does anyone know the reason for this high value of time taken per packet or which component implements the "Send" interface for CC2420 radio? Thanks, Bhavish ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] Disable backoff CC2420 tmote sky
Hi, I too tried the same solution for disabling backoffs i.e. setting the value of the events initialBackoff and congestionbackoff to 0 and 1 in CC2420RadioM. But it did not make any perceivable difference in the time taken for a packet to be transmitted (the time difference between the send call and sendDone signal). This time was 6 ms before and after turning off backoff. Is there something I missed in this procedure? Thanks, Bhavish On Thu, Jan 24, 2008 at 7:31 PM, shamo <[EMAIL PROTECTED]> wrote: > > > > > Dear Sir, > > I just read David's answer about how to disable backoff.I use tmote sky.As > he said, I connect CC2420RadioM to MacBackoff, and write initialBackoff(...) > and congestionBackoff(...) event to return 0 or 1. However, it does not > work. It seems that I can not disable the backoff in this way.I do not know > why.Please give me a help. Can you give me an example? > > > Your answer:--- > TinyOS 1.x: > > configuration CC2420RadioC > { > provides { > ... > interface MacControl; > interface MacBackoff; > ... > } > } > > > interface MacBackoff > { > async event int16_t initialBackoff(TOS_MsgPtr m); > async event int16_t congestionBackoff(TOS_MsgPtr m); > } > > Connect to MacBackoff, and when you get an initialBackoff(...) or > congestionBackoff(...) event, return 0 or 1. This method wasn't very > friendly for systems that wanted to specify different backoff periods for > different outbound AM types. With extra programming, you can get the event > to set the backoff as you want it for any outbound message. > > -David > > - > > > > > > > SHA Mo > ___ > 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
Re: [Tinyos-help] Disable backoff CC2420 tmote sky
Hi David, Thanks for your reply. I managed to remove both the initial and congestion backoff by editing the CC2420RadioM.nc file and replacing signals to MacBackoff.initialBackoff() and MacBackoff.congestionBackoff() by the value 0. Cheers, Bhavish On Fri, Apr 4, 2008 at 9:09 PM, David Moss <[EMAIL PROTECTED]> wrote: > The proper way to disable CCA is to tell the radio to transmit without CCA. > > I don't support Tinyos 1.x, but if you look for a strobe command like > "STXONCCA" and change it to "STXON" then the radio will not use clear > channel assessments and there should never be a congestion backoff. The > initial backoff should still be in play, and you will probably need to edit > the radio stack code to properly and completely remove it. > > -David > > > > > > > -Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Bhavish > Aggarwal > Sent: Thursday, April 03, 2008 5:05 PM > To: tinyos-help > Subject: [Tinyos-help] Disable backoff CC2420 tmote sky > > Hi, > > I too tried the same solution for disabling backoffs i.e. setting the > value of the events initialBackoff and congestionbackoff to 0 and 1 in > CC2420RadioM. But it did not make any perceivable difference in the > time taken for a packet to be transmitted (the time difference between > the send call and sendDone signal). This time was 6 ms before and > after turning off backoff. > > Is there something I missed in this procedure? > > Thanks, > > Bhavish > > On Thu, Jan 24, 2008 at 7:31 PM, shamo <[EMAIL PROTECTED]> wrote: > > > > > > > > > > Dear Sir, > > > > I just read David's answer about how to disable backoff.I use tmote sky.As > > he said, I connect CC2420RadioM to MacBackoff, and write > initialBackoff(...) > > and congestionBackoff(...) event to return 0 or 1. However, it does not > > work. It seems that I can not disable the backoff in this way.I do not > know > > why.Please give me a help. Can you give me an example? > > > > > > Your answer:--- > > TinyOS 1.x: > > > > configuration CC2420RadioC > > { > > provides { > > ... > > interface MacControl; > > interface MacBackoff; > > ... > > } > > } > > > > > > interface MacBackoff > > { > > async event int16_t initialBackoff(TOS_MsgPtr m); > > async event int16_t congestionBackoff(TOS_MsgPtr m); > > } > > > > Connect to MacBackoff, and when you get an initialBackoff(...) or > > congestionBackoff(...) event, return 0 or 1. This method wasn't very > > friendly for systems that wanted to specify different backoff periods for > > different outbound AM types. With extra programming, you can get the > event > > to set the backoff as you want it for any outbound message. > > > > -David > > > > - > > > > > > > > > > > > > > SHA Mo > > ___ > > 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 > > > ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] sendDone not signalled when i send packet over radio
I am writing an application to bridge packets from UART to radio in tinyos 1. The send command on the radio returns a success but the senddone event is not signalled. Could anyone please help me with this issue. The code is as below. Thanks, Bhavish module UARTToRadioM{ provides{ interface StdControl; } uses{ interface StdControl as UARTControl; interface ReceiveMsg as UARTReceive; interface BareSendMsg as UARTSend; interface TokenReceiveMsg as UARTTokenReceive; interface StdControl as RadioControl; interface BareSendMsg as RadioSend; interface ReceiveMsg as RadioReceive; interface Leds; } } implementation{ void failBlink(); command result_t StdControl.init() { result_t ok1, ok2, ok3; ok1 = call UARTControl.init(); ok2 = call RadioControl.init(); ok3 = call Leds.init(); return rcombine3(ok1, ok2, ok3); } command result_t StdControl.start() { result_t ok1, ok2; ok1 = call UARTControl.start(); ok2 = call RadioControl.start(); return rcombine(ok1, ok2); } command result_t StdControl.stop() { result_t ok1, ok2; ok1 = call UARTControl.stop(); ok2 = call RadioControl.stop(); return rcombine(ok1, ok2); } event result_t UARTSend.sendDone(TOS_MsgPtr msg, result_t success) { if (!success) { failBlink(); } return SUCCESS; } event TOS_MsgPtr UARTReceive.receive(TOS_MsgPtr Msg) { if (call RadioSend.send(&Msg) == SUCCESS) { call Leds.redToggle(); } else{ failBlink(); } return Msg; } event TOS_MsgPtr UARTTokenReceive.receive(TOS_MsgPtr Msg, uint8_t Token) { if (call RadioSend.send(Msg) == SUCCESS) { call Leds.redToggle(); } else{ call Leds.redToggle(); // failBlink(); } return Msg; } event TOS_MsgPtr RadioReceive.receive(TOS_MsgPtr Msg) { if ((!Msg->crc)) return Msg; if (call UARTSend.send(&Msg) == SUCCESS) { call Leds.greenToggle(); } else { failBlink(); } return Msg; } event result_t RadioSend.sendDone(TOS_MsgPtr msg, result_t success) { if (!success) { call Leds.greenToggle(); //failBlink(); } call Leds.yellowToggle(); return SUCCESS; } void failBlink() { call Leds.yellowToggle(); } } configuration UARTToRadioC { } implementation { components Main, UARTToRadioM, RadioCRCPacket as Comm, FramerM, UART, LedsC; Main.StdControl -> UARTToRadioM; UARTToRadioM.UARTControl -> FramerM; UARTToRadioM.UARTReceive -> FramerM; UARTToRadioM.UARTSend -> FramerM; UARTToRadioM.UARTTokenReceive -> FramerM; UARTToRadioM.RadioControl -> Comm; UARTToRadioM.RadioSend -> Comm; UARTToRadioM.RadioReceive -> Comm; UARTToRadioM.Leds -> LedsC; FramerM.ByteControl -> UART; FramerM.ByteComm -> UART; } ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
Re: [Tinyos-help] sendDone not signalled when i send packet over radio
Hi Brian, The red LED does toggle when I send. But neither the yellow (when senddone is signalled with success) or green(when senddone is signalled with failure) is toggled. Bhavish On Fri, Apr 11, 2008 at 10:03 PM, Brian Mulanda <[EMAIL PROTECTED]> wrote: > > It could be because the message doesn't get sent at all, due to > something in the packet. > > Does the red led come on or off when you send? > > -Brian > > > > event TOS_MsgPtr UARTReceive.receive(TOS_MsgPtr Msg) { > if (call RadioSend.send(&Msg) == SUCCESS) { > call Leds.redToggle(); > } > else{ > failBlink(); > } > > return Msg; > } > > event TOS_MsgPtr UARTTokenReceive.receive(TOS > _MsgPtr Msg, uint8_t Token) { > if (call RadioSend.send(Msg) == SUCCESS) { > call Leds.redToggle(); > } > else{ > call Leds.redToggle(); > // failBlink(); > } > > > > On Fri, Apr 11, 2008 at 10:46 AM, renjie huang <[EMAIL PROTECTED]> > wrote: > > > > Hi > > > > I think the reason may be due to the code of event TOS_MsgPtr > UARTTokenReceive.receive(TOS_MsgPtr Msg, uint8_t Token) ; > > > > When TokenReceiveMsg.receive event is signaled, you need to send back ack > by calling > > call TokenReceiveMsg.ReflectToken(gTokenBuf); > > > > You can see the code in FramAckM.nc. > > > > > > > > > > > > On Fri, Apr 11, 2008 at 1:58 AM, Bhavish Aggarwal > <[EMAIL PROTECTED]> wrote: > > > > > I am writing an application to bridge packets from UART to radio in > > > tinyos 1. The send command on the radio returns a success but the > > > senddone event is not signalled. Could anyone please help me with this > > > issue. The code is as below. > > > > > > Thanks, > > > > > > Bhavish > > > > > > module UARTToRadioM{ > > >provides{ > > >interface StdControl; > > >} > > >uses{ > > >interface StdControl as UARTControl; > > >interface ReceiveMsg as UARTReceive; > > >interface BareSendMsg as UARTSend; > > >interface TokenReceiveMsg as UARTTokenReceive; > > > > > >interface StdControl as RadioControl; > > >interface BareSendMsg as RadioSend; > > >interface ReceiveMsg as RadioReceive; > > > > > >interface Leds; > > >} > > > } > > > > > > implementation{ > > > > > > void failBlink(); > > > > > > command result_t StdControl.init() { > > >result_t ok1, ok2, ok3; > > > > > >ok1 = call UARTControl.init(); > > >ok2 = call RadioControl.init(); > > >ok3 = call Leds.init(); > > > > > >return rcombine3(ok1, ok2, ok3); > > > } > > > > > > command result_t StdControl.start() { > > >result_t ok1, ok2; > > > > > >ok1 = call UARTControl.start(); > > >ok2 = call RadioControl.start(); > > > > > >return rcombine(ok1, ok2); > > > } > > > > > > command result_t StdControl.stop() { > > >result_t ok1, ok2; > > > > > >ok1 = call UARTControl.stop(); > > >ok2 = call RadioControl.stop(); > > > > > >return rcombine(ok1, ok2); > > > } > > > > > > event result_t UARTSend.sendDone(TOS_MsgPtr msg, result_t success) { > > >if (!success) { > > > failBlink(); > > >} > > > > > >return SUCCESS; > > > } > > > > > > event TOS_MsgPtr UARTReceive.receive(TOS_MsgPtr Msg) { > > >if (call RadioSend.send(&Msg) == SUCCESS) { > > >call Leds.redToggle(); > > >} > > >else{ > > >failBlink(); > > >} > > > > > >return Msg; > > > } > > > > > > event TOS_MsgPtr UARTTokenReceive.receive(TOS_MsgPtr Msg, uint8_t > Token) { > > >if (call RadioSend.send(Msg) == SUCCESS) { > > >call Leds.redToggle(); > > >} > > >else{ > > >call Leds.redToggle(); > > > // failBlink(); > > >} > > > > > >re
[Tinyos-help] Not able to send on radio via GenericComm.SendMsg
Hi, I'm trying to bridge packets from serial to radio in tinyos1. I'm able to send packets to the mote via UART. I'm also able to use the GenericComm component and SendMsg interface to send radio packets. But when I try to club the 2 functionalities, i.e. send the packet received by UART signalled by the interface UartTokenReceive over the radio using SendMsg implemented by GenericComm, the send command doesn't go through. Infact, the UartTokenReceive event is also not signalled when the radio send functionality is added. Is this because the GenericComm and FramerM components can't be used simultaneously? I just can't figure out the problem and it would be great if somebody can help me out. The code is: #include "UARTMsg.h" #include "RADIOMsg.h" module PCToMoteRadioM{ provides interface StdControl; uses{ interface Leds; interface StdControl as UARTControl; interface StdControl as RadioControl; interface BareSendMsg as UARTSend; interface ReceiveMsg as UARTReceive; interface TokenReceiveMsg as UARTTokenReceive; interface SendMsg; } } implementation{ struct UARTMsg * pc_msg; RadioMsg * mote_radio; TOS_Msg to_radio; command result_t StdControl.init() { call UARTControl.init(); call Leds.init(); return SUCCESS; } command result_t StdControl.start() { call UARTControl.start(); return SUCCESS; } command result_t StdControl.stop() { call UARTControl.stop(); return SUCCESS; } event TOS_MsgPtr UARTReceive.receive(TOS_MsgPtr Msg) { call Leds.set(2); return Msg; } event TOS_MsgPtr UARTTokenReceive.receive(TOS_MsgPtr Msg, uint8_t Token) { call Leds.set(1); /*pc_msg = (struct UARTMsg *) Msg->data; mote_radio = (RadioMsg *) to_radio.data; mote_radio->count = pc_msg->count; if(call SendMsg.send(TOS_BCAST_ADDR, sizeof(RadioMsg), &to_radio) == SUCCESS){ call Leds.set(pc_msg->count); }*/ return Msg; } event result_t UARTSend.sendDone(TOS_MsgPtr msg, result_t success) { return SUCCESS; } event result_t SendMsg.sendDone(TOS_MsgPtr msg, result_t success){ return success; } } -- #include "UARTMsg.h" #include "RadioMsg.h" configuration PCToMoteRadioC{ } implementation{ components Main, PCToMoteRadioM, FramerM, UART, LedsC, GenericComm; Main.StdControl -> PCToMoteRadioM; PCToMoteRadioM.UARTControl -> FramerM; PCToMoteRadioM.UARTSend -> FramerM; PCToMoteRadioM.UARTReceive -> FramerM; PCToMoteRadioM.UARTTokenReceive -> FramerM; Main.StdControl -> GenericComm; PCToMoteRadioM.SendMsg -> GenericComm.SendMsg[AM_RADIOMSG]; PCToMoteRadioM.Leds -> LedsC; FramerM.ByteControl -> UART; FramerM.ByteComm -> UART; } Thanks, Bhavish ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
Re: [Tinyos-help] Not able to send on radio via GenericComm.SendMsg
Thanks for the reply Michael. I looked at the TOSBase application. The difference was in the Makefile. I had to add a line: "SP = REMOVE" Although my problem is solved, I don't have any idea what this line does in the Makefile! Cheers, Bhavish On Mon, Apr 14, 2008 at 11:31 PM, Michael Schippling <[EMAIL PROTECTED]> wrote: > Sounds like you are trying to reinvent the TOSBase or BaseStation apps. > I believe they use lower level calls because GenericComm can only have > one active message at a time, using the send() to sendDone() paradigm. > In any case, look at those two existing apps for clues. > MS > > > Bhavish Aggarwal wrote: > > > > > > > > > Hi, > > > > I'm trying to bridge packets from serial to radio in tinyos1. I'm able > > to send packets to the mote via UART. I'm also able to use the > > GenericComm component and SendMsg interface to send radio packets. But > > when I try to club the 2 functionalities, i.e. send the packet > > received by UART signalled by the interface UartTokenReceive over the > > radio using SendMsg implemented by GenericComm, the send command > > doesn't go through. Infact, the UartTokenReceive event is also not > > signalled when the radio send functionality is added. > > > > Is this because the GenericComm and FramerM components can't be used > > simultaneously? I just can't figure out the problem and it would be > > great if somebody can help me out. > > > > The code is: > > > > #include "UARTMsg.h" > > #include "RADIOMsg.h" > > > > module PCToMoteRadioM{ > >provides interface StdControl; > >uses{ > >interface Leds; > >interface StdControl as UARTControl; > >interface StdControl as RadioControl; > >interface BareSendMsg as UARTSend; > >interface ReceiveMsg as UARTReceive; > >interface TokenReceiveMsg as UARTTokenReceive; > >interface SendMsg; > >} > > } > > > > implementation{ > >struct UARTMsg * pc_msg; > >RadioMsg * mote_radio; > >TOS_Msg to_radio; > > > >command result_t StdControl.init() { > >call UARTControl.init(); > >call Leds.init(); > > > >return SUCCESS; > >} > > > >command result_t StdControl.start() { > >call UARTControl.start(); > > > >return SUCCESS; > >} > > > >command result_t StdControl.stop() { > >call UARTControl.stop(); > > > >return SUCCESS; > >} > > > >event TOS_MsgPtr UARTReceive.receive(TOS_MsgPtr Msg) { > >call Leds.set(2); > >return Msg; > >} > > > >event TOS_MsgPtr UARTTokenReceive.receive(TOS_MsgPtr Msg, uint8_t > Token) { > >call Leds.set(1); > >/*pc_msg = (struct UARTMsg *) Msg->data; > >mote_radio = (RadioMsg *) to_radio.data; > >mote_radio->count = pc_msg->count; > >if(call SendMsg.send(TOS_BCAST_ADDR, sizeof(RadioMsg), > &to_radio) == SUCCESS){ > >call Leds.set(pc_msg->count); > >}*/ > > > >return Msg; > >} > > > >event result_t UARTSend.sendDone(TOS_MsgPtr msg, result_t success) > { > >return SUCCESS; > >} > > > >event result_t SendMsg.sendDone(TOS_MsgPtr msg, result_t success){ > >return success; > >} > > } > > > > > -- > > #include "UARTMsg.h" > > #include "RadioMsg.h" > > > > configuration PCToMoteRadioC{ > > } > > > > implementation{ > >components Main, PCToMoteRadioM, FramerM, UART, LedsC, GenericComm; > > > >Main.StdControl -> PCToMoteRadioM; > >PCToMoteRadioM.UARTControl -> FramerM; > >PCToMoteRadioM.UARTSend -> FramerM; > >PCToMoteRadioM.UARTReceive -> FramerM; > >PCToMoteRadioM.UARTTokenReceive -> FramerM; > > > >Main.StdControl -> GenericComm; > >PCToMoteRadioM.SendMsg -> GenericComm.SendMsg[AM_RADIOMSG]; > > > >PCToMoteRadioM.Leds -> LedsC; > > > >FramerM.ByteControl -> UART; > >FramerM.ByteComm -> UART; > > } > > > > Thanks, > > > > Bhavish > > ___ > > Tinyos-help mailing list > > Tinyos-help@millennium.berkeley.edu > > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > > > > -- > Platform: WinXP/Cygwin > TinyOS version: 1.x, Boomerang > Programmer: MIB510 > Device(s): Mica2, MicaZ, Tmote > Sensor board: homebrew > > ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] UART send timing
Hi, I am doing an experiment in tinyos 1 to determine the time taken for a packet to be sent over the UART link to the PC i.e. the time difference between UARTSend.send() call and the signalling of sendDone event. This time comes out to be on an average 7 ms. Since there is no backoff like in the case of transmission over radio, this seems to be a very high value. Is there a specific reason for this? Does the underlying UART protocol wait for ACKs for each packet sent on it? The UARTSend interface is wired to FramerM as in TOSBase. Bhavish ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] TOSComm error
Hi, I am using boomerang on windows. I had been using the java serial-pc connection perfectly well and transferring packets to and fro. But I modified the Packetizer.java a little and did a make clean and make in the packet/ directory. I also recompiled the Packetizer.java file. After this, I'm not able to send any packets on the serial link and I get an error saying: Error on [EMAIL PROTECTED]:57600: java.io.IOException: Could not open COM14: TOSComm JNI library runtime error: Error 2. The system cannot find the file specified. in NativeSerialPort.CreateFile I'm simply running the net.tinyos.tools.Listen app and exporting the MOTECOM variable properly. The changes in Packetizer.java were not significant and I tried to undo them but the problem still persists. I even tried running the tos-install-jni as mentioned in a previous post. But that didn't help either. I'd be thankful for any pointers. Thanks, Bhavish ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
Re: [Tinyos-help] TOSComm error
I searched and found TOSComm.dll in my jre/bin directory. I copied the same to system32 directory but it still gives the same error. Is some classpath variable corrupted? Bhavish On Tue, Apr 15, 2008 at 11:00 PM, Michael Schippling <[EMAIL PROTECTED]> wrote: > Off hand I don't know the name of the TOSComm library, > but that's what's not being found. A little searching > should turn up that name, and then you should try to > find it on your system. It should either be in system32 > or in your JRE/bin directory. > > I guess you don't hear success stories, but in general > I've never heard that tos-install-jni has worked... > > MS > > Bhavish Aggarwal wrote: > > > > > > > > > Hi, > > > > I am using boomerang on windows. I had been using the java serial-pc > > connection perfectly well and transferring packets to and fro. But I > > modified the Packetizer.java a little and did a make clean and make in > > the packet/ directory. I also recompiled the Packetizer.java file. > > After this, I'm not able to send any packets on the serial link and I > > get an error saying: > > > > Error on [EMAIL PROTECTED]:57600: java.io.IOException: Could not open > > COM14: TOSComm JNI library runtime error: Error 2. > > The system cannot find the file specified. > > in NativeSerialPort.CreateFile > > > > I'm simply running the net.tinyos.tools.Listen app and exporting the > > MOTECOM variable properly. The changes in Packetizer.java were not > > significant and I tried to undo them but the problem still persists. > > > > I even tried running the tos-install-jni as mentioned in a previous > > post. But that didn't help either. I'd be thankful for any pointers. > > > > Thanks, > > > > Bhavish > > ___ > > Tinyos-help mailing list > > Tinyos-help@millennium.berkeley.edu > > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > > > > -- > Platform: WinXP/Cygwin > TinyOS version: 1.x, Boomerang > Programmer: MIB510 > Device(s): Mica2, MicaZ, Tmote > Sensor board: homebrew > > ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] UART communication PC->Mote using Packetizer.java
Hi, I'm trying to send packets from the PC to a mote over UART. I need to do this at a rate of 50pkts/sec i.e. a packet every 20ms. I wrote a java code which uses the net.tinyos.packet and net.tinyos.message libraries. The highest rate I'm able to get is around 20 packets/sec i.e. 50ms per packet. I assumed this is due to some ACK mechanism in the layers below Packetizer.java since I commented out the ACK loop in writeSourcePacket() in Packetizer.java. Is there any documentation available which deals with the UART communication details and the java implementation on the PC side? I looked around but could not find anything specific. Bhavish ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
Re: [Tinyos-help] TOSComm error
Hi, Thanks for the help. I've solved the problem by the not so elegant but effective technique of backing up my data and reinstalling boomerang :). Anyways, I tried solving the issue and would like to point out a couple of things: - Cygwin uses COM* naming. /dev/tty* would be used on unix. - I don't think there was an error due to the high COM numbers because I was still able to program the mote. - The java file that Urs attached did not give any error on my system. Bhavish On Thu, Apr 17, 2008 at 1:35 AM, Michiel Konstapel <[EMAIL PROTECTED]> wrote: > > > > > So, the OP should verify that his basestation is indeed attached to COM14, > > And then do a little search for errors like this as I remember seeing > > something about high numbers not working right. > > And, just guessing here since I haven't tried, check that COM14 is the > correct name to use under Cygwin - maybe it wants /dev/tty* port names? > Michiel > ___ > 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
[Tinyos-help] TOS_Msg length
Hi, I'm trying to ascertain the length of a TOS_Msg variable I've typecasted to a self-defined struct. The struct I use has 6 variables of 4 bytes each. Thus, the total length of the TOS_Msg variable should be 24 + 10(headers) = 34. But the length is shown to be 46. I'm confused as to how this is so. I'd be thankful for help on this. Bhavish ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] MAX packet size for Listen.java
Hi, I'm sending packets from mote to PC via UART and using the Listen.java app to print out the packet. I am sending an AM packet with data length (excluding headers etc.) of 44 bytes by modifying the -DTOSH_DATA_LENGTH flag in the makefile. But the packet is not output in the Listen.java app. On the other hand, if I send a packet with size less than the default, it is output in the Listen.java app. Is there an upper limit to the max. size the Listen.java app reads? And can that be changed like the DTOSH_DATA_LENGTH flag is changed? Thanks, Bhavish ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] HPLUSARTControl transmit timing
Hi, I've connected 2 tmotes over the UART) expansion connector and am sending AM packets from one to the other. I'm using the HPLUSARTControl interface provided by HPLUSART0M to do this. The transmit function in this interface is byte by byte. So I have to send the entire AM packet byte by byte. I transmit one byte and then go into a busy wait till HPLUSARTControl .isTxEmpty() returns true. After this I send the next byte. The time taken for each byte to be transferred is around 1.2 ms (and for the whole AM packet is about 55 ms). This seems to be a very high value for transfer over wire. I analyzed it a bit further and found that the isTxEmpty() returns true after approx. 1.2 ms for each byte. Is there a way to reduce this time? Also, is there no event signaled when transmission is completed? There is a HPLUSARTFeedback interface but I could't find any implementation for it. Thanks, Bhavish ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] HPLUSARTControl transmit timing
Hi, I've connected 2 tmotes over the UART) expansion connector and am sending AM packets from one to the other. I'm using the HPLUSARTControl interface provided by HPLUSART0M to do this. The transmit function in this interface is byte by byte. So I have to send the entire AM packet byte by byte. I transmit one byte and then go into a busy wait till HPLUSARTControl .isTxEmpty() returns true. After this I send the next byte. The time taken for each byte to be transferred is around 1.2 ms (and for the whole AM packet is about 55 ms). This seems to be a very high value for transfer over wire. I analyzed it a bit further and found that the isTxEmpty() returns true after approx. 1.2 ms for each byte. Is there a way to reduce this time? Also, is there no event signaled when transmission is completed? There is a HPLUSARTFeedback interface but I could't find any implementation for it. Thanks, Bhavish ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] HPLUSARTControl transmit timing
Hi, I've connected 2 tmotes over the UART) expansion connector and am sending AM packets from one to the other. I'm using the HPLUSARTControl interface provided by HPLUSART0M to do this. The transmit function in this interface is byte by byte. So I have to send the entire AM packet byte by byte. I transmit one byte and then go into a busy wait till HPLUSARTControl .isTxEmpty() returns true. After this I send the next byte. The time taken for each byte to be transferred is around 1.2 ms (and for the whole AM packet is about 55 ms). This seems to be a very high value for transfer over wire. I analyzed it a bit further and found that the isTxEmpty() returns true after approx. 1.2 ms for each byte. Is there a way to reduce this time? Also, is there no event signaled when transmission is completed? There is a HPLUSARTFeedback interface but I could't find any implementation for it. Thanks, Bhavish ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help