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

Go To Last Post
986 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi! I have meshnetics MeshBean ZigBit dev.kit with samples on CD. This samples compiling fine (use new version of AVR studio & WinAVR). I download latest Atmel BitCloud SDK (Atmel buy meshnetics some time ago), but this new samples don't compile (its identical to those of meshnetics, but with some modifications of source code, makefiles and configuration files). I have problem when try to build new samples. What coud be wrong? Thank you for help!

Log of the error:

Build started 15.5.2009 at 12:36:41
make all -C
make: option requires an argument -- C
Usage: make [options] [target] ...
...
This program built for i386-pc-mingw32
Report bugs to
make: *** [cs] Error 2
Build failed with 1 errors and 0 warnings...

Last Edited: Fri. Oct 16, 2015 - 01:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Seems like SDK path contains spaces. Try installing it into different location without spaces in path.

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

Spasibo, alexru. Tolyko pochemu primery meshnetics compilirovalisy normalyno dazhe s probelami v puti :j

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

Yeshcho po angliskii pozhalsta!
Hotyel bi znaty esli problyema rezolyuzhonirovanna.

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

Did it worked with short paths?

There were some changes to build procedure.

PS: may be we will use english? :)

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

ok.
1. some one have correspondence between Atmega 1281 and meshbean ZDM-A1281 pinout?
2. I look for sources to program ZDM-A1281 without using ZigBee Net stack.
3. also I need source for ZigBeeNet for read ADC channels.
Thank a lot :)

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

code-by wrote:
ok.
1. some one have correspondence between Atmega 1281 and meshbean ZDM-A1281 pinout?

You may ask tech support. But since HAL is open source now You can just look for it by yourself.

code-by wrote:

2. I look for sources to program ZDM-A1281 without using ZigBee Net stack.

Start with "main" function :) It is just regular micro + rf.

code-by wrote:

3. also I need source for ZigBeeNet for read ADC channels.
Thank a lot :)

ZigBeeNet is not supported anymore. Currently supported stack called BitCloud.

There should be example for this.

BSP\MESHBEAN\src\battery.c from SDK is a good example of using ADC.

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 need to develop ZigBee network with one Coordinator and 20 End-devices without routers.

So if I will don't use BitCloud stack, I need to programin myself link with RF using SPI, organize network between nodes, (remember their addresses, ...), ..., something else?

Maybe some one have regular C-program for using ZigBee with mega 1281?

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

You should look at the Lowpower sample code. Its set up to use Coordinator and multiple end devices. You just need to make a few adjustments to get it to 20 end devices. If you want to use the bitcloud stack. Or you can use Star_Nobeacon example in the MAC code atmel also provides.

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

I try to add ADC from "battery.c" to "lowpower" sample, but compiler show error "D:\ZigBit\Sample Applications 2\Lowpower/src/coordinator.c:286: undefined reference to `bspPostTask0'".
I can post here source code if needed :)

I don't realy understand how this BitCloud stack works with these postTask functions... :(

How much maximum end-devices could host one coordinator?

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

code-by wrote:
I try to add ADC from "battery.c" to "lowpower" sample, but compiler show error "D:\ZigBit\Sample Applications 2\Lowpower/src/coordinator.c:286: undefined reference to `bspPostTask0'".
I can post here source code if needed :)

Just copy-pasting will not work.

This code might help. I did not tried it actually, but it should work.

  adcParam.bufferPointer = &bufferForData;
    adcParam.callback = batteryCalback;
    adcParam.resolution = RESOLUTION_8_BIT;
    adcParam.sampleRate = ADC_4800SPS;
    adcParam.selectionsAmount = 1;
    adcParam.voltageReference = AREF;
    batteryState = BUSY;
    HAL_OpenAdc(&adcParam);

    // This function will start conversion and exit. After conversion completed adcParam.callback will be called.
    HAL_ReadAdc(HAL_ADC_CHANNEL0);

So you haver to wait for callback. After it is called data is available at bufferForData.

code-by wrote:

I don't realy understand how this BitCloud stack works with these postTask functions... :(

Just another one (and not so bad) multitasking approach.

code-by wrote:

How much maximum end-devices could host one coordinator?

It depends on other stack parameters (buffer sizes) and limited by memory available. See documentation on atmel's site for actual numbers.

20 EDs should be easy.

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

PS: Low power reads temperature by default. WsnDemo reads light, temperature and battery. Combine them :)

Or you can start with WsnDemo. Just remove reading of anything except battery.

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

code-by wrote:

Maybe some one have regular C-program for using ZigBee with mega 1281?

BitCloud is a regular C-program. ZigBee Pro standard is 600+ pages document. So it is not that easy to implement.

But if you do not need mesh networking, routing, network management and some other feautures, you can just use 802.15.4 frames. But it is not that easy anyway (BitCloud is much easier).

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 think I need call readBatteryData to read data from ADC.
Please help what parameter I should use to call function:

readBatteryData(void (*callback)(uint8_t data))

----

I call readBatteryData from this:

if (openBattery() == SUCCESS)
{
 length = sprintf((char *) str, "ADC init ok\n\r");
 sendDataToUsart(str, length);

 if (readBatteryData( ??? ) == SUCCESS)
  length = sprintf((char *) str, "ADC read ok\n\r");
 else
  length = sprintf((char *) str, "ADC read err\n\r");

 sendDataToUsart(str, length);
}
Last Edited: Wed. May 20, 2009 - 02:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try something like this (this code reads ADC dedicated to battery only)

In APL_TaskHandler():

BSP_OpenBatterySensor();
BSP_ReadBatteryData(batteryDataReady);

And batteryDataReady() should be defined like this:

static void batteryDataReady(uint8_t battery)
{
  // battery contains battery voltage
}

The point is that function not just reads value and returns it, but it returns right away and calls callback function as data is ready.

The reason for this is that HAL ADC functions can read a set of values. This can take awhile and waiting will be just wasting of CPU 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

If I compile usual program for standalone mega1281 with main() function w/o initializing ports, usart, timers, etc., could it damage meshbean board? Coud it be damaged if I initialize ports,...,etc. erroneously?

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

I hardly doubt you can damage anything. Just remember common AVR advices. Like do not disable JTAG in fuses, etc.

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 try to create program and burn it ZigBit module like making program for standalone Mega1281. I have hex file and don't understand how create SREC file.

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

What USART (0 or 1) I need to use in ZigBit board to send data to PC for dislay in HyperTerminal?
thank

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

On MeshBean boards USART_CHANNEL_1 is connected to UART-to-USB converter and USART_CHANNEL_0 is on the P2 connector. Use any you like.

PS: srec from hex can be obtained by avr-objcopy programm.

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. I make SREC from HEX using avr-objcopy, it work fine, but SREC from compiling in AVRStudio is large, that created by avr-objcopy :)

It is possible to find some examples for ZigBit to create simple data transmission without using ZigBit/BitCloud stack?

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

Quote:

Thank. I make SREC from HEX using avr-objcopy, it work fine, but SREC from compiling in AVRStudio is large, that created by avr-objcopy

You probably didn't -R the sections that need to be discarded (.fuse, .eeprom etc)

(why do you need Srec anyway? Don't all AVR tools use Intel Hex ?)

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

I need SREC because I program my board via USB, I haven't JTAG :)

When I use WSN Monitor, boards powered by battery shows values about 200 units, but when I insert battery function into lowpower sample, it shows -45, -50, -55, -60? It's right?

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

So what is the USB software you use that prefers SRec in favour of Intel Hex when programming AVR? It just seems an odd choice when everything else associated with AVR works using Intel

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

I use SiliconLabs USB-COM driver and Atmel (ex. meshnetics) bootloader that works only with SREC-files :)

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

Ah there's nothing like consistency! So even though everything else Atmel is Intel Hex they issue a bootloader (even if it originally came from somewhere else) that uses a "non (their) standard" file format.

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

Quote:
It is possible to find some examples for ZigBit to create simple data transmission without using ZigBit/BitCloud stack?

I do not think so. This way of using it is not officially supported.

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

clawson wrote:
Ah there's nothing like consistency! So even though everything else Atmel is Intel Hex they issue a bootloader (even if it originally came from somewhere else) that uses a "non (their) standard" file format.

SAM-BA for example uses .bin files.

Changing bootloader is not that easy since there are a lot of units already deployed.

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

code-by wrote:

When I use WSN Monitor, boards powered by battery shows values about 200 units, but when I insert battery function into lowpower sample, it shows -45, -50, -55, -60? It's right?

Treat this numbers as unsigned values. So they will be about 200.

PS: Good progress :)

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, with uint allright :)

Now I search examples for zigbit to work w/o zigbit/bitcloud stack, because it consume much memory and it's difficult to make more flexible programs :)

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

code-by wrote:

Now I search examples for zigbit to work w/o zigbit/bitcloud stack, because it consume much memory and it's difficult to make more flexible programs :)

Have a look at Contiki. I have not seen by myself, but i heard that they ported their stack to MeshBean board.

Working with radio directly is relatively easy. But even implementing MAC layer is not that simple at all. BitCloud consumes all this memory for a reason. We doing our best to lower memory consuption 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

Coud somebody explain why coordinator immediately found network after pressing SW1 button in Lowpower sample of Bitcloud SDK 1.5 even there no any powered meshbean boards?

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

code-by wrote:
Coud somebody explain why coordinator immediately found network after pressing SW1 button in Lowpower sample of Bitcloud SDK 1.5 even there no any powered meshbean boards?

I don't quite understand what do mean. Blinking led in all applications means that device is searching for the network to join. Coordinator is not joining to any existing network, it setts up its own one. So coordinator will start network any way (assuming channel is clear enough).

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:
coordinator will start network any way (assuming channel is clear enough).

I didn't know that :) Now I understand

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

Hi!

I need to add processing of two ADC channel with my algorithm of acquisition data (how much samples, etc) to my program based on Bitcloud stack.

How much samples doing Bitcloud stack when reading battery level?

Coud somebody help?

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

BitCloud by itself does nothing with ADC. Battery level is read by BSP. Only one sample is used to read battery level. But ADC API is very reach. Just read 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

I'm found project for mega644 and at86rf230 containing following:

//SPI data direction register (DDR)
#define DDR_SS   DDRB.4  //Slave Select
#define DDR_MOSI DDRB.5  //Master Out - Slave In
#define DDR_MISO DDRB.6  //Master In - Slave Out
#define DDR_SCLK DDRB.7  //SPI Clock
//SPI chip select (CS)
#define RF230_SEL        PORTC.3
#define DDR_RF230_SEL    DDRC.3
//GPIO (General purpose input output) interface
#define RF230_IRQ        PINC.0
#define DDR_RF230_IRQ    DDRC.0
#define RF230_SLP_TR     PORTC.1
#define DDR_RF230_SLP_TR DDRC.1
#define RF230_RESET      PORTC.2
#define DDR_RF230_RESET  DDRC.2

How to change ports defenitions for use with ZigBit modules?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
//SPI data direction register (DDR)
#define DDR_SS   DDRB.0  //Slave Select
#define DDR_MOSI DDRB.2  //Master Out - Slave In
#define DDR_MISO DDRB.3  //Master In - Slave Out
#define DDR_SCLK DDRB.1  //SPI Clock

//SPI chip select (CS)
#define RF230_SEL        ???
#define DDR_RF230_SEL    ???

//GPIO (General purpose input output) interface
#define RF230_IRQ        PINE.5
#define DDR_RF230_IRQ    DDRE.5

#define RF230_SLP_TR     PORTB.4
#define DDR_RF230_SLP_TR DDRB.4

#define RF230_RESET      PORTA.7
#define DDR_RF230_RESET  DDRA.7

Something like this. Not sure about SPI chip select.

BTW all this from file HAL\avr\atmega1281\zigBit\include\halRfPio.h.

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

The full code of founded project is following:

/****************************************************************************/
//List of Transceiver Registers
#define TRX_STATUS       0x01
#define TRX_STATE        0x02
#define TRX_CTRL_0       0x03
#define PHY_TX_PWR       0x05
#define PHY_RSSI         0x06
#define PHY_ED_LEVEL     0x07
#define PHY_CC_CCA       0x08
#define CCA_THRES        0x09
#define IRQ_MASK         0x0E
#define IRQ_STATUS       0x0F
#define VREG_CTRL        0x10
#define BATMON           0x11
#define XOSC_CTRL        0x12
#define FTN_CTRL         0x18
#define PLL_CF           0x1A
#define PLL_DCU          0x1B
#define PART_NUM         0x1C
#define VERSION_NUM      0x1D
#define MAN_ID_0         0x1E
#define MAN_ID_1         0x1F
#define SHORT_ADDR_0     0x20
#define SHORT_ADDR_1     0x21
#define PAN_ID_0         0x22
#define PAN_ID_1         0x23
#define IEEE_ADDR_0      0x24
#define IEEE_ADDR_1      0x25
#define IEEE_ADDR_2      0x26
#define IEEE_ADDR_3      0x27
#define IEEE_ADDR_4      0x28
#define IEEE_ADDR_5      0x29
#define IEEE_ADDR_6      0x2A
#define IEEE_ADDR_7      0x2B
#define XAH_CTRL         0x2C
#define CSMA_SEED_0      0x2D
#define CSMA_SEED_1      0x2E

//List of Transceiver States
#define NOP              0x00
#define TX_START         0x02
#define FORCE_TRX_OFF    0x03
#define RX_ON            0x06
#define TRX_OFF          0x08
#define PLL_ON           0x09
#define RX_AACK_ON       0x22
#define TX_ARET_ON       0x25

//SPI data direction register (DDR)
#define DDR_SS   DDRB.4  //Slave Select
#define DDR_MOSI DDRB.5  //Master Out - Slave In
#define DDR_MISO DDRB.6  //Master In - Slave Out
#define DDR_SCLK DDRB.7  //SPI Clock
//SPI chip select (CS)
#define RF230_SEL        PORTC.3
#define DDR_RF230_SEL    DDRC.3
//GPIO (General purpose input output) interface
#define RF230_IRQ        PINC.0
#define DDR_RF230_IRQ    DDRC.0
#define RF230_SLP_TR     PORTC.1
#define DDR_RF230_SLP_TR DDRC.1
#define RF230_RESET      PORTC.2
#define DDR_RF230_RESET  DDRC.2

//IRQ status masks
#define IRQ_BAT_LOW      0x80  //Battery low signal
#define IRQ_TRX_UR       0x40  //FIFO underrun signal
#define IRQ_TRX_END      0x08  //End of frame (transmit and receive)
#define IRQ_RX_START     0x04  //Beginning of receive frame
#define IRQ_PLL_UNLOCK   0x02  //PLL goes from lock to unlock state
#define IRQ_PLL_LOCK     0x01  //PLL goes from unlock to lock state

//Protocol Commands
#define PING             0xA1  //See if there is a transmitter in range
#define DATA_REQ         0xA5  //Request data from transmitter

//energy detection threshold
#define ED_THRESH        0x10

/****************************************************************************/
//Function Prototypes
unsigned char RF_RX_channel_scan(void);
unsigned char RF_TX_channel_scan(void);
void init_spi(void);
void set_transceiver_clock(void);
void RF_init_spi(void);
unsigned char RF_read_register(unsigned char address);
void RF_write_register(unsigned char address, unsigned char data);
void RF_init_transmitter(void);
void RF_transmit_test(void);
void RF_init_receiver(void);
void RF_receive_test(void);
void RF_download_frame(void);
void RF_transmit_frame(void);
void RF_receiver_listen(void);
void RF_upload_frame(void);
unsigned char RF_update_IRQ_status(void);
unsigned char RF_transmit_done(void);
unsigned char RF_receiver_listen_timeout(unsigned char loop_count);
unsigned char RF_TX_channel_scan(void);
void RF_TX_sync(void);
void RF_tx_to_rx(void);
void RF_rx_to_tx(void);
void RF_RX_sync(void);

/****************************************************************************/
//Global Variables to use for interfacing
unsigned char transmit_frame[20];  //User code fills transmit_frame
unsigned char receive_frame[20];   //User code reads receive_frame
unsigned char LQI;                 //User may use LQI after receiving frame
unsigned char tx_frame_length;     //User can set frame length before transmit
unsigned char rx_frame_length;     //Read frame length while receiving
unsigned char curr_IRQ_status;

/****************************************************************************/
void RF_clear_IRQ(void)  {
  curr_IRQ_status = RF_read_register(IRQ_STATUS);
  curr_IRQ_status = 0;
}

/****************************************************************************/
//Function determines if channel is clear or not using CCA
//CCA = clear channel assessment
//channel parameter must be between 11 and 26
//Returns 0 if channel is busy and 1 if channel is clear
unsigned char RF_CCA(unsigned char channel)  {
  unsigned char status = 0;
  if ((channel < 11) || (channel > 26)) return 0;  //invalid input
  channel = (channel | 0b10000000); //Set bit 7 to 1 to start CCA check
  RF_write_register(PHY_CC_CCA,channel);
  delay_us(140);
  status = RF_read_register(TRX_STATUS);
  if ((status&0b01000000) != 0) return 1;  //channel is available
  else return 0;
}

/****************************************************************************/
//Function scans for clear channel using CCA. Sets channel to best option
//for reception. Need another function to transmit beacon frame over that 
//channel, listen for a response. This function returns 0 if there is no good 
//channel, or it returns the value of the channel with the strongest signal.
unsigned char RF_RX_channel_scan(void)  {
  unsigned char i = 0;
  unsigned char status;
  for (i=16;i<=26;i++)  {
    RF_write_register(PHY_CC_CCA,(0b10000000 | i));  
    //see if channel i is available
    do {
      status = RF_read_register(TRX_STATUS);
    } while((status&0b10000000) == 0);
    if ((status&0b01000000) == 0)  return i;  //return clear channel
  }
  for (i = 11; i<16; i++)  {
    RF_write_register(PHY_CC_CCA,(0b10000000 | i));  
    //see if channel i is available
    do {
      status = RF_read_register(TRX_STATUS);
    } while((status&0b10000000) == 0);
    if ((status&0b01000000) != 0)  return i;  //return clear channel
  }
  return 0;
}

/****************************************************************************/
//Function scans for channel with highest signal quality above a certain
//threshold, returns best channel. Need another function to listen for beacon 
//frame, respond with acknowledgement frame.
unsigned char RF_TX_channel_scan(void)  {
  unsigned char max_channel_strength = 0;
  unsigned char max_channel = 0;
  unsigned char curr_channel_strength;
  unsigned char i;

  for (i=11;i<=26;i++)  {
    RF_write_register(PHY_CC_CCA,i);  //change to specific channel
    delay_us(400);  //wait for channel change to complete
    RF_write_register(PHY_ED_LEVEL,0x00);  //start ED calculation
    delay_us(130);  //wait for conversion to complete
    curr_channel_strength = RF_read_register(PHY_ED_LEVEL);
    if ((curr_channel_strength > ED_THRESH) && 
        (curr_channel_strength > max_channel_strength))  {
      max_channel_strength = curr_channel_strength;
      max_channel = i;
    }
  }
  return max_channel;
}

/****************************************************************************/
void RF_TX_sync(void)  {
  unsigned char channel;
  while (1)  {   //keep searching until a receiver is found
    do  {
      //find best channel, if any available
      channel = RF_TX_channel_scan();
    } while(channel == 0);
    RF_write_register(PHY_CC_CCA,channel);  //switch to channel
    delay_us(200);
    RF_tx_to_rx();  //switch to reception mode
    delay_us(200);
    if (RF_receiver_listen_timeout(50) == 1)  break;  
    //wait for a short time for a frame to be received
  }
  RF_rx_to_tx();
  delay_us(200);
  tx_frame_length = 1;
  transmit_frame[0] = 0xAA;
  RF_download_frame();
  RF_transmit_frame();
}

/****************************************************************************/
void RF_RX_sync(void)  {
  unsigned char channel,i;
  do  {
    channel = RF_RX_channel_scan();
  } while(channel==0);
  RF_write_register(PHY_CC_CCA,channel);  //switch to channel
  delay_us(200);
  while (1)  {
    RF_rx_to_tx();  //switch to transmission mode
    delay_us(200);
    tx_frame_length = 10;
    for (i=0;i<10;i++)  {
      transmit_frame[i] = 0xAA;
    }
    RF_download_frame();
    RF_transmit_frame();
    RF_tx_to_rx();  //switch to reception mode
    delay_us(200);
    if (RF_receiver_listen_timeout(50) == 1) break;
  }
}

/****************************************************************************/
unsigned char RF_receiver_listen_timeout(unsigned char loop_count)  {
  do {
    if (RF230_IRQ != 0)  {
      curr_IRQ_status = RF_read_register(IRQ_STATUS);
    }
    delay_us(250);
    loop_count--;
  } while (((curr_IRQ_status & IRQ_TRX_END) == 0 )&&((loop_count) > 0));
  if ((curr_IRQ_status&IRQ_TRX_END) != 0) {
    curr_IRQ_status = 0;
    return (loop_count+1);
  }
  curr_IRQ_status = 0;
  return loop_count;
}

/****************************************************************************/
void init_spi(void) {
  //Set up SPI I/O data direction
  DDR_MOSI = 1;
  DDR_MISO = 0;
  DDR_SCLK = 1;
  DDR_SS = 1;  //SS must be configured as output to set MCU as SPI master
  PORTB.4 = 0;

  //Set up SPI Control Registers
  //Bit 7 - Interrupt Enable SPIE=0 -> no ISR
  //Bit 6 - SPI Enable SPE=1 -> enable spi
  //Bit 5 - Data Order DORD=0 -> msb first
  //Bit 4 - Master/Slave Select MSTR=1 ->MCU is SPI master
  //Bit 3 - Clock Polarity CPLO=0 (for the transceiver initially)
  //Bit 2 - Clock Phase CPHA=0 (for the transceiver initially)
  //Bits 1:0 - SPR1, SPR0: SPI Clock Rate Select 1 and 0
  //SPR1:SPR0=00 along with SPI2X=1 sets SCK to f_osc/2 = 8MHz/2 = 4MHz
  SPCR0 = 0b01010000;  //SPI Control Register
  SPSR0 = 1;           //SPI Status Register (SPI2X)

}

/****************************************************************************/
void set_transceiver_clock(void) {
  //Set the clock polarity and phase for the transceiver if other slaves
  //(with different clock settings) are also being used by the MCU
  SPCR0 = 0b01010000;
  SPSR0 = 1;
  //SPCR0 &= 0b11110111;  //Bit 3 – Clock Polarity CPLO=0
  //SPCR0 &= 0b11111011;  //Bit 2 – Clock Phase CPHA=0
}

/****************************************************************************/
void RF_init_spi(void) {
  //Set up GPIO data directions
  DDR_RF230_IRQ = 0;
  DDR_RF230_SLP_TR = 1;
  DDR_RF230_RESET = 1;
  DDR_RF230_SEL = 1;

  RF230_SEL = 1;  //Initialize chip select signal high
  RF230_RESET = 1;
  RF230_SLP_TR = 0;

}

/****************************************************************************/
//2 byte SPI transmit. Information in second byte is thrown away, just
//transmit junk data to receive byte.
unsigned char RF_read_register(unsigned char address) {
  unsigned char junk;
  RF230_SEL = 0;
  //Address should only be 6 bits. MSB should be 1, bit 6 should be 0.
  //Writing to SPDR0 starts transmission
  SPDR0 = 128 + (address & 0b00111111);
  while((SPSR0&0x80) == 0); //Wait for transfer to complete
  junk = SPDR0;
  //Start next transmission, transmit junk, get back data from register
  SPDR0 = 0x00;
  while((SPSR0&0x80) == 0); //Wait for transfer to complete
  RF230_SEL = 1;
  return SPDR0; //Return contents of register in transceiver
}

/****************************************************************************/
//2 byte SPI transmit. Information in second byte is data to write to register
void RF_write_register(unsigned char address, unsigned char data) {
  unsigned char junk;
  RF230_SEL = 0;
  //First 2 bits are 11, rest is address. Start transmitting command
  SPDR0 = 192 + (address & 0b00111111);
  while((SPSR0&0x80) == 0);  //Wait for transfer to complete
  junk = SPDR0;
  SPDR0 = data;
  while ((SPSR0&0x80) == 0);  //Wait for transfer to complete
  RF230_SEL = 1;
}

/****************************************************************************/
//Initialize basic one-way transmitter
void RF_init_transmitter(void) {
  //RF_write_register(TRX_CTRL_0,
  //Should write to TRX_CTRL_0 register to set output current and
  //clockspeed settings.
  RF230_RESET = 0;
  #asm
    nop
    nop
    nop
    nop
    nop
  #endasm
  RF230_RESET = 1;
  RF_write_register(TRX_CTRL_0,0b01001000);
  delay_us(800);
  //enable ONLY the TRX_done interrupt
  RF_write_register(IRQ_MASK,0b00001000);
  delay_us(200);
  RF_write_register(PHY_TX_PWR,0);  //reduced power on transmit
  delay_us(200);
  RF_write_register(PHY_CC_CCA,11);  //channel 11
  delay_us(200);
  RF_write_register(TRX_STATE,FORCE_TRX_OFF);
  delay_us(1880);
  RF_write_register(TRX_STATE,PLL_ON);
  delay_us(200);
  RF_write_register(TRX_CTRL_0,0b01001000);
  delay_us(800);
  RF_write_register(TRX_STATE,FORCE_TRX_OFF);
  delay_us(1880);
  RF_write_register(TRX_STATE,PLL_ON);
  delay_us(200);
}

/****************************************************************************/
void RF_tx_to_rx(void)  {
  RF_write_register(TRX_STATE,FORCE_TRX_OFF);
  delay_us(1880);
  RF_write_register(TRX_STATE,RX_ON);
  delay_us(200);
}

/****************************************************************************/
void RF_rx_to_tx(void)  {
  RF_write_register(TRX_STATE,FORCE_TRX_OFF);
  delay_us(1880);
  RF_write_register(TRX_STATE,PLL_ON);
  delay_us(200);
}

/****************************************************************************/
//Transmit once per second... call this once every second
void RF_transmit_test(void) {
  unsigned char i;
  RF_write_register(TRX_STATE,PLL_ON);
  RF230_SEL = 0;
  SPDR0 = 0b01100000;  //Frame transmit mode
  while((SPSR0&0x80) == 0);  //Wait for transfer to complete
  SPDR0 = 100;  //Frame length
  while((SPSR0&0x80) == 0);  //Wait for transfer to complete
  for (i=0;i<100;i++) {
    SPDR0 = i;
    while((SPSR0&0x80) == 0);  //Wait for transfer to complete
  }
  RF230_SEL = 1;

  RF230_SLP_TR = 1;  //Signal to transmit frame
  #asm
    nop
    nop
    nop
    nop
    nop
  #endasm
  RF230_SLP_TR = 0;
  do {  //Loop until end of transmit frame, when we break out of loop
    if (RF230_IRQ != 0) {
      //Get the status of the IRQ
      curr_IRQ_status = RF_read_register(IRQ_STATUS);
      PORTA = curr_IRQ_status;
    }
    //Loop until done done transmitting frame
  } while ((curr_IRQ_status & IRQ_TRX_END) == 0);

}

/****************************************************************************/
void RF_init_receiver(void) {
  RF230_RESET = 0;
  #asm
    nop
    nop
    nop
    nop
    nop
  #endasm
  RF230_RESET = 1;
  RF_write_register(TRX_CTRL_0,0b01001000);
  delay_us(800);
  //enable ONLY the TRX_done interrupt
  RF_write_register(IRQ_MASK,0b00001000);
  delay_us(200);
  RF_write_register(TRX_STATE,FORCE_TRX_OFF);
  delay_us(1880);
  RF_write_register(TRX_STATE,RX_ON);
  delay_us(200);
}

/****************************************************************************/
void RF_receive_test(void) {
  //Put transceiver in listen mode
  //Wait for IRQ indicating end of frame
  //Upload frame, digest
  //Done, start again immediately
  unsigned char length,LQI;
  unsigned char junk = 0;
  unsigned char frame[128];
  unsigned char index = 0;

  do {
    if (RF230_IRQ != 0)  {
      curr_IRQ_status = RF_read_register(IRQ_STATUS);
    }
    //Loop until done receiving frame, then we can start uploading
  } while ((curr_IRQ_status & IRQ_TRX_END) == 0);

  RF230_SEL = 0;
  SPDR0 = 0b00100000;  //Frame receive mode
  while((SPSR0&0x80)==0);  //Wait for frame transfer to complete
  SPDR0 = junk;  //Transmit a junk byte to receive a byte of frame
  while((SPSR0&0x80) == 0);  //Wait for transfer to complete
  length = SPDR0;
  while (length>0)  {
    SPDR0 = junk;
    while((SPSR0&0x80) == 0);  //Wait for transfer to complete
    frame[index++]=SPDR0;  //Get byte of frame
    length--;
  }
  SPDR0 = junk;
  while((SPSR0&0x80) == 0);
  LQI = SPDR0;  //LQI is a byte between 0 (bad) and 255(excellent)
  PORTA = LQI;
  RF230_SEL = 1;
}

/****************************************************************************/
//Transceiver must be in appropriate state before calling this
void RF_download_frame(void) {
  unsigned char i;
  RF_write_register(TRX_STATE,PLL_ON);
  RF230_SEL = 0;
  SPDR0 = 0b01100000;  //Frame transmit mode
  while((SPSR0&0x80) == 0);  //Wait for transfer to complete
  SPDR0 = tx_frame_length;  //Frame length
  while((SPSR0&0x80) == 0);  //Wait for transfer to complete
  for (i=0;i
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I definitely won't read 20k of code :)

What do You want from it? Making it working on ZigBit can be tricky. If you still want to do it yourself I'd recommend you read rf230 datasheet.

I'll be glad to answer any particular questions but I won't do yours work for you.

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

no at all, I don't like when somebody doing work for me, I only want to show full header file and to understand how to make my project w/o bitcloud.

Does I need to setup IEEE_ADDR for transmission? If for example I need to make 2 different networks with 10 devices in each, all devices in radius 20-30 meters, and I need devices from first one don't able communicate from second one, it's enought to set only PAN_ID and/or SHORT_ADDR if IEEE_ADDR isn't required?

Thank you!

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

Ok. Let's do it step-by-step. First of all we must assume that there is no ready-available working code for simple communication (although I am sure it is, but as a part of complex project, so still requires a lot of work).

For the beginning write simple program that just communicates to chip. Just writes/reads some registers. After that adopting code you posted will be easy.

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 to determine in coordinator event when new node joined network (in lowpower sample)? It's possible in coordinator to determine how much enddevices are in network and catch when one of them disconnected?

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

use peer to peer topology. No coordinator. No associations.
just put the destination 64 bit MAC (IEEE) address and send the data, for a given PAN ID and channel.

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

code-by wrote:
How to determine in coordinator event when new node joined network (in lowpower sample)? It's possible in coordinator to determine how much enddevices are in network and catch when one of them disconnected?

Sorry. I'm on bussines trip now. So have limited access to sources.

But You should look for function ZDO_NwkUpdateNtfy(). Or something like this. It is called once some network event happened (joining/leaving device is one of them). But you can not detrmine actual amount of nodes in network without implementing someting.

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

stevech wrote:
use peer to peer topology. No coordinator. No associations.
just put the destination 64 bit MAC (IEEE) address and send the data, for a given PAN ID and channel.

It is not possible with BitCloud. And doing it without BitCloud will lead to writing huge amount of code.

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 need to add ability to send data from coordinator to enddevie in lowpower sample, for example, to enddevice with short add. 0x0002. What apsDataReq need to be for this?

apsDataReq.dstAddrMode 		= 0x0002;
apsDataReq.dstAddress.shortAddress = 0;
apsDataReq.dstEndpoint		= APP_ENDPOINT;
apsDataReq.profileId		= APP_PROFILE_ID;
apsDataReq.clusterId		= APP_CLUSTER_ID;
apsDataReq.srcEndpoint		= APP_ENDPOINT;
apsDataReq.asduLength		= sizeof (AppMessage_t);
apsDataReq.asdu			= (uint8_t *) &appMessageBuffer.message;
apsDataReq.txOptions.acknowledgedTransmission = 1;
apsDataReq.radius               = 0;
apsDataReq.APS_DataConf         = APS_DataConf;
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

apsDataReq.dstAddrMode = APS_SHORT_ADDRESS;
apsDataReq.dstAddress.shortAddress = 0x0002;

And you will be fine.

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

Yes, I mix up first lines.
So I add to coordinator initialization:

apsDataReq.dstAddrMode       = APS_SHORT_ADDRESS;
apsDataReq.dstAddress.shortAddress = 0x0002; 
apsDataReq.dstEndpoint      = APP_ENDPOINT; 
apsDataReq.profileId      = APP_PROFILE_ID; 
apsDataReq.clusterId      = APP_CLUSTER_ID; 
apsDataReq.srcEndpoint      = APP_ENDPOINT; 
apsDataReq.asduLength      = sizeof (AppMessage_t); 
apsDataReq.asdu         = (uint8_t *) &appMessageBuffer.message; 
apsDataReq.txOptions.acknowledgedTransmission = 1; 
apsDataReq.radius               = 0; 
apsDataReq.APS_DataConf         = APS_DataConf;

I have one coordinator and two enddevices (A & B), sleep time changed from 10 to 2 seconds. When I send data to A, B lost network and rejoin. May be I change number of retries when send from B to coordinator in time it busy with sending to A?

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

code-by wrote:

I have one coordinator and two enddevices (A & B), sleep time changed from 10 to 2 seconds. When I send data to A, B lost network and rejoin. May be I change number of retries when send from B to coordinator in time it busy with sending to A?

Try changing these parameters in config server:

CS_APS_DATA_REQ_BUFFER_SIZE = 4
CS_APS_ACK_FRAME_BUFFER_SIZE = 4
CS_NWK_DATA_REQ_BUFFER_SIZE = 4
CS_NWK_DATA_IND_BUFFER_SIZE = 4

Also new release of BitCloud is coming soon and it should have demo of coordinator sending data to end-device.

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 default values for these variables?

1. Can an enddevice send data to another enddevice in network (if yes, it send via coordinator or directly)?

2. Can an router send data to another router in network (if yes, it send via coordinator or directly)?

3. If there coordinator, router and enddevice, and enddevice in range to direct send data to coordinator - does router envolved in this transaction or not?

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

code-by wrote:
What is default values for these variables?

You can see them in Components\ConfigServer\include\configServer.h

And you must modify them there (not in Configuration file of application). Or if you wish to modify them via Configuration file, you should change Makefile accordingly (see WSNDemo as an example).

code-by wrote:

1. Can an enddevice send data to another enddevice in network (if yes, it send via coordinator or directly)?

2. Can an router send data to another router in network (if yes, it send via coordinator or directly)?

3. If there coordinator, router and enddevice, and enddevice in range to direct send data to coordinator - does router involved in this transaction or not?

You may send data in any directions. But data to end devices will be send only via router or coordinator (parent of destination end device). Just specify destination address and stack will take care of delivery.

Routing will be involved only if needed. Network layer of stack decides for itself whether to use routing or not. There can be situations when two devices are in direct link distance but the link cost (that calculated by complex rules using RSSI and LQI values) is lower when sending via router. In this case router will be used.

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 wish to write my self program w/o bitcloud, do I need to implement calculation of RSSI, LQI, think about message path or all this already implemented in RF230?

My project assume that there is one coordinator and 60 enddevices. I need every 2 seconds receive data from them (2 int) and send data back (1 int). What is better: receive data from 60 enddevices, or send data from enddevice 60 to 59, add data from it, then send to 58, ... etc, and finally in coordinator get data about all enddevices from enddevice 1 (and send data back with this method to 1, 2, ...)?

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

code-by wrote:
If I wish to write my self program w/o bitcloud, do I need to implement calculation of RSSI, LQI, think about message path or all this already implemented in RF230?

Yes, you should do all this. Actually this is why BitCloud was made :)

Quote:

My project assume that there is one coordinator and 60 enddevices. I need every 2 seconds receive data from them (2 int) and send data back (1 int). What is better: receive data from 60 enddevices, or send data from enddevice 60 to 59, add data from it, then send to 58, ... etc, and finally in coordinator get data about all enddevices from enddevice 1 (and send data back with this method to 1, 2, ...)?

60 end devices sending every 2 seconds + data from coordinator is almost impossible. They all have single medium (air) and there will be no space for all of them. For 60 nodes 10 seconds interval seems reasonable enough. With shorter interval nodes will spend most of the time not sleeping but trying to send data.

Also I am not sure if there will be enough memory on coordinator to handle 60 devices without routers. I would recommend 5-10 routers for 60 devices.

Sending should be done to the destination node (coordinator in this case).

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

When I use 8 bit ADC, value of ADC powered by USB was 43 (dec). I change ADC from 8 to 10 bit:

adcParam.resolution = RESOLUTION_10_BIT;

Also I change variables of batterydata and variable for send to coordinator from 8 to 16 bit.
ADC value changed to 171, but I think it is wrong value.

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

code-by wrote:
ADC value changed to 171, but I think it is wrong value.

It is correct value.

In the first case you get 43/(2**8 ) = 0.167969,
in the second case 171/(2**10) = 0.166992.

Both numbers (0.167969 and 0.166992) are parts of full scale value.

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:
If I wish to write my self program w/o bitcloud, do I need to implement calculation of RSSI, LQI, think about message path or all this already implemented in RF230?

Yes, you should do all this. Actually this is why BitCloud was made :)

It would be great to make "BitCloud light" for advanced developrs, who don't need multiple redefinitions and libraries of LEDS, ADC, UART, etc - only data transmission :)

If make my self program w/o using RSSI and LQI, I can't transmit data?

In my project, if I make 1 main coordinator (MC), 6 usual coordinator (UC) for 10 endDevices (ED) - for get/send data, then switch its to enddevices for connect to MC - send/receive data and then switch back to coordinators for theirs 10 ED, and doing every 2 seconds - it will not be big stress? :) or better to add to every UC another Zigbit in role of enddevice connecting by UART and send data to MC?

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

code-by wrote:

It would be great to make "BitCloud light" for advanced developrs, who don't need multiple redefinitions and libraries of LEDS, ADC, UART, etc - only data transmission :)

You can use all this right now. But you must be sure not to keep processor for a long period of time (more than 100 us in critical section (with interrupts disables) and more than 10 ms with interrupts enabled). Code for working with hardware (BSP and HAL) is opensource.
But provided API functions already take care of it.

code-by wrote:

If make my self program w/o using RSSI and LQI, I can't transmit data?

You will be able to transmit/receive data from/to device within direct link range. For routing you will have to implement something (reinvent ZigBee :) ). Be aware that creating and implementing routing algorithm requires a lot of experience and (debugging :) ).

code-by wrote:

In my project, if I make 1 main coordinator (MC), 6 usual coordinator (UC) for 10 endDevices (ED) - for get/send data, then switch its to enddevices for connect to MC - send/receive data and then switch back to coordinators for theirs 10 ED, and doing every 2 seconds - it will not be big stress? :) or better to add to every UC another Zigbit in role of enddevice connecting by UART and send data to MC?

First of all in ZigBee there is only one coordinator (device responsible for creating and maintaining network). All other devices are either routers or end devices.

I actually did not understood what you described. But 60 devices sending every 2 seconds is almost impossible. You can make it easier by disabling APS acks, but in this case data transmission will be unreliable (you won't expect any confirmation from other side).

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 is posible to make coordinator of one network (A) every 2 seconds switch to be enddevice in another netw (B) and switch back to coord.?

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

code-by wrote:
It is posible to make coordinator of one network (A) every 2 seconds switch to be enddevice in another netw (B) and switch back to coord.?

No, it is impossible. Why would you need this?

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

6 Coordinators (each with individual network) get data from their 10 nodes (total 60 nodes), then change their role to be Enddevices of network of MainCoordinator and send data to MC, then restore role to be C in their networks.

Now I thinking how to transmit data from/to 60 nodes every 2 seconds... :) its requirement of project...

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

code-by wrote:
6 Coordinators (each with individual network) get data from their 10 nodes (total 60 nodes), then change their role to be Enddevices of network of MainCoordinator and send data to MC, then restore role to be C in their networks.

Oh, I got it. As I already mentioned it is impossible to change role dynamically. It seems like hard task. Any way I'd expect a lot of debugging and tuning for performance.

Quote:

Now I thinking how to transmit data from/to 60 nodes every 2 seconds... :) its requirement of project...

Can you describe your project? Do nodes really need 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

no, it is no need for nodes to sleep, cause they always powered by AC. I think I full described my project... get data from 60 nodes (2 int) every 2 sec. and send 1 int to each node depend on data from it.
thank

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

code-by wrote:
no, it is no need for nodes to sleep, cause they always powered by AC.

Then use coordinator + 60 routers. But i still doubt that it is possible to send data so frequently.

Quote:

I think I full described my project... get data from 60 nodes (2 int) every 2 sec. and send 1 int to each node depend on data from it.
thank

Do you need reliable delivery or loss of some packets is acceptable?

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

maximum lost 1 packet of 30-40

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

I checked next cases on our test network:

For all cases 1 Coordinator + 60 Routers. Routers were sending 50 bytes of data (standard WSNDemo application).

1) Routers sending data every 2 seconds with APS acknowledgment. Not working + UART on coordinator is starting to be bottleneck.

2) Same thing but 5 seconds: better, but still not applicable for real life.

Recommended sending rate for 60 nodes would start from 15-20 seconds.

Seems like requested data rate is impossible for ZigBee.

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 quick (im mseconds) can an node swtich between different networks?

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

So I begin try to make my self program w/o bitcloud :)

begin with SPI definition & intialization:

//CPU clock 4MHz

//SPI
#define DDR_SS   DDRB.0  //Slave Select - SEL 
#define DDR_MOSI DDRB.2  //Master Out - Slave In 
#define DDR_MISO DDRB.3  //Master In - Slave Out 
#define DDR_SCLK DDRB.1  //SPI Clock

//GPIO
#define RF230_IRQ        PINE.5 
#define DDR_RF230_IRQ    DDRE.5 
#define RF230_SLP_TR     PORTB.4 
#define DDR_RF230_SLP_TR DDRB.4 
#define RF230_RESET      PORTA.7 
#define DDR_RF230_RESET  DDRA.7

// SPI Type: Master
// SPI Clock Rate: 1000,000 kHz
// SPI Clock Phase: Cycle Half
// SPI Clock Polarity: Low
// SPI Data Order: MSB First
SPCR=0x50;
SPSR=0x00;

//init SPI:
DDR_MOSI = 1;
DDR_MISO = 0;
DDR_SCLK = 1;
DDR_SS = 1;

it's right?

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

code-by wrote:
How quick (im mseconds) can an node swtich between different networks?

Node (router or coordinator) is a part of the network. Leaving node from network can somehow affect other nodes in network. So switching between networks is not allowed.

If coordinator leaves network then it will be ruined.

Anyway proper leaving from one network and joining other network can take several seconds.

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

code-by wrote:
So I begin try to make my self program w/o bitcloud :)

I really do not want to mess with parts of code that do not compile. Write simple program to read/write RF registers and see if it is right.

But avoiding BitCloud will not help you at all. Just do the math. All yours frames won't fit into air. Take air frame length (from datasheet), number of frames you want to send and multiply all this.

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:
Anyway proper leaving from one network and joining other network can take several seconds.

May be conect each of six C's with another Zigbit module (via UART) in role of ED as nodes of another seven network and send all data to main coordinator :) but how much it will cost :roll:

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

code-by wrote:
May be conect each of six C's with another Zigbit module (via UART) in role of ED as nodes of another seven network and send all data to main coordinator :) but how much it will cost :roll:

1. ZigBit have only 2 UARTs.
2. If you'll try to send all data via the air again you will face the problem of low throughput.

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 much useful data (bytes) can send or receive node in 1 second?

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

code-by wrote:
How much useful data (bytes) can send or receive node in 1 second?

Depends on amount of other nodes at the same channel and amount of noise and other interference. For 2 nodes (one sending data to other) throughput can be up to 80 kbps (10 kBps).

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 make my self program that reading registers PART_NUM, VERSION_NUM, MAN_ID :)

If I want for example create 10 different zigbee networks, can they work on same channel but having different IEEE_addr? Can be networks be differents, if they work on same channel, IEEE_addr, but different PAN_ID?

Register 0x2E have bit3 'I_AM_COORD' for setup coordinator, but where to set node type 'router'?

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

code-by wrote:
I make my self program that reading registers PART_NUM, VERSION_NUM, MAN_ID :)

Good start!

code-by wrote:

If I want for example create 10 different zigbee networks, can they work on same channel but having different IEEE_addr? Can be networks be differents, if they work on same channel, IEEE_addr, but different PAN_ID?

IEEE_Addr is unique to every device. Network is determined by ExtendedPANID (often equals to IEEE_Addr of coordinator) and ShortPANID. You can have several different networks on the same channel.

code-by wrote:

Register 0x2E have bit3 'I_AM_COORD' for setup coordinator, but where to set node type 'router'?

This is not strictly ZigBee Coordinaror - it is 802.15.4 coordinator, they are different :). And radio-chip knows nothing about ZigBee. This bit only used to set corresponding bit in automatically generated frames.

To support ZigBee roles you need to write all stack (or MAC layer at least).

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

extPANid is IEEE_Addr (regs. 0x24 - 0x2B)?
What about MAC address on every Meshnetics board?

Coud you give example of ShortAddr, PANid and IEEE_Addr for every device for make network with 3 devices (one of them is coordinator)?

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

code-by wrote:
extPANid is IEEE_Addr (regs. 0x24 - 0x2B)?

extPanId is not in registers. RF-Chip contains only values that are needed for automatic frames filtering/ack-ing.

code-by wrote:

What about MAC address on every Meshnetics board?

What about them?

code-by wrote:

Coud you give example of ShortAddr, PANid and IEEE_Addr for every device for make network with 3 devices (one of them is coordinator)?

Any different combinations of (IEEE_Addr, ShortAddr) and PanId common to them all.

Example:
panid shortaddr extaddr
123 1 1
123 2 2
123 3 3

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

In each meshnetic board there an MAC-address (8 bytes/ 64 bites). It's defined in UID chip. Zigbit OEM modules haven't it. Do I need to set this MAC-address? And for what it coud be used?

Why CS_EXT_PANID is 10 bytes (not 8 like IEEE_addr)?

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

code-by wrote:
In each meshnetic board there an MAC-address (8 bytes/ 64 bites). It's defined in UID chip. Zigbit OEM modules haven't it. Do I need to set this MAC-address? And for what it coud be used?

UID-chip can be used to obtain unique 64-bit number. This number can be used as IEEE Addr.

code-by wrote:

Why CS_EXT_PANID is 10 bytes (not 8 like IEEE_addr)?

CS_EXT_PANID is 8 bytes (64 bits) long. If you mean LL on the end - it denotes 'long long' type (L is not valid hexadecimal character).

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 in what registers I can write 64bits CS_EXT_PANID? PAN_ID only is 16 bits.

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

code-by wrote:
So in what registers I can write 64bits CS_EXT_PANID? PAN_ID only is 16 bits.

In no register.

Seriously, read standard (ZigBee + MAC) and try to understand that there are a lot of things that you need to handle in microprocessor. Chip uses short PANID to filter packets that come from different PAN. There is no need for chip to know extended PAN ID.

ZigBee is not that simple as one may think. BitCloud consumes 100k of code space for a reason.

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:
ZigBee is not that simple as one may think. BitCloud consumes 100k of code space for a reason.

Ok, but its write for WinAVR compiler, I like to use CodeVision AVR :) and BitCloud links to precompiled libraries that compiler always using when I need, for example, ADC, so I can't insert my ADC IRQ function....

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

code-by wrote:

Ok, but its write for WinAVR compiler, I like to use CodeVision AVR :) and BitCloud links to precompiled libraries that compiler always using when I need, for example, ADC, so I can't insert my ADC IRQ function....

OK, but be prepared to spend couple of years writing and debugging ZigBee stack.

Sorry, can't help you in this case. But start with reading IEEE 802.15.4 standard - you will need to implement it anyway.

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

code-by wrote:
so I can't insert my ADC IRQ function....

HAL and BSP are open-source - insert anything you like. Just be careful.

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 send data w/o zigbee stack for network with 1 coordinator and 6 enddevices. Zigbee stack using for routing and to send data with minimal power consumption. If topology of my network don't change at time and I not need to use router - I think that I don't need to worry about zigbee stack.

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

Hi! Question about BitCloud & AVRStudio. Need to store some constant data in flash & realize self programming using bootloader (somth like this). Can U help with SPM functions?

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

Quote:

Can U help with SPM functions?

Yes.

I presume you have looked at which bit don't you understand?

You are aware of the 10,000 cycle limit I take it? Often (for smaller amounts of data the 100,000 cycle EEPROM is a better place for it)

Cliff

PS Also, did you read the Bootloader FAQ ?

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

In & i didn't find function for store const massive data in RWW section.

P.S. bootloading is secondary objective.

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

What do you mean? At the top of boot.h (as also described in the manual - http://www.nongnu.org/avr-libc/u... "API Usage example") there's a fairly comprehensive demonstratin of how to use the APIs to write a page.

In my own code I then write a large bloc of data a page at a timer using:

void 
#ifdef ENABLE_SPM
BOOTLOADER_SECTION
#endif
my_spm_routine(
	void
){
	uint16_t	i;
	uint16_t	page = 0xFE0; // last 32 pages of 528 bytes (16,896) hold f/w image
	uint8_t	buf[SPM_PAGESIZE];
	uint32_t	code_page;
	void (* fn_ptr) (void);
	uint8_t valid = 1;

	cli();
	
	PORTD ^= (1<<LED3);
   	SPI_enable();

	dflash_chip_select();

	write_SPI(0xE8); //continuous array read command
#ifdef FLASH_528
	write_SPI((page >> 6) & 0x3F); //send page number then byte offset = 0
	write_SPI((page &0x3F) << 2);
#else
	write_SPI((page >> 7) & 0x07); //send page number then byte offset = 0
	write_SPI((page &0x7F) << 1);
#endif
	write_SPI(0);

	write_SPI( 0 ); //four don't care bytes to start read process
	write_SPI( 0 );
	write_SPI( 0 );
	write_SPI( 0 );

	write_SPI( 0xFF ); // gonna check 1st three bytes at start of page FE0 for "CJL" to show code is available
	if (SPDR != 'C') {
		valid = 0;
	}
	write_SPI( 0xFF );
	if (SPDR != 'J') {
		valid = 0;
	}
	write_SPI( 0xFF );
	if (SPDR != 'L') {
		valid = 0;
	}

	if (valid) {
		for (code_page=0; code_page<112; code_page++) { // 112 pages of 128 bytes to 1C00
			for (i=0; i < SPM_PAGESIZE; i++) {
				write_SPI(0xFF) ; // dummy write in order to read a byte 
				buf[i] = SPDR;
	//			buf[i] = 0x5F;
			}
			boot_program_page((code_page * SPM_PAGESIZE), buf);
		}
	}

	dflash_chip_unselect();
	SPI_disable();

	if (valid) {
		// force a reboot into the new code
		fn_ptr = (void *) 0;
		fn_ptr();
	}
	sei();
}

(though this is complicated by the fact that I'm reading the data out of an AT45 Dataflash - but the core shows boot_program_page() being used)

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

Tried to execute example from boot.h.

488:      		boot_spm_busy_wait ();
+00000861:   B607        IN        R0,0x37        In from I/O location
+00000862:   FC00        SBRC      R0,0           Skip if bit in register cleared
+00000863:   CFFD        RJMP      PC-0x0002      Relative jump

Bit isn't clear for all time

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

Alexru,
You said on Jul 13, 2009 - 11:06 AM

alexru wrote:

Also new release of BitCloud is coming soon and it should have demo of coordinator sending data to end-device.

Do you have any details on when this will be available?
Thanks,
- Ed

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

Hi!

It is possible to send data to all end-devices at once (broadcast) with Bitcloud stack? If yes, what need to be changed in Lowpower demo /Bitcloud v.1.6/

thanks

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

In Lowpower end devices send data to coordinator.

If you want to send data to all end devices you should send them as usual but to 0xffff short address.

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:

Also new release of BitCloud is coming soon and it should have demo of coordinator sending data to end-device.

in what example of bitcloud 1.6 I can find this?

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

code-by wrote:
in what example of bitcloud 1.6 I can find this?

Actually LowPower now includes data sending from coordinator to end devices.

Look around dataInd() and startSending() functions in coordinator.c.

In sendStep() set apsDataReq.dstAddress.shortAddress = 0xffff; and remove children cycle logic.

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

Hello,

I'm trying to compile blink sample (from BitCloud_ZDK_1_6_0).
From AVR Studio 4, Build / Build, I got the following error :

c:/program files/winavr-20090313/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: cannot open map file ./list/blink.map: No such file or directory
make: *** [blink.elf] Error 1
Build failed with 1 errors and 0 warnings...

Most of previous compilation steps worked fine (such as Config Server, Board support lib, etc).

But the Application Objects creation / linking doesn't work.

Any clue ?

Lyte.

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

lyte wrote:
Any clue ?

Seems like linker can not access ./list directory. Try to create some file there by hand to check if it is accessible.

You may also try to disable .map file generation. Find the following string in Makefile

LINKER_FLAGS = -Xlinker -Map=$(APP_PATH)/list/$(PROJNAME).map -Wl,--gc-sections

and change it to

LINKER_FLAGS = -Wl,--gc-sections

Also try to build application from command line.

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

ok. thank for help

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

Hi,

Thanks for the tips.
I created "list" directory within the "blink" one (and additional one, such as objs dir).
This works fine know, having the .map file generation.

I uploaded blink.srec to the module. This works fine as well.

I also played with AT command, from a PC+Zigbit+Hyperterminal (Host) and Remote Nodes. This is also great.

Quick question : I would like to use these AT commands (really straightforward) from the Remote Node, to send data to the Host.
Eg : I need to add my own code(very simple, as this is only grabbing info from GPIO) on top of AT layer code, and then send result to Host, with simple AT commands.
In other, I want to embed AT commands in my own code. Should I re-program everything, based/starting with BitCloud framework, or do we have something simpler ?

Thank’s in advance.

Lyte.

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

lyte wrote:
I created "list" directory within the "blink" one (and additional one, such as objs dir).
This works fine know, having the .map file generation.

They should be there after unpacking actually.

lyte wrote:

In other, I want to embed AT commands in my own code. Should I re-program everything, based/starting with BitCloud framework, or do we have something simpler ?

SerialNet source code is closed and I am myself not a big fan of SerialNet so I can't help here. Ask tech support if you really curious.

I'd recommend you to study how the other sample applications work and write simple application on top of BitCloud 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

Thank's, I'll follow you recommandations, dig into the the other sample applications.

For the directories, yes, they should be there after unpacking actually. But I unpack BitCloud_ZDK_1_6_0, and some of them where missing. I manually created them, now this is fine.

Lyte.

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

Hello,

I'm trying to play with peer2peer. I've got following error :
c:/winavr-20090313/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: avr:51 architecture of input file `objs/peer2peer.o' is incompatible with avr output

Everything is compiling fine, except the program itself.

Any idea ?

Regards,
Lyte

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

Do you get this error on stock ZDK or have you modified anything?

Also latest release of BitCloud was build using WinAVR 20081205. There may be some incompatibilities between 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! After looking Bitcloud manual I found there only possibility to get ADC data from 4,8k to 77k samples per second (free running mode). It is possible to make only 1 reading of ADC per second?

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

code-by wrote:
Hi! After looking Bitcloud manual I found there only possibility to get ADC data from 4,8k to 77k samples per second (free running mode). It is possible to make only 1 reading of ADC per second?

Yes, it is. Setup application timer to fire every second and read single ADC value in callback of this timer.

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

Hello,

I got the error on stock ZDK, wihtout any modification.
Then I removed winavr-20090313 and installed winavr-20081205. Same error :
c:/winavr-20081205/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: avr:51 architecture of input file `objs/peer2peer.o' is incompatible with avr output.

I'm using AVR Studio 4 on top of winavr. Any specific setup ?

REgards,
Lyte.

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

lyte wrote:

I'm using AVR Studio 4 on top of winavr. Any specific setup ?

Try it without AVR Studio. Invoke 'make clean all' from command line.

Are there any other development tools (other version of gcc) installed?

How about other sample applications?

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

ADC in 1281 works with div. from 2 to 128, or in case of 8MHz, from 62,5kHz to 1MHz. Why constants of sample rates per second of ADC from 4,8k to 77 k?

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

It is possible to make network topology like on attached picture? (ED2 and ED5 may be routers)

When I send data from one ED to other ED, its send via coordinator or directly?

Attachment(s): 

Last Edited: Wed. Oct 14, 2009 - 12:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

All other applications sample are compiling OK. (except peer2peer).
I tried command line 'make clean all'. Same error
I reinstall le ZDK to be sure I got the original file. Same error.

Other development tools : only Dev-Cpp.

Regards,
Lyte.

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

I have AVR Studio 4.16 and WinAVR 20090313 - all compiling is fine

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

code-by wrote:
It is possible to make network topology like on attached picture? (ED2 and ED5 may be routers)

You can not control actual topology BitCloud will choose best one depending on many factors.

Why do you need this?

code-by wrote:

When I send data from one ED to other ED, its send via coordinator or directly?

Data to/from ED is always sent via its parent.

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

lyte wrote:

All other applications sample are compiling OK. (except peer2peer).
I tried command line 'make clean all'. Same error
I reinstall le ZDK to be sure I got the original file. Same error.

I afraid I won't be able to help you in this case. It is something specific to your system.

All Makefile-s are basically the same.

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 try to make following:
1. coordinator may broadcast the same data to all ED at once
2. EDs communicated with C may be much than two in the picture and have only two neighbours EDs communicated by P2P.
3. any ED (incl. 1,3,4,6) can directly send data to coordinator

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

Hello,

Just re-install all the stuff on another PC. Work fine now. I'll re-install the OS from scratch on the previous PC.

Thank's for your help.

Regards,
Lyte

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

Mode of communication from description of P2P sample:
node 0 with node 1;
node 2 with node 3;
node 4 with node 5;
node 6 with node 7.
Can I change code to send from any node to any other, and it send message via coordinator any way or directly?

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

code-by wrote:
Can I change code to send from any node to any other, and it send message via coordinator any way or directly?

You may send to any address. Only BitCloud knows exact path of data. Sometimes it is better to send via some other router instead of direct sending. Do not think that direct line-of-sight link is optimal.

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. Yes, when we think about power consumption its better to send with better signal quality. But if I need use well-defined path of message (distance between nodes is enough to send msg directly) ?

2. If I have 10 routers between ED and C, to send data all routers retransmit this message while I need to send it directly. So routers will be busy with when retransmit msg.

3. In p2p sample if distance between node2 and 3 is much small than between node2 and node0 (coordinator), it any away go first to coordinator? or node2 in all cases can't send directly w/o C?

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

code-by wrote:
1. Yes, when we think about power consumption its better to send with better signal quality. But if I need use well-defined path of message (distance between nodes is enough to send msg directly) ?

Then ZigBee is not your choice.

code-by wrote:

2. If I have 10 routers between ED and C, to send data all routers retransmit this message while I need to send it directly. So routers will be busy with when retransmit msg.

BitCloud will figure out best way to transmit. If there is possibility to send data directly it will send them directly.

code-by wrote:

3. In p2p sample if distance between node2 and 3 is much small than between node2 and node0 (coordinator), it any away go first to coordinator? or node2 in all cases can't send directly w/o C?

Distance does not matter. It is RF. It is possible to have nodes couple meters away not able to communicate due to signal fading or some wired combination of signal paths.

Again, do not worry. ZigBee is designed to make best effort.

PS: I'll answer about ADC 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

code-by wrote:
ADC in 1281 works with div. from 2 to 128, or in case of 8MHz, from 62,5kHz to 1MHz. Why constants of sample rates per second of ADC from 4,8k to 77 k?

Datasheet clearly states

Quote:
Up to 76.9 kSPS (Up to 15 kSPS at Maximum Resolution)

and
Quote:
The ADC module contains a prescaler, which generates an acceptable ADC clock frequency
from any CPU frequency above 100 kHz.

So prescaler is needed to generate clock that ADC can handle (50 kHz - 200 kHz). You can not "overclock" ADC.

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

Hello,

I've uploaded P2P sample on 2 modules ZigBit OEM Modules.
One of them has CS_NWK_ADDR_ID=0 (Coordinator), and the second one CS_NWK_ADDR_ID=1 (End Device).
I connected then on 2 USB port on my PC, and open 2 terminal window.

Communcation is going fine from Coodinator (0) to End Device (1), but not the reverse (from End Device to Coordinator).
The Red Led (Sending) is lighting on the ED, but the Yellow one (receiving) is off on the Coordinator. Nothing arrived on the terminal.

Any idea ? I re-used the P2P.c program, only adding the 2 lines, to setup the nw:

nwkAddr=1; // ntwAddr=0;
CS_WriteParameter(CS_NWK_ADDR_ID, &nwkAddr);

Regards,
Lyte.

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

Setup looks good. You could just set CS_NWK_ADDR to whatever you want in Configuration file instead of direct source code editing.

Which SDK do you use?

PS: P2P uses Coordinator and routers (not end devices).

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

OK, I'll go throught config file instead of direct source code editing.

SDK : I'm using a ZigBit OEM Modules Breakout board (http://www.lextronic.fr/produit....) and BitCloud_ZDK_1_6_0.

OK, P2P is only Coordinator and Routers. Both should communicated in both direction. Correct ?

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

lyte wrote:
SDK : I'm using a ZigBit OEM Modules Breakout board (http://www.lextronic.fr/produit....) and BitCloud_ZDK_1_6_0.

Then you'll have _SLIDERS_ defined and p2p will expect them.

Change this part of code:

#ifndef _SLIDERS_

  // NWK preconfigured address reading for Config Server

  CS_ReadParameter(CS_NWK_ADDR_ID, &nwkAddr);

#else  //#ifndef _SLIDERS_

  // NWK address reading from sliders 

  nwkAddr = BSP_ReadSliders();

  // Set the NWK address value to Config Server

  CS_WriteParameter(CS_NWK_ADDR_ID, &nwkAddr);

#endif //#ifndef _SLIDERS_

to

CS_ReadParameter(CS_NWK_ADDR_ID, &nwkAddr);

lyte wrote:

OK, P2P is only Coordinator and Routers. Both should communicated in both direction. Correct ?

Yes, they are. May be this is hardware problem?

You may try to change line

appUsartDescriptor.flowControl = USART_FLOW_CONTROL_HARDWARE;

to

appUsartDescriptor.flowControl = USART_FLOW_CONTROL_NONE;

In this way p2p won't use HW flow control.

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,

I'm working on a project using the ZigBit 2.4 GHz Amp Module with U.FL Connector. I set up two PCB-s on which I mounted 2 modules. There is no UID chip.

I have a coordinator and a router. I took as an example the WSN_DEMO application and modified it a little bit:
- every 5 seconds each device sends a message to the other one
- I enabled IRQ0 to send message when triggered
All sent and received messages are outputted by the coordinator using the UART.

I left the devices running and the coordinator connected to my RS-232 port. Everything works OK for a couple of hours (5-6).

After this the coordinator stops sending messages on the RF. It receives all the messages from router and it outputs them on the UART. But the timer looks like it is stopped, IRQ not working.
If I send a command to coordinator which should be sent to router it works. The coordinator sends the command to router. After this everything is back to normal, coordinator is working fine.
It is not a state machine problem because the IRQ send the state machine in the SENDING_MESSAGE state (in which the message is sent to router).

After some time (a couple of hours again) the router stops sending messages. As for the router there is no command (on UART) to force him to send a message a reset is required. All this time the router gets all the messages from the coordinator.

Does anybody have any clue what is the cause of the problem?

I'm using:
- BitCloud API 1.6
- WinAVR-20090313
- most of the code from WSN_DEMO project (should I assign an UID to each device?)

Thank you

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

1. You should set CS_UID on platforms without UID.

2. Nobody will be able to help you without careful study of source code and hours of debugging. But from my experience it really looks like broken state machine. It may broke somehow after state change.

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 had a code review and came across a simple fact: I do NOT have any code which disables the IRQ nor the timer I used.

So I can't understand why the IRQ and timer get disabled and everything else works (process incoming messages on RF and UART).

I did the following:
1. Set the CS_UID
2. Recompile using BitCloud 1.5

I write the new firmware and let it run.
Now after 19 hours devices are still running perfectly.

When they reach 24 hours I will recompile using the BitCloud 1.6.

By the way: I could not find a history for the releases of BitCloud.
What did BitCloud 1.6 bring new? (Except for the precompiled files for Iar)

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

EGTOGAMAT wrote:
So I can't understand why the IRQ and timer get disabled and everything else works (process incoming messages on RF and UART).

RF and UART won't work with interrupts disabled.

Are you using HAL_AppTimer()?

EGTOGAMAT wrote:

By the way: I could not find a history for the releases of BitCloud.
What did BitCloud 1.6 bring new? (Except for the precompiled files for Iar)

See file Release Notes.txt in SDK.

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:

appUsartDescriptor.flowControl = USART_FLOW_CONTROL_NONE;

In this way p2p won't use HW flow control

I set controlflow=None, and now it works.

Tx,
Lyte.

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

lyte wrote:

I set controlflow=None, and now it works.

Fine. Just be prepared to possible data loss.

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:

1. You should set CS_UID on platforms without UID.

Looks like this was the key element. I re-compiled with BitCloud 1.6 and after 24 hours everything is ok (using the same state machine)

Thanks again for the hyperfast help :)

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

Hi!
In Lowpower sample - sendStep() function I change

apsDataReq.dstAddress.shortAddress = children.childrenTable[childrenIndex].shortAddr;

to

apsDataReq.dstAddress.shortAddress = 0xFFFF;

and comment following in APS_DataConf():

//childrenIndex++;
//sendStep();

but node don't change sensor type :(

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

EGTOGAMAT wrote:
Looks like this was the key element. I re-compiled with BitCloud 1.6 and after 24 hours everything is ok (using the same state machine)

Zero UID can not be directly connected to hangups. Anyway I am glad that problem solved.

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

code-by wrote:
but node don't change sensor type :(

Try to leave shortAddress as it was but leave comment in APS_DataConf and see what happens.

If it is possible also add some indication (led or something else) to function dataInd() in enddevice.c.

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

Now coordinator change sensor only of node with 0x0001 addr, but I need change in all nodes by sending command once (broadcast).
Where I can found function that compare self address and address of incoming message to accept or not this message?

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

code-by wrote:
Now coordinator change sensor only of node with 0x0001 addr, but I need change in all nodes by sending command once (broadcast).

So 0xffff must work. I don't know what the problem is but I'll think about it.

code-by wrote:

Where I can found function that compare self address and address of incoming message to accept or not this message?

It is done automatically by BitCloud.

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 know that done by BitCloud, but in what file/function?

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

code-by wrote:
I know that done by BitCloud, but in what file/function?

How it will help you? BitCloud source code is closed.

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

May be some error in this function that not accept messages for all nodes with addr. 0xffff?

Its possible to speedup UART from 38400 to 115200 (from coordinator to PC)? When I change USART_BAUDRATE_38400 to USART_SYNC_BAUDRATE_115200 and change speed of COM from 38400 to 115200 in hyperterminal - it don't correctly show incoming data :(

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

code-by wrote:
May be some error in this function that not accept messages for all nodes with addr. 0xffff?

It might be an error in BitCloud. Check conf->status value in APS_DataConf() on coordinator.

code-by wrote:

Its possible to speedup UART from 38400 to 115200 (from coordinator to PC)? When I change USART_BAUDRATE_38400 to USART_SYNC_BAUDRATE_115200 and change speed of COM from 38400 to 115200 in hyperterminal - it don't correctly show incoming data :(

It is impossible without changing CPU frequency. And changing it impossible due to a lot of reasons.

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

When I send to 0xFFFF the status is 0x00A6

(APS_INVALID_PARAMETER_STATUS = 0xa6, //!

sending to 0x0001 - status is 0x0000 (success)

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

code-by wrote:
When I send to 0xFFFF the status is 0x00A6

(APS_INVALID_PARAMETER_STATUS = 0xa6, //!

sending to 0x0001 - status is 0x0000 (success)

I just remembered that for broadcast transmission you need to set apsDataReq.txOptions.acknowledgedTransmission = 0.

This might help.

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 would like to set up a ZigBee topology which will include routers and endpoints.

I would be grateful if I could get a little help for the questions below.

1. I looked over over the documentation of BitCloud but I could not find the maximal number of:
- endpoints accepted by a router
- number of routers in a PAN
- depth of a network (starting from PAN or between 2 devices/routers)
I found in the API help the predefined values for some of the parameters. But there is no maximal value indication.

2. I would like to set up a topology made up just by routers (no low power constraints) if possible.
My question: does BitCloud offer a best-route mechanism? Meaning if I have 3 routers a new router which connects how will it chose the parent?
2.a) I could do a software workaround but can I force a device to:
- scan for a PAN and all address of all "direct view" routers (with depth 1)
- force the new router to connect to a specific router (parent)?

3. Can I use all 16 channels in the same place? I ask this because in theory for wi-fi there are also 16 channels but real life in the same place only 8 channels are used (due to overlap on an adjacent channel a lot of errors occur). As ZigBee data transfer is much lower I think it should work.
Was it ever tested?

Thanks

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

EGTOGAMAT wrote:

I found in the API help the predefined values for some of the parameters. But there is no maximal value indication.

Limited by amount of available memory only.

EGTOGAMAT wrote:

Meaning if I have 3 routers a new router which connects how will it chose the parent?

Parent will be chosen based on best link quality.

EGTOGAMAT wrote:

2.a) I could do a software workaround but can I force a device to:
- scan for a PAN and all address of all "direct view" routers (with depth 1)
- force the new router to connect to a specific router (parent)?

There are no documented API for manual scanning now. But functions are there and you may use them.

For routers 'connection' is something ephemeral. They may change parent.

EGTOGAMAT wrote:
Was it ever tested?

We all work on different channels here and all channels are busy. We see no interference at all.

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

Changes doesn't help for send broadcast message to all nodes :(

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

code-by wrote:
Changes doesn't help for send broadcast message to all nodes :(

What the return code after change?

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

with codes 0x00A6 or 0x0000 it not change type of sensor and ED node don't receive any thing.

What is group (multicast) method of sending message? Do I need add address of every node to some group for sending messages?

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

code-by wrote:
with codes 0x00A6 or 0x0000 it not change type of sensor and ED node don't receive any thing.

There is problem in BitCloud with sending broadcast data to EDs. It has been corrected in development version but I do not know when it will be released.

As workaround I'd suggest using unicast or routers instead of EDs.

code-by wrote:

What is group (multicast) method of sending message? Do I need add address of every node to some group for sending messages?

No. You add node to some group (referenced by predefined ID). All other nodes in this group (they also must add themselves to this group) will receive message. You may try this but I do not have any sample on this and it has no advantages over sequential unicast send in this case.

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 2 questions about interrupts:

1. When an interrupt is served does the general interrupt bit get cleared by default? (because the API recommends using global variables a reentrant function can cause wrong results)

2. Is there a function to clear the IRQ interrupt flag? I ask this because I set up the following debounce mechanism:
- at the first call of the interrupt handler I disable the interrupt and start a timer
- when timer is triggered I re-enable the interrupt

I notice that the interrupt handler is executed twice regardless of the debounce timer value (300 ms, 700 ms). I think that the bounce of the button is setting the interrupt flag after I disable the interrupt. When I enable it again the interrupt handler is executed again.
(I did a software workaround but the idea is that the interrupt handler is executed more times - due to bounce).

I could manually clear the interrupt flag (touching direclty the interrupt bit) before enabling the interrupt. May I do this? (in the user guide is recommend not to access directly the mcu registers)

Thanks for help

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

EGTOGAMAT wrote:
I could manually clear the interrupt flag (touching direclty the interrupt bit) before enabling the interrupt. May I do this? (in the user guide is recommend not to access directly the mcu registers)

You should not touch global interrupt flag, it will mess data transmission/reception.

See how debounce is implemented in Components/BSP/buttons.c.

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

In Lowpower app I try change devices type from ED to Router. I change #ifdef _ENDDEVICE_ TO _ROUTER_ and set appDeviceType = DEVICE_TYPE_ROUTER;, update flash of Coordinator and second board, but this board don't connect to Coordinator :(

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

code-by wrote:
In Lowpower app I try change devices type from ED to Router. I change #ifdef _ENDDEVICE_ TO _ROUTER_ and set appDeviceType = DEVICE_TYPE_ROUTER;, update flash of Coordinator and second board, but this board don't connect to Coordinator :(

You should also set rxOnWhenIdle to true and remove all sleep-related code.

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

Now in LP sample node find network, but coordinator still don't send to 0xFFFF

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

code-by wrote:
Now in LP sample node find network, but coordinator still don't send to 0xFFFF

By default LP configured as

CS_MAX_CHILDREN_AMOUNT = 7
CS_MAX_CHILDREN_ROUTER_AMOUNT = 0

so coordinator won't allow to router to join. Did you changed this?

Is unicast to routers working?

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

Do I need use same message structure (for example AppMessageBuffer_t in LP sample) when send from C to ED and from ED to C or it can be diverse (of course with definitions of these two structures for each device)? I need to send from C to ED 4 int variables and from ED to C only 2 int variables.

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

code-by wrote:
Do I need use same message structure

You may send anything you like.

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

After modify configuration to
CS_MAX_CHILDREN_AMOUNT = 7
CS_MAX_CHILDREN_ROUTER_AMOUNT = 7
unicast to routers don't work (may be I don't change all that needs to be changed for this)

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

code-by wrote:
After modify configuration to
CS_MAX_CHILDREN_AMOUNT = 7
CS_MAX_CHILDREN_ROUTER_AMOUNT = 7
unicast to routers don't work (may be I don't change all that needs to be changed for this)

Later I'll try this and post results. May take couple of days 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

Here is the patch which demonstrates broadcast to routers based on low power application.

Attachment(s): 

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

Sometimes when I write string to USART for display in Hyperterminal, its not full displayed (only part of it) and continue to display only with next received message.
How to resolve this problem?

Attachment(s): 

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

code-by wrote:
Sometimes when I write string to USART for display in Hyperterminal, its not full displayed (only part of it) and continue to display only with next received message.
How to resolve this problem?

Peer2peer is written keeping specific logic in mind. You can not just pass 150 bytes string if sendDataToUsart() is not ready to take it. I am not able to predict what happens and have no time to debug your code.

If your application becomes way different from sample application you should start your own application from scratch implementing only logic you need.

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 setting for "Flow Control" I need set for P2P sample (in BitCloud documentation I found "Flow Control" is "None", but in P2P sample appUsartDescriptor.flowControl = USART_FLOW_CONTROL_HARDWARE;

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

code-by wrote:
What setting for "Flow Control" I need set for P2P sample

Depends on what kind of flow control you need.

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

Sometimes not full string appear in Hyperterminal in Lowpower app. too (when one trigger message sending by button). What is recommended string length for send from board to PC?

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

code-by wrote:
Sometimes not full string appear in Hyperterminal in Lowpower app. too (when one trigger message sending by button). What is recommended string length for send from board to PC?

There is no "strings" when sending to UART. There are buffers which user must control how full they are and stop transmission.

To get reliable data transfer you need to use hardware flow control. But this must be supported by hardware itself (you need to have full cable with CTS/RTS lines).

What the steps to reproduce data loss in LowPower application? And what hardware do you 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

next

Last Edited: Wed. Oct 28, 2009 - 01:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I remove sleep and repeatable press message sending key.
I use meshbean WDB-A1281-A2 and USB cable (virtual com) from Meshnetic starter kit.

Attachment(s): 

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

code-by wrote:
I remove sleep and repeatable press message sending key.
I use meshbean WDB-A1281-A2 and USB cable (virtual com) from Meshnetic starter kit.

Show your changes to code. I believe original LowPower newer stops to send data so it must be something you have changed.

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:
EGTOGAMAT wrote:
Looks like this was the key element. I re-compiled with BitCloud 1.6 and after 24 hours everything is ok (using the same state machine)

Zero UID can not be directly connected to hangups. Anyway I am glad that problem solved.

As always you are right :)

I found the bug that cause the hang up.

I tried to force the COO to start a new PAN if it sends a message 3 times and no confirmation is received.
I did this by setting the state machine to INIT state which uses:
ZDO_StartNetworkReq(&networkParams);
The
static void ZDO_StartNetworkConf(ZDO_StartNetworkConf_t *confirmInfo)
is never called as COO is in ZDO_IN_NETWORK_STATUS .

1. How can I force the COO to (a) drop the current network and (2) start a new network? Should I use ZDO_ResetNetworkReq() ?

2. How can I chose the channel to be used when starting the network (CS_CHANNEL_MASK has only 8 digits while 2.4 GHz there are 13 channels)

Thanks

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

EGTOGAMAT wrote:
static void ZDO_StartNetworkConf(ZDO_StartNetworkConf_t *confirmInfo)
is never called as COO is in ZDO_IN_NETWORK_STATUS .

Yes. And actually it is considered a bug and will be fixed soon so it will be called with some error status :)

EGTOGAMAT wrote:

1. How can I force the COO to (a) drop the current network and (2) start a new network? Should I use ZDO_ResetNetworkReq() ?

You may. You also may issue ZDP Leave Request with dstExtAddr = 0.

EGTOGAMAT wrote:
2. How can I chose the channel to be used when starting the network (CS_CHANNEL_MASK has only 8 digits while 2.4 GHz there are 13 channels)

CS_CHANNEL_MASK is 32 bits. You may specify any specific channel or subset of channels.

Don't be confused by constructions like "(1L<<0x0f)" used in configuration files by default. This construction is 1 shifted 15 times left (15 channel).
You may use something like 0x00018000L (which is channel 15 and 16).

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:

EGTOGAMAT wrote:

1. How can I force the COO to (a) drop the current network and (2) start a new network? Should I use ZDO_ResetNetworkReq() ?

You may. You also may issue ZDP Leave Request with dstExtAddr = 0.

When using Reset everything blocks. I expected ZDO_ResetNetworkConf to receive ZDO_SUCCESS_STATUS == resetInfo->status but the callback fucntion is not executed.
The Leave Request is working perfectly.
alexru wrote:

EGTOGAMAT wrote:
2. How can I chose the channel to be used when starting the network (CS_CHANNEL_MASK has only 8 digits while 2.4 GHz there are 13 channels)

CS_CHANNEL_MASK is 32 bits. You may specify any specific channel or subset of channels.

Don't be confused by constructions like "(1L<<0x0f)" used in configuration files by default. This construction is 1 shifted 15 times left (15 channel).
You may use something like 0x00018000L (which is channel 15 and 16).


I modified the Configure file by changing:
CS_CHANNEL_MASK = "(1l<<0x7)"
and the device is reporting that mask is 0x0 and thus no PAN is created. It looks like somewhere there's an AND with (1L<<0x0f) and only channel 15 is being used.
If I set
CS_CHANNEL_MASK = 0x00018080L
I get the same results: NO PAN is created and mask is read from CS as 0x0.
I'm using:
- ZigBit 2.4 GHz Amp Module with U.FL Connector
- ZigBit 2.4 GHz Module with Dual Chip Antenna
- BitCloud_ZDK_Amp_1_6_0

Thanks

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

EGTOGAMAT wrote:

When using Reset everything blocks.

Possible bug. I'll look into it.

EGTOGAMAT wrote:

I modified the Configure file by changing:
CS_CHANNEL_MASK = "(1l<<0x7)"

For 2.4 GHz valid range of channels is 0x0b-0x1a.
Channels 0x01-0x0a are belong to 900 MHz range.

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 notice that in the ZigBit 900 MHz kit datasheet
(http://atmel.com/dyn/resources/p...)
it is said that:

1. There are 15 channels at 2 MHz channel spacing. I think there is a small error because for European range (868 to 868.6) there are no 30 MHz available.

2. I see in the table in the parameter column 1000 kbit/s. I ran the ThroughputTest using the 900 MHz kit but I did not manage to reach this speed. How can I change PSDU size?

Thanks

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

EGTOGAMAT wrote:
1. There are 15 channels at 2 MHz channel spacing. I think there is a small error because for European range (868 to 868.6) there are no 30 MHz available.

It is better to refer to RF-chip datasheet for exact frequencies and channels. All this modes are a little bit complicated.

EGTOGAMAT wrote:
2. I see in the table in the parameter column 1000 kbit/s. I ran the ThroughputTest using the 900 MHz kit but I did not manage to reach this speed. How can I change PSDU size?

1000 kbit/s is Atmel's proprietary mode. It is not in 802.15.4 specification and not ZigBee compliant. BitCloud does not support it currently.

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 try to set up the following flow (using 2.4 GHz devices):
- configure channel mask for COO for all channels: 0x03FF_FC00
- start a PAN. The PAN is started on channel 16.
- if no device connects I would like to change the channel mask to 0x0010_0000 (for example)
- restart the PAN (by using Leave Request method)

1. I notice that COO does not change the channel (each time a PAN is set up I check the startInfo->activeChannel information). So I have a COO working on channel 16 but having channel mask = 0x0010_0000 (it should be channel 11)

2. If the read the CHANNEL_MASK before changing it it reads ok: 0x03FF_FC00. If I read it after I tried to change it (using a UART command) the device returns 0x0010_0008. What does the 8 stand for?

3. What is the appropiate method for saving parameters between resets? (direct eeprom access is not recommended as far as I seen).

Thanks

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

EGTOGAMAT wrote:
1. I notice that COO does not change the channel (each time a PAN is set up I check the startInfo->activeChannel information). So I have a COO working on channel 16 but having channel mask = 0x0010_0000 (it should be channel 11)

0x0010_0000 = 1<<0x14, not 11 by any means.
I don't quite understand what are you doing. Can you post step-by-step guide along with actual and expected results?

EGTOGAMAT wrote:

2. If the read the CHANNEL_MASK before changing it it reads ok: 0x03FF_FC00. If I read it after I tried to change it (using a UART command) the device returns 0x0010_0008. What does the 8 stand for?

Stack never changes CHANNEL_MASK, only reads it, must be something wrong in your code. Check that you pass CS_CHANNEL_MASK_ID, not just CS_CHANNEL_MASK.

EGTOGAMAT wrote:

3. What is the appropiate method for saving parameters between resets? (direct eeprom access is not recommended as far as I seen).

PDS_WriteData() and PDS_ReadData() functions.

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

Is it possible to synchronize to a request confirmation ? For example, I do APS_AddGroupReq(), but I have many variables that I would like to use in the function that is calling the add group request.

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

lucicop wrote:
Is it possible to synchronize to a request confirmation ? For example, I do APS_AddGroupReq(), but I have many variables that I would like to use in the function that is calling the add group request.

No, it is impossible. Use global variables and unions help to save some space.

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. I read that some function calls are synchronous, though. How can I know which call is synchronous, from the documentation or the code ?

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

lucicop wrote:
Thank you. I read that some function calls are synchronous, though. How can I know which call is synchronous, from the documentation or the code ?

If you can specify callback (such field exists in request) then call is asynchronous. Usually complex functions that require inter-layer interaction implemented in this way.

Simple functions (add entry to table etc) are synchronous.

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 post step-by-step guide along with actual and expected results?

In Configure file I have:
CS_CHANNEL_MASK = "(1l<<0xd)"

In my program I use global variables:
uint32_t channelMask = 0x03CFFF800;
uint32_t aux;

Before calling NetworkStartReq I set:
CS_Write(CS_CHANNEL_MASK, channelMask)

After this I read the channel mask:
CS_Read(CS_CHANNEL_MASK, aux);
printf("Channel_mask = %08lX", aux);

The value read is equal to the one I expect: 0x03CFFF800.

Network starts on channel 16.
This is ok, channel is random as mask covers more channels.

Next I change the CS_CHANNEL_MASK to (1l<<0xc).
I call the LeaveReq and then restart a new PAN.
The COO creates a new PAN on channel 16.
I expected the COO to start a PAN on channel 12.
When I read the Channel_Mask I got got the value:
[(1l<<0xc) | 0x8]

Ater
CS_Write(CS_CHANNEL_MASK, channelMask)
I added the code:
CS_Write(CS_CHANNEL_MASK_ID, (0x1l<<0xc))

and re-run the above scenario.Everything works perfectly meaning:
- I change the CH_CHANNEL_MASK and CS_CHANNEL_MASK_ID to (1l<<0xf)
- I force the COO to leave the PAN by using Leave_Request
- COO creates a new PAN channel 15 (this is what I expected).

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

EGTOGAMAT wrote:

CS_Write(CS_CHANNEL_MASK, channelMask)
CS_Read(CS_CHANNEL_MASK, aux);

You should pass CS_CHANNEL_MASK_ID to these functions. Without _ID you just write and read back to some arbitrary location.

EGTOGAMAT wrote:

When I read the Channel_Mask I got got the value:
[(1l<<0xc) | 0x8]

So first time you have written to location being used by stack and stack changed it.

EGTOGAMAT wrote:

CS_Write(CS_CHANNEL_MASK_ID, (0x1l<<0xc));

This is correct way to set parameters.

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

END_DEVICE_SLEEP_PERIOD = 0 means that coordinator will not check if device is still there and device will not poll for parent ?

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

lucicop wrote:
END_DEVICE_SLEEP_PERIOD = 0 means that coordinator will not check if device is still there and device will not poll for parent ?

No. It is invalid value. minimum reasonable value is 100.

Parent never pools for device, it is device who periodically polls it's parent. Parent only waits to be polled for a END_DEVICE_SLEEP_PERIOD*2 and if device does not show up in this period parent considers it lost and removes it from tables, forgets all data it had for this device.

So this parameters must be set and must be the same on all devices in the network.

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

Damn :) I thought I found the solution to my problem. So what could be done to put Zigbee on a key fob that will probably be missing for long periods from the base station's surroundings ?

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

lucicop wrote:
Damn :) I thought I found the solution to my problem. So what could be done to put Zigbee on a key fob that will probably be missing for long periods from the base station's surroundings ?

What the purpose of fob?

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

In Lowpower sample (stack 1.6) I try to add another int to message structure:

typedef struct
{
AppSensorType_t type;
int16_t value;
int16_t value2;
} PACK AppSensorMessage_t;

When I add its value for sending

appMessageBuffer.msg.report.value2=100;

board is hang while sending message (red LED is on).

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

----------------------------- Uploading SREC to ZigBit module -----------------------------

I'm having a lot of trouble loading the srec file to the ZigBit module.

I use:
- ZigBit 2.4 GHz Amp module
- MAX 232
- bootloader hex and bootloader application from BitCloud 1.6
- USB to serial convertor (FTDI chip)
- windows 7
- latest jre

The usual flow I use for loading the srec file:
- keep the device in reset
- select COM port, file and hit the Upload button
- the message "Please reset device" appears
- after a few seconds I release the reset
A lot of times it says Upload started, nothing happens and then the pop out window with Failure appears.
And sometimes just works one after another write without any problem.
Is there something wrong in the flow?

-------------- Command line option for setting MAC, channel mask and PAN --------------

In a Meshnetics document I noticed another bootloader ( for BitCloud 1.2, written in C# maybe - given the icon) in which the MAC, channel mask and PAN could "written" when firmware is updated.
In the new bootloader MAC, channel mask and PAN id can NOT be set.
What would be a "pratical" solution for writing these values to a batch of devices? (most important the MAC)
I was thinking of the flow:
- write firmware
- start device and let it connect to COO
- send from COO a message which instructs the device to write a given MAC, channel id (as payload of the message)
- flush CS data to eeprom
This will work but it would be nicer to have the command line option.

----------------------------- Bootloader communication protocol -----------------------------

We are now getting closer to deploying ZigBit based devices. I would like to set up another embedded device for updating the firmware in the field.
The only specification I manage to find for the bootloader is the one from BitCloud 1.2: P-ZBN-Serial_Bootloader_Users_Guide.pdf

Is it still the same protocol for communicating with the bootloader?

----------------------------- Fuse access -----------------------------

Can the fuses be burned using the bootloader?
I would like to block JTAG access to all devices. Flash access will be allow for further updates.

Thanks

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

EGTOGAMAT wrote:
- windows 7
Is there something wrong in the flow?

From all of above only win7 was not tested. I'm not blaming it but this may be something to think on.

EGTOGAMAT wrote:
In a Meshnetics document I noticed another bootloader

Can you give a link to this document? I'm not sure I've been at Meshetics that time :)

EGTOGAMAT wrote:

What would be a "pratical" solution for writing these values to a batch of devices? (most important the MAC)

It is a common request and I hope something will be done soon. Now I see two ways:
1. To parameters you need set some distinctive values (0x1234, 0xaabb etc) and find they offsets in final file. Messy way but may work especially if you do not plan to change production firmware too often.
2. Make that blank device (right after programming) will accept only configuration parameters via UART or some other interface and if configured already will just start to work.

The problem here with software update since after update all parameters will be lost. Good way to go would be external EEPROM with parameters stored.

EGTOGAMAT wrote:
Is it still the same protocol for communicating with the bootloader?

I believe it should be. Protocol has not been changed for a long time (if was changed at all).

EGTOGAMAT wrote:

Can the fuses be burned using the bootloader?

No. And I also not sure if fuses can be changed from device at all.

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

code-by wrote:
In Lowpower sample (stack 1.6) I try to add another int to message structure:

I'll check this tomorrow.

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:
EGTOGAMAT wrote:
- windows 7
Is there something wrong in the flow?

From all of above only win7 was not tested. I'm not blaming it but this may be something to think on.

Same problem on Windows XP
I notice that while in reset device sends continuously 0x0. Is this what it should do? Or my hardware configuration might cause this?

alexru wrote:

Can you give a link to this document? I'm not sure I've been at Meshetics that time :)

http://www.meshnetics.com/netcat...(Serial%20Bootloader%20Users%20Guide).pdf

alexru wrote:

It is a common request and I hope something will be done soon.

I hope too as I consider this a major feature.

alexru wrote:

Good way to go would be external EEPROM with parameters stored.

For large projects this is the way we will do it.

alexru wrote:

I believe it should be. Protocol has not been changed for a long time (if was changed at all).

I will give it a try and let you know.

alexru wrote:

And I also not sure if fuses can be changed from device at all.

Not even when loading bootloader hex to device (using PonyProg - I do not have a JTAG)?
I will try to burn the JTAG fuses (so that device will not accept JTAG).

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

EGTOGAMAT wrote:
I notice that while in reset device sends continuously 0x0. Is this what it should do?

No. At reset device should not (and can't actually) send anything. Bootloader also never sends anything without request.
Some interference may cause this. Watch signal at TX pin with oscilloscope to see if signal stable in reset.

The dialog says that parameters are applicable only for eZeeNet (that is first version of ZigBee stack made by MeshNetics, not supported anymore).

EGTOGAMAT wrote:
I hope too as I consider this a major feature.

Request to avr@atmel.com might help a little :)

EGTOGAMAT wrote:
(using PonyProg - I do not have a JTAG)?

PonyProg can program fuses.

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 3 questions regarding the EEPROM access methods (using PDF methods):

1. From what offset should I start writing? (0 I presume)

2. What does the callback function expect from the user? Only when callback is called are the parameters done reading/writting?

3. Can I write for multiple times to same location?

Thanks

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

EGTOGAMAT wrote:
1. From what offset should I start writing? (0 I presume)

That is correct. PDS will calculate actual offset by itself.

EGTOGAMAT wrote:
2. What does the callback function expect from the user? Only when callback is called are the parameters done reading/writting?

After callback is called all data is stored in EEPROM and supplied buffer is free.
You can pass NULL as callback and PDS_*() will be synchronous.

EGTOGAMAT wrote:

3. Can I write for multiple times to same location?

Yes, after callback is called or PDS_WriteData() with NULL callback finished.

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 don't know what it was (bug ?) but after changing int16_t to int8_t it begin to work and work now with int16_t :)

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

code-by wrote:
I don't know what it was (bug ?) but after changing int16_t to int8_t it begin to work and work now with int16_t :)

Possible failure during upload.

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:

What the purpose of fob?

It will be like a car key fob.

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

lucicop wrote:
It will be like a car key fob.

Don't you think that ZigBee is huge overkill in this application?

You may try to join network when button pressed and leave network when car opened but much simpler solution will be to use radio directly and transmit raw packets without any wireless 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

alexru wrote:
code-by wrote:
I don't know what it was (bug ?) but after changing int16_t to int8_t it begin to work and work now with int16_t :)

Possible failure during upload.

I try 5-6 times with some modification of program and it not working, so it coundn't be 5-6 failures uploads...

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

What mean each value in formula
(4ul * batteryControl.batteryData * 125ul * 3ul) / (1024ul * 100ul); ?
// file battery.c //
Why there 1024 while adcParam.resolution = RESOLUTION_8_BIT; ?