802.15.4 MAC's ASP interface : event request

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

802.15.4 MAC's ASP interface : event request

1,202 Views
irarc
Contributor I
Hello!
I'm implementing a wireless sensor application based on 802.15.4 MAC/PHY MyWirelessApp application example (1.063).
I use the 13192 DSK as hardware.
My problem is the following:
I have a sensor connected to the SARD card. I have to perform a measurement with the sensor every 3 seconds.
The easiest way to schedule this would be using the RTI option of the HCS08 MCU. But as I saw in the "Low power library for MAC and ZigBee stack applications", RTI will be further used during low power operations, so the complete application (including low power comsumption) cannot use RTI for scheduling measurements.
I saw that in the 802.15.4 MAC's ASP interface there's an event request service primitive. I hoped that this can substitue the RTI.
If I'm not wrong, it will cause the ASP to send an ASP message to the application a certain time later. The time is specified in the event request primitive, and it is relative to the time when it was called.
The problem is that it doesn't work.
I've tried to place the 1st event with the following code:

 uint8_t res;
 aspMsg_t aspEvent;
 aspEventReq_t *pEventReq;
   
 pEventReq = &aspEvent.appToAspMsg.msgData.aspEventReq;
 // Set the type.
 aspEvent.msgType = gAppAspEventReq_c;


 pEventReq->eventTime[0] = REQDATABYTE0;  //0
 pEventReq->eventTime[1] = REQDATABYTE1;  //0xff
 pEventReq->eventTime[2] = REQDATABYTE2;  //0
 
 // Send the request to the ASP SAP.

     res = MSG_Send(APP_ASP, &aspEvent);     
     
     if (res == gSuccess_c)
     {
       
       Uart_Print("Succes\n");
      // break; 
     }     
     if (res == gInvalidParameter_c)
     {
       Uart_Print("No success\n");
     }

This code has no effect. Printing to the screen shows, that sending the message wasn't succesful (res == gInvalidParameter_c)
Naturally no ASP to APP message comes.
I don't know if the hardware supports this function, or there is an other problem. (Maybe some extra initialization is needed?)
Can you help me? Is there any example code for using the event request primive?
If there is an other way to schedule measurement every 3 seconds, I will accept that, too.
 
Thanks:
--
Kelemen Szabolcs
Labels (1)
0 Kudos
1 Reply

319 Views
magic
Contributor I
Hi there...
 
I have done something similar. The following are samples that may be applicable to your problem. Try changing them one way or another to suit your needs.
 
...
anchor_t mAspAppInputQueue;
...
 
MSG_InitQueue(&mAspAppInputQueue);
....
 
aspMsg_t setPower;
uint8_t rc;
 
setPower.msgType = gAppAspSetPowerLevelReq_c;
  
setPower.appToAspMsg.msgData.aspSetPowerLevelReq.powerLevel = 0;
  
Uart_Print("Begin to start device...");
  
rc = MSG_Send(APP_ASP, &setPower);
  
if(rc == gInvalidParameter_c)  {
        Uart_Print("Cannot set power level\n");
} else
        Uart_Print("Lowest power level\n");
 
....
uint8_t ASP_APP_SapHandler(aspToAppMsg_t *pMsg)
{
  /* If the message is not handled anywhere it must be freed. */
  MSG_Queue(&mAspAppInputQueue, pMsg);
  return gSuccess_c;
}
 
I hope this will solve your problem
 
Good luck
0 Kudos