Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
alexru
PostPosted: May 22, 2012 - 11:41 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4870
Location: San Jose, CA

The same way, using APS_DataReq(). There is no "change one-line solution", you'll need to understand how demo application works and modify it accordingly.

_________________
The opinions and views expressed by me on this forum are my own and do not represent my employer or anyone else that I’m affiliated with.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
Marco84
PostPosted: May 28, 2012 - 05:24 PM
Newbie


Joined: Feb 23, 2012
Posts: 11


Thank you alexru,

I made the coord send frames to it self (just testing) and i figure that the problem is the endDevice, it just ignore frames... i have try doing the same thing (send frames to it self) but nothing happens...

I did following changes cause i think the problem is the address:

//Configuring EndDevice like source
simpleDescriptor.AppDeviceId=CPU_TO_LE16(2);

//Configuring EnDevice like dst
messageParams.dstAddress.shortAddress=CPU_TO_LE16(2);
...
//Config msg
messageParams.asduLength=5;
messageParams.asdu = (uint8_t *)("HELLO");

//Callback
void APS_DataIndDevice(APS_DataInd_t *indData)
{
//indData = indData;

appSendLcdMsg(indData->asdu);
}

And i know that it sent frames cause APS_DataConf() works

_________________
Marco Alves
 
 View user's profile Send private message  
Reply with quote Back to top
Marco84
PostPosted: May 29, 2012 - 11:08 AM
Newbie


Joined: Feb 23, 2012
Posts: 11


Hello again,

i cheked that endDevice address was wrong...

I checked my real endDevice address from this:

static void ZDO_StartNetworkConf(ZDO_StartNetworkConf_t *confirmInfo)
{
//MY LINE CODE
appSendLcdMsg(confirmInfo->shortAddr);

appTaskHandler(
APP_NETWORK_STARTING_DONE,confirmInfo);
}

but i retrieve a strange result like "UUUU>>>C" what it is mean? and never is the same when i restar it, but that is because is selected randomly by the stack right?.

_________________
Marco Alves
 
 View user's profile Send private message  
Reply with quote Back to top
Marco84
PostPosted: May 29, 2012 - 02:31 PM
Newbie


Joined: Feb 23, 2012
Posts: 11


ok! I did it! I set the endDevice send frames to it self too.

but now i have a new issue...How coordinator extracts the short address of the frame that comes EndDevice?
The problem is here:

void APS_DataIndCoord(APS_DataInd_t *indData)
{

appSendLcdMsg(indData->asdu);

messageParams.dstAddress.shortAddress = indData->srcAddress; //ERROR!
}

_________________
Marco Alves
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: May 29, 2012 - 06:47 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4870
Location: San Jose, CA

1.
Quote:
messageParams.asdu = (uint8_t *)("HELLO");
is incorrect. You need to define place for headers and footers.
2. You should look at the definition of APS_DataInd_t. In this case it is indData->srcAddress.shortAddress (or .extAddress); you also need to take into account addressing mode (indData->srcAddrMode).

_________________
The opinions and views expressed by me on this forum are my own and do not represent my employer or anyone else that I’m affiliated with.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
Marco84
PostPosted: May 30, 2012 - 10:43 AM
Newbie


Joined: Feb 23, 2012
Posts: 11


Thanks for your reply alexru,

Quote:
You should look at the definition of APS_DataInd_t. In this case it is indData->srcAddress.shortAddress (or .extAddress); you also need to take into account addressing mode (indData->srcAddrMode).

I got it, I set the EndDevice to send frames to itself.
Code:
// Prefilling request parameters messageParams.profileId=simpleDescriptor.AppProfileId;
messageParams.dstAddrMode=APS_SHORT_ADDRESS;
messageParams.dstEndpoint=1;
messageParams.clusterId=CPU_TO_LE16(1);
messageParams.srcEndpoint=simpleDescriptor.endpoint;
messageParams.asduLength=6;
messageParams.asdu=(uint8_t *)("HELLO");
messageParams.txOptions.acknowledgedTransmission=1;
messageParams.radius=0x0;
messageParams.APS_DataConf=APS_DataConf;


to get the destAdress:

Code:
static void ZDO_StartNetworkConf(ZDO_StartNetworkConf_t *confirmInfo)
{
messageParams.dstAddress.shortAddress=confirmInfo->shortAddr;

appTaskHandler(APP_NETWORK_STARTING_DONE,confirmInfo);
}


and to show on display:

Code:
void APS_DataIndDevice(APS_DataInd_t *indData)
{
  //indData = indData;
  appSendLcdMsg(indData->asdu);
}
 
 View user's profile Send private message  
Reply with quote Back to top
Marco84
PostPosted: May 30, 2012 - 11:16 AM
Newbie


Joined: Feb 23, 2012
Posts: 11


Now, to send frames from coordinator to EndDevice.
The coordinator must get the adress of the EndDevice and use it, right?
I tried get it by APS_DataInd function but nothing...
and by ZDO_MgmtNwkUpdateNotf function and nothing too.

How do i for the Coordinator get EndDevice's address?

regards

_________________
Marco Alves
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: May 30, 2012 - 05:12 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4870
Location: San Jose, CA

I'm sorry, but I will not reply unless you correct the error in this line:
Code:
messageParams.asdu=(uint8_t *)("HELLO");
\
It might work right now, but you've got memory override problem here.

_________________
The opinions and views expressed by me on this forum are my own and do not represent my employer or anyone else that I’m affiliated with.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
Marco84
PostPosted: May 31, 2012 - 12:04 PM
Newbie


Joined: Feb 23, 2012
Posts: 11


Ok, I'm taking up Header and Footer space...
So, my "HELLO" must be in data field of AppMessageRequest_t struct

and back to the same code line:
messageParams.asdu =(uint8_t *)(&appMessage.data);

EndDevice:

So, In the apropriate struct I added "myData":
Code:
//--------------------------------------------------
// ASDU
typedef struct
{
  uint8_t        header[APS_ASDU_OFFSET];
  AppMessage_t   data;
  uint8_t        footer[APS_AFFIX_LENGTH - APS_ASDU_OFFSET];
} PACK AppMessageRequest_t;
END_PACK
//--------------------------------------------------


Code:
BEGIN_PACK
typedef struct
{
  uint32_t    myData;
  uint8_t     messageType;
  uint8_t     nodeType;
  ExtAddr_t   extAddr;
  ShortAddr_t shortAddr;
  uint32_t    softVersion;
  uint32_t    channelMask;
  PanId_t     panID;
  uint8_t     workingChannel;
  ShortAddr_t parentShortAddr;
  uint8_t     lqi;
  int8_t      rssi;
  //additional field
  uint8_t     boardType;//1
  uint8_t     sensorsSize;//1
  struct {
    int32_t  battery;
    int32_t  temperature;
    int32_t  light;
  } meshbean;
} PACK AppMessage_t;


and give it "HELLO" Frame:

Code:
AppMessageRequest_t appMessage;
appMessage.data.myData        = "HELLO";
messageParams.asdu =(uint8_t *)(&appMessage.data.myData);


In Coordinator

Code:
void APS_DataIndCoord(APS_DataInd_t *indData)
{
//---------------------------------------------------
  appSendLcdMsg(indData->asdu);
//---------------------------------------------------
}


But this doesn't works properly...
What I missed?

_________________
Marco Alves
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: May 31, 2012 - 04:52 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4870
Location: San Jose, CA

"HELLO" is not of type uint32_t.

Compiler should have complained about this.

_________________
The opinions and views expressed by me on this forum are my own and do not represent my employer or anyone else that I’m affiliated with.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits