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

code-by wrote:
But both boards send data to C and C display them in Hyperterminal.

Yep. Backwards data transmission will lead to interesting results :). It does not matter if it works, it is just incorrect configuration.

code-by wrote:
reference to `USART_Write'

Copy also boardstubs.h and also pay attention to how USART channel is configured.

code-by wrote:
undefined reference to `ZDO_BindIndication'

Define ZDO_BindIndication(). See how it is defined in new sample app code.

Edit: you got it right :)

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

1. Can zigbee sniffer read data of all zigbee networks (with diff. addressed, channels, etc) or I must speicfy network address, channel, etc? Can it read secured nets?

2. can I change apsDataReq at runtime?

3. If I setup broadcast for C, can I setup unicast with ack for ED at the same time (and will data transmission work)?

4. Can I change packets structures at runtime (if I define two structures in H-file and want switch from one to another)?

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

alexru wrote:
...pay attention to how USART channel is configured.

you mean this?:

#ifndef APP_USE_NONE

// USART Tx buffer
static uint8_t usartTxBuffer[APP_USART_TX_BUFFER_SIZE];

// USART descriptor (required by stack)
static HAL_UsartDescriptor_t usartDescriptor =
{
...
};
#endif //APP_USE_NONE
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

code-by wrote:
1. Can zigbee sniffer read data of all zigbee networks (with diff. addressed, channels, etc) or I must speicfy network address, channel, etc? Can it read secured nets?

Depends on what sniffer do you use. In general you can listen to everything and security is possible to support.

code-by wrote:
2. can I change apsDataReq at runtime?

It is changed at runtime in Low Power application. You must not change it after call to APS_DataReq() and before confirmation is called.

code-by wrote:
3. If I setup broadcast for C, can I setup unicast with ack for ED at the same time (and will data transmission work)?

Yes, it is general data transfer service, you may specify whatever options you like on any device.

code-by wrote:
4. Can I change packets structures at runtime (if I define two structures in H-file and want switch from one to another)?

Yes, APS_DataReq() takes pointer to buffer. Meaning of data in this buffer is up to application.

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:
code-by wrote:
1. Can zigbee sniffer read data of all zigbee networks...

Depends on what sniffer do you use. In general you can listen to everything and security is possible to support.

So someone can analyze/hack my data and then send wrong data and cause my controlling device make smthg wrong? :)

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

code-by wrote:
So someone can analyze/hack my data and then send wrong data and cause my controlling device make smthg wrong? :)

1. You can write your application in the way that it does not accepts wrong data and behaves correctly on receipt of malformed packet.
2. You may use security.

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
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It was a note to check if something have been changed in configuration style, disregard it if everything works.

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:

You still may get it on coordinator though, since 'leave network' command may be sent to any device in network including coordinator. Furthermore coordinator is not required for network to function properly, it is only required for network establishment.

I don't have any other devices in the network, just the coordinator (and the end device until shutdown). I get this notification after 10 secs or something like that. I'm using BitCloud 1.7 .

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

If I have 1 end device and a coordinator, is it possible to get a notification on the end device, that it has lost the coordinator?
If yes, how do I set time limits for this notification?

thx.
sandmann

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

sandmann wrote:
If I have 1 end device and a coordinator, is it possible to get a notification on the end device, that it has lost the coordinator? If yes, how do I set time limits for this notification?

You'll get NETWORK_LOST_STATUS, which means that there have been problems with parent link and stack will try to find new parent. And then NETWORK_LEFT_STATUS, which means that stack gave up to find new parent. You can't set timeouts for this though.

As for your previous question: I don't understand what happens and I am too busy right now to check, but I'll check later.

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

If I use HAL_AppTimer_t, how to determine how much ms remains before it will fire and activated it or not.

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

code-by wrote:
If I use HAL_AppTimer_t, how to determine how much ms remains before it will fire and activated it or not.

You can't do this. Probably will be good to have such API, but not yet.

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

If I want to make a simple Home Automation application using BitCloud, what should I start with?

I am reading the specification right now, but I don't think it is too practical. Is BitCloud capable for that? Has anyone here succeeded in constructing something that can cooperate with other products?

thx.
sandmann

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

sandmann wrote:
I am reading the specification right now, but I don't think it is too practical. Is BitCloud capable for that?

Reading specification is impractical? HA is based on ZigBee and BitCloud is a ZigBee stack, so yes, it is capable for that.

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 mean, ok, I find the ID-s and settings that I need for the application, but I still don't know, how to begin.

For example is it enough if I buy an on/off actuator and make an on/off switch for it, or do I need to buy a Home Controller (or something like that) to make it work?

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

sandmann wrote:
For example is it enough if I buy an on/off actuator and make an on/off switch for it, or do I need to buy a Home Controller (or something like that) to make it work?

I am not so familiar with HA spec, so can't help you 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

What is the best way to continuously every 0.5 sec read two ADC channels with BC:

1. Init timer for 0.5 sec, one shot mode, start timer
2. When timer fired call HAL_ReadAdc(1);
3. Read 1st ADC channel value
4. Call HAL_ReadAdc(2);
5. Read 2nd ADC channel value
6. Start timer again in one shot mode.

Or there can be better way?

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

code-by wrote:
Or there can be better way?

That is how I would do 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

It's possible to protect Zigbit chip like other AVR chips?

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

ZigBit contains ATmega1281, you can do with it whatever you want within specification.

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:
ZigBit contains ATmega1281, you can do with it whatever you want within specification.

but not all mega1281 ports (GPIO) are used in zigbit chip... so may be in future we need to use second AVR (ex. tiny/mega8) for more GPIOs and connect zigbit with tiny/mega via UART/i2c

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

Hi!

In WSNDemo project, is it possible to put an ED to sleep even if it is out of network?
I‘ve tried to, but the ED re-scans for network, until it finds one.

Even if I successfully block the re-scan by modifying ZDO_StartNetworkConf() or ZDO_MgmtNwkUpdateNotf(), I get a ZDO_BUSY_STATUS inside ZDO_SleepConf() over and over again and thus the device stays awake.

Finally I tried to use ZDO_ResetNetworkReq() when network is lost and then go to sleep, but ZDO_ResetNetworkConf() is not executed.

How can this be solved?
Thanks!

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

alexis4 wrote:
How can this be solved!

You have to wait for ZDO_NETWORK_LEFT (but not NETWORK_LOST) status. After this status is raised you must be able to put device to sleep.

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

How can I use floating point variables?
I tried simple declaration like

static float f;

but this does not seem to work.

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

kaiwi666 wrote:
How can I use floating point variables?

Honestly, I have no idea. Never tried to use floats on 8 bit MCU.

Anyway it has nothing to do with BitCloud and 'this does not seem to work' is not really descriptive enough to make advices.

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

float should be standard data type in C so I did not assume it would not work.
It is a 4 byte data type and when it should show something like 0.something it rounds down to 0. So it looks as if it acted like int.

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

kaiwi666 wrote:
float should be standard data type in C so I did not assume it would not work.

Nobody arguing with that. But how is this related to BitCloud, which happens to be the topic of this thread?

kaiwi666 wrote:
It is a 4 byte data type and when it should show something like 0.something it rounds down to 0. So it looks as if it acted like int.

Show where?

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:
Nobody arguing with that. But how is this related to BitCloud, which happens to be the topic of this thread?

I am facing this issue in AVRStudio where I am building a project using BitCloud. :-)

alexru wrote:
Show where?

I do not have the code with me now, left the office already. But basically I am computing a ratio of two unsigned short variables. I have debugged the piece and searched the part of SRAM where the variable is stored. All 4 bytes show 0.

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

Hi again Alex,

After a pause, back with Bitcloud questions :)

Is it mandatory to call PDS_ReadUserData and PDS_WriteUserData from APL_TaskHandler ? Why is that, and is there a way to pass this ? I would need to do it also in some other places in the code... If I check and see the EEPROM is not busy, would that do it ?

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

lucicop wrote:
Is it mandatory to call PDS_ReadUserData and PDS_WriteUserData from APL_TaskHandler ?

As far as I know it is not. Where did you get it from?

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 written in the user guide from BitCloud :)

LE: Sorry, in the Stack documentation .chm file

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

lucicop wrote:
This is written in the user guide from BitCloud :)

Well, those functions are quite unusual, so some cautions should be taken, but I don't think that it is that mandatory.

I would not call them from HAL callbacks (timers, ADC etc) though.

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 got it, thanks !

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

Hi, I have a question about synchronization. Is there a support for synchronizing the nodes in BitCloud? I know I can get the system time of a single node, but I need to pair the measurements of the same event in multiple nodes.

thx.
sandmann

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

sandmann wrote:
Hi, I have a question about synchronization. Is there a support for synchronizing the nodes in BitCloud?

No, not in BitCloud itself. And depending on what kind of accuracy do you need this may be a tricky question.

What is your task?

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

My task is for now, to find out how I could synchronize the nodes. I do not think I would need precise times, it would be something like connecting temperature and humidity measurements with events like opening the door or something like that.

Then I have to take care of synchronisation myself. It is not as simple as broadcasting the coordinator time periodically, because if the end devices are in sleep mode, they won't get the message. Do I have to build an own protocoll in the application layer?

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

sandmann wrote:
Do I have to build an own protocoll in the application layer?

I believe so, there are things to think on but it looks possible for such kind of task.

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 an issue with I2C in BitCloud. I have an LCD connected to my
board that should communicate using I2C. I cannot get it working. There
are 2 issues I have noticed so far besides the fact that I cannot get
the LCD on. 1. All the functions return 0 which should mean that the
functions executed properly even when I disconnect the display from the
board. I assume in such case the function should return error value. 2.
The registered callback function never gets fired. I have attached the
code. The callback function has just some variable setting so that I can
see if it fired. I have also attached 2 PDF files describing the LCD.
One is a datasheet of the complete LCD which is mostly a derivative of
the other PDF which describes in detail the LCD driver used in the LED.
One more question. In all my experience I was using watchdog in case the
processor gets stuck in an endless loop. Here I guess I cannot use since
there is no piece of code to which I would return periodically. Is
watchdog implemented in lower layers of the stack so that the MCU gets
reset in case of a stuck in an endless loop?

Attachment(s): 

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

kaiwi666 wrote:
1. All the functions return 0 which should mean that the
functions executed properly even when I disconnect the display from the
board. I assume in such case the function should return error value.

0 return value just means that all specified parameters are correct and i2c module was in correct state when you called these functions. i2c have no means to determine whether device is connected or not before actual transmission.

kaiwi666 wrote:
2. The registered callback function never gets fired.

This is a real problem. Try making LCD to work without BitCloud by plain writing to registers. I am sure that there must be working sources for virtually every display ever made.

kaiwi666 wrote:
I have attached the code.

I have no time right now to look though your code, anyway I don't have much experience with i2c in BitCloud. May be it
is time to contact avr@atmel.com.

kaiwi666 wrote:
Here I guess I cannot use since there is no piece of code to which I would return periodically.

Application timer callback is such piece of code. If all system will stuck then application timers will stop also.

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 will try to get it communicate using the functions from i2c.h library. I guess there is no issue using this library instead of i2cpacket.h. However I have a question. There is always a set delay between commands that user must observe to get the LCD communicate properly. It is in microseconds so I cannot use timer as it must be set to a minimum of 10ms. I want to do this delay by simple for loop. However I am not sure whether the optimisation algorithms do not oomit the part of the code as it does not contain anything inside.

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

kaiwi666 wrote:
I want to do this delay by simple for loop. However I am not sure whether the optimisation algorithms do not oomit the part of the code as it does not contain anything inside.

Use library function _delay_ms(), it won't be optimized.

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:
Use library function _delay_ms(), it won't be optimized.

What is the minimal value for this function? I need delays around 20us so even 1ms is quite long. I do not know how the LCD behaves if the delay is substantially longer. Is there a _delay_us() function as well?

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

kaiwi666 wrote:
Is there a _delay_us() function as well?

Yes, there is, why not google yourself? :)

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

Finally I managed to get the LCD working. I want to point out one thing. I2C.H functions do not work for me. I had to write my own library to implement I2C and now LCD works fine. If I perform the very same sequence of operations only using I2C.H that comes with BitCloud LCD does not work.

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

kaiwi666 wrote:
I want to point out one thing. I2C.H functions do not work for me.

I don't know much about them, may be something wrong with them, may be not :) If it bothers you write to tech support. I am both hands for removing them from SDK (or at least moving to some other library) since they ceased to make any sense after SDK stopped being ZigBit-only, but I 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

I have a question regarding network formation. Are there functions that when given a specific channel number return its availability (i.e. whether there is traffic from another network on the channel) and signal quality? The second question may be stupid. As I see it if coordinator forms network all unused channels should be equal as to usefulness but one never knows. May be there are cases when different channels act differently in the given environment.
Is there a way of finding out that a certain router or coordinator has fallen out of network?

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

kaiwi666 wrote:
Are there functions that when given a specific channel number return its availability (i.e. whether there is traffic from another network on the channel) and signal quality?

There is function NWK_NetworkDiscovery() which returns descriptors of all ZigBee networks available on all channels from CS_CHANNEL_MASK up to the limit of specified networks amount (and memory provided).
There is MAC_ScanReq() which returns levels of signal energy on requested channels.

These functions are not really documented so you'll have to figure out how they work from functions prototypes and structures definitions which you may find in .h files in SDK.

kaiwi666 wrote:
As I see it if coordinator forms network all unused channels should be equal as to usefulness but one never knows.

What do you mean by this? What the 'usefulness' of channel is? :)

kaiwi666 wrote:
May be there are cases when different channels act differently in the given environment.

Some channels are better because they are placed between WiFi channels. Other than this they all are pretty much the same.

kaiwi666 wrote:
Is there a way of finding out that a certain router or coordinator has fallen out of network?

There is no strict definition of "fallen out of network" for the router. So you define one and answer will be obvious.

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 guess information about devices present in the network is kept in coordinator. Where is this information stored (meaning data structure)? I want to implement the following. I need to find out whether a device with given MAC address is present in the network. The device that needs to find this out can be a router or the coordinator in my application.
My second question is a bit more complex. I guess network topology is mesh, i.e. devices far from coordinator (both end devices and routers) are present in the network through intermediate routers. Can I still use in such case ZDO_GetLqiRssi_t lqiRssi function when I need to find out signal strength for router? What will be defined as parent node for a router in case it is not connected to a coordinator but to an intermediate router? Will the ZDO_GetLqiRssi_t lqiRssi function return relevant answer in such case?
If more than 1 channel are defined for the network are the devices changing the communication channel automatically according to channel signal strength and availability?

Thanks in advance for reply and sorry for bothering so often. But I need to understand the stack really thoroughly to implement my application properly.

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

kaiwi666 wrote:
I guess information about devices present in the network is kept in coordinator.
This is wrong, there is no such place. Even the term "present in the network" is not defined strictly.
kaiwi666 wrote:
I want to implement the following. I need to find out whether a device with given MAC address is present in the network.
You may send GetNwkAddress ZDP request and if device is in the network it will reply.
kaiwi666 wrote:
Can I still use in such case ZDO_GetLqiRssi_t lqiRssi function when I need to find out signal strength for router?
No, you can't. This function can return RSSI only for nodes that this node is able to communicate with, otherwise RSSI has no meaning.

kaiwi666 wrote:
What will be defined as parent node for a router in case it is not connected to a coordinator but to an intermediate router?

Routers have no parent in any case. They may have record marked as 'parent' for the first 15 seconds (link status sending period) but after this they forget who their parent was.

kaiwi666 wrote:
If more than 1 channel are defined for the network are the devices changing the communication channel automatically according to channel signal strength and availability?

Only if "Frequency Agility" feature is enabled, it is disabled in BitCloud releases so they won't change channel automatically (at least on currently released versions).

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

Pages