Hi all, Is there anybody that has the same experience with me ? After the UART in Micaz is turned off, it cannot be turned on again.
Even though the SplitControl for start and stop returns SUCCESS, I cannot send anything to the UART. Here's the sample of my code: TosUartControlP.nc ----------------------------------------------------- module TosUartControlP { uses { interface Boot; interface Timer<TMilli>; interface SplitControl as UartControl; interface Packet; interface AMSend; interface Leds; } } implementation { task void send_packet(); void blinkLeds(); void blinkRedLed(); void blinkGreenLed(); void blinkYellowLed(); event void Boot.booted() { blinkLeds(); // Start sending every 5-sec call Timer.startPeriodic(5120); } event void Timer.fired() { if (call UartControl.start() == FAIL) { blinkRedLed(); } } event void UartControl.startDone(error_t result) { if (result == SUCCESS) { blinkGreenLed(); post send_packet(); } else { blinkRedLed(); } } message_t tosPacket; uint8_t messageCounter; task void send_packet() { uint8_t *radioPacket = (uint8_t *) call Packet.getPayload (&tosPacket, NULL); *radioPacket = messageCounter; messageCounter++; if (call AMSend.send(0x00, &tosPacket, sizeof (uint8_t)) == FAIL) { blinkRedLed(); } } event void AMSend.sendDone (message_t * msg, error_t err) { if ((msg == &tosPacket) && (err == SUCCESS)) { call UartControl.stop(); } else { blinkRedLed(); } } event void UartControl.stopDone(error_t error) { if (error == SUCCESS) { blinkYellowLed(); } else { blinkRedLed(); } } void blinkLeds() { uint16_t delay; call Leds.led0On(); call Leds.led1On(); call Leds.led2On(); for (delay = 0; delay < 0xFFFF; delay++); call Leds.led0Off(); call Leds.led1Off(); call Leds.led2Off(); } void blinkRedLed() { uint16_t delay; call Leds.led0On(); for (delay = 0; delay < 0xFFFF; delay++); call Leds.led0Off(); } void blinkGreenLed() { uint16_t delay; call Leds.led1On(); for (delay = 0; delay < 0xFFFF; delay++); call Leds.led1Off(); } void blinkYellowLed() { uint16_t delay; call Leds.led2On(); for (delay = 0; delay < 0xFFFF; delay++); call Leds.led2Off(); } } ----------------------------------------------------- TosUartControlC.nc configuration TosUartControlC { } implementation { components MainC; components TosUartControlP; TosUartControlP.Boot -> MainC; components new TimerMilliC() as Timer; TosUartControlP.Timer -> Timer; components SerialActiveMessageC; TosUartControlP.UartControl -> SerialActiveMessageC; components new SerialAMSenderC (0xFF); TosUartControlP.Packet -> SerialAMSenderC; TosUartControlP.AMSend -> SerialAMSenderC; components LedsC; TosUartControlP.Leds -> LedsC; } ----------------------------------------------------- Makefile COMPONENT=TosUartControlC include $(MAKERULES) ----------------------------------------------------- Thanks in advance Regards, -daniel _______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help