Can't compile samples from BitCloud (ZigBee) with WinAVR

Go To Last Post
986 posts / 0 new

Pages

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Short answer - not.

There are inter-pan messages defined in IEEE 802.15.4 standard, but ZigBee does not use them.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi alex,
I am working with avr bitcloud sice the last November, I am very interested in using the zigbit module for my project but the documentation from avr is not so complete... For example: I'm trying to keep the neighbor table in coordinator eeprom but in case of reset it seems to discard his end device childs and respondes in a wrong way to them.
Could you help me?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DiegoKer wrote:
For example: I'm trying to keep the neighbor table in coordinator eeprom but in case of reset it seems to discard his end device childs and respondes in a wrong way to them.

Set CS_POWER_FAILURE_ID parameter to true and BitCloud will automatically store all required parameters to EEPROM. Parameters are stored every 5 minutes by default, but you may manually flush them (see PDS_* functions descriptions).

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Set CS_POWER_FAILURE_ID parameter to true and BitCloud will automatically store all required parameters to EEPROM. Parameters are stored every 5 minutes by default, but you may manually flush them (see PDS_* functions descriptions).

Thank you
I will try...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Set CS_POWER_FAILURE_ID parameter to true and BitCloud will automatically store all required parameters to EEPROM. Parameters are stored every 5 minutes by default, but you may manually flush them (see PDS_* functions descriptions).

Thank you alex
I had to download bitcloud 1.7.0 because of some problems with CS_POWER_FAILURE but now all works....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please: help me!!
With bitcloud 1.7.0 I can't put in sleep the micro if node is not joined...
BC 1.6.0 has the same problem but after a ZDO_ResetNetworkReq() all was working...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DiegoKer wrote:
With bitcloud 1.7.0 I can't put in sleep the micro if node is not joined...

Holidays here ends at January 11, then I'll be able to see what problem might be.

But for now can you specify what do you mean by "can't put in sleep"? What functions do you call and what values they are returning?

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is the fuction:

iniSleepReq.ZDO_SleepConf=sleepReqConfirm;
ZDO_SleepReq(&iniSleepReq);

and the return value is

ZDO_BUSY_STATUS

Tank you...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DiegoKer wrote:
and the return value is
ZDO_BUSY_STATUS

Thanks. I'll look into it after I get back to work. It is quite possible that something was broken here in last release. Although I surprised that it did not worked properly the release before.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DiegoKer wrote:
Please: help me!!
With bitcloud 1.7.0 I can't put in sleep the micro if node is not joined...
BC 1.6.0 has the same problem but after a ZDO_ResetNetworkReq() all was working...

This is a bug. Will be fixed in next release (which is coming soon).

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tanks, have you got an idea on when the next release will be avaiable?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DiegoKer wrote:
Tanks, have you got an idea on when the next release will be avaiable?

I don't know for sure. It is now in verification, so it depends on amount of issues found. Also it appears on atmel.com with some delay. I'd expect few weeks.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have another problem:
when my coordinator (and routers probably) lost a child with a notification (ZDO_CHILD_REMOVED_STATUS in a network update event), the "ZDO_MgmtNwkUpdateNotf_t" param returned report the right ext_address but always 0xfffe as short_address (like as in a broadcast tx)...
this is not a big problem, but i choose the short address mode for all communications in the net...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DiegoKer wrote:
but always 0xfffe as short_address

0xfffe is MAC_NO_SHORT_ADDR. ZigBee specification is not clear about ZDO notificztions but CHILD_REMOVED notification is raised as a reaction to to NLME-LEAVE.indication primitive from network layer.

NLME-LEAVE.indication contains only extended address (ZigBee spec).

It is possible to try to look up short address, but situations where short address is unknown still will be possible.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

It is possible to try to look up short address, but situations where short address is unknown still will be possible.

I tryed to find the short by the extended address but probably after a CHILD_REMOVED notification its's alredy be removed from the address table.
Anyway this is not a big problem...
thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi alex,

How to overcome the limitation of refrain from using dynamic memory allocation ? I need this for an interface, where I don't know the exact number of data structures that will be reqested.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

lucicop wrote:
I need this for an interface, where I don't know the exact number of data structures that will be reqested.

What structures you are talking about?

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Alex,

I need to add the ability to send data from coordinator to router in WSNDemo. So far I can successfully read router’s messages on coordinator’s side, but I can’t receive coordinator's message on router's side.

At WSNCoord.c I successfully read received data inside APS_DataIndCoord(). At the router’s side, APS_DataIndRouter() is never reached...
One important clue, is that from APS_DataConf() on the coordinator's side I get an APS_SUCCESS_STATUS, so I guess that message leaves succesfully.

Here are my coordinator initializations:

case INITIAL_DEVICE_STATE:
 switch (event)
 {
   case APP_PROCESS:
    messageParams.profileId = simpleDescriptor.AppProfileId;
    messageParams.dstAddrMode = APS_SHORT_ADDRESS;
    messageParams.dstAddress.shortAddress = 0x0037;
    messageParams.dstEndpoint = 1;
    messageParams.clusterId = 1;
    messageParams.srcEndpoint = 1;
    messageParams.asduLength = sizeof(AppMessage_t);
    messageParams.asdu =(uint8_t)(&appMessage.data);                 
    messageParams.txOptions.acknowledgedTransmission = 1;
    messageParams.radius = 0x00;
    messageParams.APS_DataConf = PS_DataConf;
    .....
    .....
    break;
 } 

I send at address 0x0037. I use static short addressing and I verified this address (on router's side) using CS_ReadParameter().
Finally I send from coordinator like that:

case SENDING_DEVICE_STATE:
 switch (event)
  {
   case APP_PROCESS:
    .....
    APS_DataReq(&messageParams);
    .....
    break;
  }
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alexru wrote:
lucicop wrote:
I need this for an interface, where I don't know the exact number of data structures that will be reqested.

What structures you are talking about?

Hi alex,

I need some application specific structures to be instantiated dynamically, for example endpoint descriptors (suppose we need an interface to the stack, but we don't know what will be requested from it).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

lucicop wrote:
(suppose we need an interface to the stack, but we don't know what will be requested from it).

Can you give some example code (not working) illustrating what do you need?

With dynamic memory allocation think of what will you do if at some point you need more memory and allocator can't give you one.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alexis4 wrote:
I send at address 0x0037. I use static short addressing and I verified this address (on router's side) using CS_ReadParameter().

Actual used address is never put into CS. The best way to verify that correct address is set is to check it at coordinator's side. But due to success on coordinator data sending looks like address is right.

Can you send complete set of changes you made (preferably in the form of patch) so I could verify it here?

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alexru wrote:
lucicop wrote:
(suppose we need an interface to the stack, but we don't know what will be requested from it).

Can you give some example code (not working) illustrating what do you need?

With dynamic memory allocation think of what will you do if at some point you need more memory and allocator can't give you one.

I want to develop an application like SerialNet, but in binary format, and it should interface to all the functions in BitCloud. When an endpoint register is requested, it should allocate some memory. If no more memory is available, it will signal that in the status. By the way, can you tell me why malloc won't work ? And what way to have dynamic allocation ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

lucicop wrote:
I want to develop an application like SerialNet, but in binary format, and it should interface to all the functions in BitCloud. When an endpoint register is requested, it should allocate some memory. If no more memory is available, it will signal that in the status.

The way we do it all the time is following:
1.Collect all structures you'll need in one union.
2. Declare array of such unions (size depends on memory available and how much structures you'll need at the same time)
Add "busy" flag to each entry.
3. When needed allocate any non-busy record from array and mark it busy.
4. Clear busy flag after job is done.

lucicop wrote:

By the way, can you tell me why malloc won't work ? And what way to have dynamic allocation ?

Because malloc on device with 8Kb of RAM is nightmare.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you very much, alex. I will try your solution.

I was thinking today, it's a very good thing you are here to support us. You should be paid for that, if you are not already ;)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

lucicop wrote:
I was thinking today, it's a very good thing you are here to support us. You should be paid for that, if you are not already ;)

Well, I am getting paid for my job :) Helping you here is part of a fun and small compensation for a lack of good documentation.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alexru wrote:
Can you send complete set of changes you made
I will do that thank you! I am facing some hardware problems today, I need to solve them first and then I will send it to you.

alexru wrote:
Actual used address is never put into CS
I saw peer2peer.c and I thought that this thing is done in there, but I never worked this project so I must misunderstood something...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alexis4 wrote:
I saw peer2peer.c and I thought that this thing is done in there, but I never worked this project so I must misunderstood something...

I meant that if you write something to CS_NWK_ADDR and forget to set CS_NWK_UNIQUE_ADDR to true then BitCloud will use random nwk address and CS_NWK_ADDR will remain the same as you set it. It is never updated by the stack.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alexis4 wrote:
I can’t receive coordinator's message on router's side.
Well yesterday I used BitCloud1.7.0 and everything worked fine!
My C-R and C-ED peer2peer connections are established and payloads are read succesfully.
Really , I don't know what I did wrong in the first place.
I rewrote my code at 1.7.0 and things gone good!
alexru wrote:
Can you send complete set of changes you made (preferably in the form of patch)
Although it worked and a primitive demo version of my peer2peer part of the project is
ready, I will gladly post my files anyway if someone is having the same problems as I did. Just ask :wink:

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now I would like to ask some general questions about BitCloud not just to Alex but to all people that attending this thread. I am still a newbie, 3 months on BitCloud and ZigBee in general, so I guess that many of you out there can help me.

1) I am having problems using IAR, I get a Cstack pointer out of rage. AVRStudio seems to go better, but sometimes active (red) breakpoints could not be hit. However program runs OK (I see it in my LEDS). So I suspect that maybe this is a more general problem (I mean on MY board and MY PC and not general BitCloud's problem). And I am talking about ATMEL's WSNDemo downloaded on board and untouched by me. Has anyone ever fell on this problem?

2) I try to set external irq for ED's wake up as IRQ_FALLING_EDGE, but that doesn't seem to work all the time. So I set it as IRQ_LOW_LEVEL and when the irq comes I deactivate it and then re-activate it at sleep confirmation. That works OK.

3) I want to reduce wake up time of ED to minimum. Even with indirect poll rate at 10ms (I guess that this is no real life solution), the wake-up time at 2.4GHz using WSNDemo's frame size is almost 100ms. Is this the best I can get?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1) For me, AVR Studio is very buggy. IT has a lot of problems, with breakpoints and connection to the debugger. Don't trust it too much. See disassembler code to be real sure what is executed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alexis4 wrote:
Has anyone ever fell on this problem?

This may be due to compiler optimizations.

alexis4 wrote:
2) I try to set external irq for ED's wake up as IRQ_FALLING_EDGE, but that doesn't seem to work all the time. So I set it as IRQ_LOW_LEVEL and when the irq comes I deactivate it and then re-activate it at sleep confirmation. That works OK.

It does not work at all or work sometimes? How often it misses?

alexis4 wrote:
3) I want to reduce wake up time of ED to minimum.

When ED wakes up it:
1. Sends Data Request frame (polling parent for data).
2. Waits if parent have something to say in response for request.
3. Sends own data packet.
4. Sends Data Request again to receive APS ACK.
5. Waits for APS ACK.
6. Sends Data Request to check if parent has anything else for him.
7. Ready to sleep.

All this takes a while. One way to reduce time would be disabling APS ACKs.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi again Alex,

I guess I will be here for a while, since I'm making a resume of every Bitcloud function, so I'll need some clarifications for some of them.

For the moment: how does GetEndpointList function work ? It returns a structure that contains an endpoint descriptor, but what if we have more endpoints ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

lucicop wrote:
It returns a structure that contains an endpoint descriptor, but what if we have more endpoints ?

Endpoint descriptor contains service records to link it to the list.

Sample code:

APS_RegisterEndpointReq_t *desc;

desc = APS_GetEndpointList();
while (desc)
{
  // Do something

  desc = (APS_RegisterEndpointReq_t *) desc->service.next;
}

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alexru wrote:
This may be due to compiler optimizations
In a case like that breakpoint becomes white and I get a warning at reset. Maybe it can't cath it all.
alexru wrote:
It does not work at all or work sometimes? How often it misses?
Actually it misses almost all the time. I don't think it has to do with my button because I have tried it on many boards, with many buttons and pressed hard, on both IRQ_6 and IRQ_7. I have a 10K pull-up and a 100nF in parallel with my button. This is not a big problem since I got it working, but I was curious why does that happen.
alexru wrote:
All this takes a while. One way to reduce time would be disabling APS ACKs
I wouldn't do that becuase I will retransmit in a case like this for a couple of times.
So do I have access to APS ACKs from parent side, put it in high priority or something?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What does APS_IsOwnGroup do ? It seems to be an error in the documentation:

bool APS_IsOwnGroup ( ShortAddr_t addr )
Parameters:
[in] groupAddr - a group address

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alexis4 wrote:
So do I have access to APS ACKs from parent side, put it in high priority or something?

No. Acks behave like specification says, you can't do anything about it.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

lucicop wrote:
What does APS_IsOwnGroup do ?

This function checks if specified group address is the address of one of the groups device in.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you Alex!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alexis4 wrote:
Actually it misses almost all the time. I don't think it has to do with my button because I have tried it on many boards, with many buttons and pressed hard, on both IRQ_6 and IRQ_7. I have a 10K pull-up and a 100nF in parallel with my button. This is not a big problem since I got it working, but I was curious why does that happen.

Read data sheet carefully. Only level interrupt for INT7:4 is used for wake up mcu from power save or power down.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alXelax wrote:
Read data sheet carefully. Only level interrupt for INT7:4 is used for wake up mcu from power save or power down.

Yeah. I thought about that, but was too lazy to check it with datasheet :)

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Alex,

Is there any case when one would need/want to use more than one HAL_SpiDescriptor_t ? The same question for HAL_UsartDescriptor_t.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

lucicop wrote:
Is there any case when one would need/want to use more than one HAL_SpiDescriptor_t ? The same question for HAL_UsartDescriptor_t.

It depends on how many interfaces you want to use at the same time.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So I might want to reserve space for as many descriptors as there are physical interfaces on the module... thank you !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What does halWakeupFromIrq do ? Is it needed in a custom ISR handler that I add ? (for example for pin change interrupt).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

lucicop wrote:
What does halWakeupFromIrq do ? Is it needed in a custom ISR handler that I add ? (for example for pin change interrupt).

It stops sleep timer. Yes, you need to call it from every custom ISR handler from which MCU may wakeup from sleep.

PS: It also would be a good idea to follow structure of existing code in HAL.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

New question: function ZDO_GetNeibTable receives a pointer to a ZDO_Neib_t table. The number of entries is given by the function ZDO_GetNeibAmount ? Are they ordered ? The total of entries is routers + end devices ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

lucicop wrote:
The number of entries is given by the function ZDO_GetNeibAmount ?

Yes, number of entries is routersAmount + childrenAmount.

lucicop wrote:
Are they ordered ?

No, ordering is arbitrary.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I apologize if this was already covered, but there's a reference to over-the-air-upgrading in the WSNDemo app (an #ifdef'ed call to OTAU_Init(). Is OTAU included in the BitCloud library or is this a part of a separate library?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bickfordb wrote:
I apologize if this was already covered, but there's a reference to over-the-air-upgrading in the WSNDemo app (an #ifdef'ed call to OTAU_Init(). Is OTAU included in the BitCloud library or is this a part of a separate library?

OTAU at the current moment is not really supported. References in applications are to our proprietary protocol which is more of technology preview (there is demo on YouTube how it is working :) ). Real OTAU is coming, but standard is not finalized yet so it is hard to tell when it will be ready to use.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi alex,
I have another question:
When lqi value is updated?
I keep an end device in wake up state and a data request is continuosly transmitted to the parent wich responds with an acknoledge but the lqi value returned by "ZDO_GetLqiRssi()" don't change untill a data message is requested.
I need to visualize this value...

Pages