Atmel Lightweight Mesh stack

Go To Last Post
566 posts / 0 new

Pages

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

alexru wrote:

In LwMesh it is easier to enable PA manually in PHY_Init() than wait for a release that will support it.

I had a look at module and PA datasheet:

http://www.atmel.com/Images/doc4...
http://www.skyworksinc.com/Produ...

It seems that I have to satisfy table 8. on p. 6 of PA datasheet with CPS, CSD, CTX and n_FEM_SLP(P_C.1 of uC) pins.

Looking at modules datasheet - Internal schematics p. 15:

PA SE2431:

-CPS (21 pin): is allways 1("High") since it is connected to RF_3V

-CSD (20 pin): is logical output from OR gate(U5, NC7SZ32FHX ) -> CTX | n_FEM_SLP

-CTX (24 pin): I'm not sure about this signal (AT86RF230 and BC847PN are involved)

Only thing left (from side of uC which I can control) is n_FEM_SLP pin P_C.1 of uC.

I've digged through BitCloud and found in gpio.h :

#ifdef _HAL_USE_AMPLIFIER_
  // the macros for the manipulation sleep power amplifier
  HAL_ASSIGN_PIN(POW_AMPLF_SLP, C, 1);
#endif

In halSleep.c :

void halPowerOn(const uint8_t wakeupSource)
{
  halSleepControl.wakeupStation = HAL_ACTIVE_MODE;
  halSleepControl.wakeupSource = wakeupSource;

  if (INTERNAL_RC == halGetClockSource())
  {
    GPIO_RF_SLP_TR_clr();
  }
  else
  {
    GPIO_RF_SLP_TR_make_in();
    TCCR2A &= ~((1 << COM2A1) | (1 << COM2A0)); // no compare
    while (ASSR & HAL_ASSR_FLAGS);
  }
  GPIO_RF_SLP_TR_make_out();

#ifdef _HAL_USE_AMPLIFIER_
  // set one on pin. Enable power amplifier.
  GPIO_POW_AMPLF_SLP_set();
#endif

  halPostTask4(HAL_WAKEUP);
}
void halPowerOff(void)
{
  if (HAL_ACTIVE_MODE == halSleepControl.wakeupStation)
    return;  // it is a too late to sleep.

  // stop application timer clock
  halStopAppClock(); // will be shutdown
  if (0ul == halTimeStartOfSleep)
  { // start of sleep procedure
    // save time of stopping of the application timer
    halTimeStartOfSleep = halGetTimeOfSleepTimer();
  }

  /* Shut down a transceiver. This shouldn't be repeated during the MCU
     sleep cycle - halPowerOff can be called periodically. */
  if (HAL_SLEEP_STATE_CONTINUE_SLEEP != halSleepControl.sleepState)
  {
#ifdef _HAL_USE_AMPLIFIER_
    // set zero on pin. Disable power amplifier.
    GPIO_POW_AMPLF_SLP_clr();
#endif

....

So I have to do something similar like this in LW Mesh :

1. PA enabled by default
2. for sleeping nodes - turn OFF PA when going to sleep
3. for sleeping nodes - turn ON PA when waking up

1. PA enabled by default

In phy.c (LW Mesh) I add :

HAL_GPIO_PIN(POW_AMPLF_SLP,C, 1);

void PHY_Init(void)
{
  HAL_PhyReset();
  
  HAL_GPIO_POW_AMPLF_SLP_out();		// make out

  HAL_GPIO_POW_AMPLF_SLP_set();		// turn ON PA	


  phyWriteRegister(TRX_STATE_REG, TRX_CMD_TRX_OFF);
  while (TRX_STATUS_TRX_OFF != (phyReadRegister(TRX_STATUS_REG) & TRX_STATUS_TRX_STATUS_MASK));

  phyWriteRegister(PHY_TX_PWR_REG, (1 << 7)/*TX_AUTO_CRC_ON*/ | 0/* +3 dBm */);

  phyWriteRegister(IRQ_MASK_REG, 0x00);
  phyReadRegister(IRQ_STATUS_REG);
  phyWriteRegister(IRQ_MASK_REG, TRX_END_MASK);

  phyIb.request = PHY_REQ_NONE;
  phyIb.rx = false;
  phyState = PHY_STATE_IDLE;
}

2. for sleeping nodes - turn OFF PA when going to sleep

In phy.c I add :

void PHY_Sleep(void)
{
  HAL_GPIO_POW_AMPLF_SLP_clr();		// turn OFF PA	

  phyTrxSetState(TRX_CMD_TRX_OFF);
  HAL_PhySlpTrSet();
  phyState = PHY_STATE_SLEEP;
}

3. for sleeping nodes - turn ON PA when waking up
In phy.c I add :

void PHY_Wakeup(void)
{
  HAL_GPIO_POW_AMPLF_SLP_set();		// turn ON PA

  HAL_PhySlpTrClear();
  phySetRxState();
  phyState = PHY_STATE_IDLE;
}

So is this the way how it is supposed to be done or am I doing it wrong?

Thank you Alex !

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

Wow. This is messed up. So at86rf230 has no digital outputs to control PA/LNA, so detector on D1 switches between PA/LNA mode based on the fact that radio actually transmits something. So yeah, there is no registers in the radio that you must control, switching just happens automatically.

From what I see your code seems to be perfectly correct.

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

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

Hi Alex,

I think I have found a mistake in "Developer-Guide" as in chapter 4.1.1 and the Figure 4-2 is missing description of third bit (Link Local).

As far I found out, the stack use it only for limiting of broadcast propagation. In other words it is just a user's option to limit broadcasts. Am I right?

Thanks

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

Yes, it was added in the final stages of development and was not documented. It will be documented in the next version that should come out soon.

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

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

Hi !

I have few random questions about LW Mesh.

1. What is the size of message? Is it?

#define NWK_MAX_PAYLOAD_SIZE            (127 - 16/*NwkFrameHeader_t*/ - 2/*crc*/)
#define NWK_MAX_SECURED_PAYLOAD_SIZE    (127 - 16/*NwkFrameHeader_t*/ - 2/*crc*/ - 4/*mic*/)

2. For turning on security, is this all I have to do ?

In config.h :

//#define NWK_ENABLE_SECURITY                     
//#define SYS_SECURITY_MODE             1   // use XTEA mode    

Somewhere in code :

NWK_SetSecurityKey(...);

3. In LW Mesh stack is something written in EEPROM ?

4. In LW Mesh developers guide I don't see anything talking about power/signal strength. I'm using ATZB-A24-UFLB module so I would like to know how to set power/signal strength to desired value ?

5. What does this function do?

PHY_SetRxState(true);

It's name suggests that it sets RF part/chip in RECEIVE STATE.

Do I have to allways use this function ?

What if I put:

PHY_SetRxState(false);

What happens?

Thank you !

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

xtal_88 wrote:
1. What is the size of message? Is it?

#define NWK_MAX_PAYLOAD_SIZE            (127 - 16/*NwkFrameHeader_t*/ - 2/*crc*/)
#define NWK_MAX_SECURED_PAYLOAD_SIZE    (127 - 16/*NwkFrameHeader_t*/ - 2/*crc*/ - 4/*mic*/)

The first one for not secured messages and the second one for secured.

xtal_88 wrote:
2. For turning on security, is this all I have to do ?
In config.h :

//#define NWK_ENABLE_SECURITY                     
//#define SYS_SECURITY_MODE             1   // use XTEA mode    

Somewhere in code :

NWK_SetSecurityKey(...);

You need to uncomment #defines, but otherwise, yes, that is all you need to do.

xtal_88 wrote:
3. In LW Mesh stack is something written in EEPROM ?
No, it is a wireless communication stack.

xtal_88 wrote:
4. In LW Mesh developers guide I don't see anything talking about power/signal strength. I'm using ATZB-A24-UFLB module so I would like to know how to set power/signal strength to desired value ?
In the released SDK, by manually extending PHY API or manually setting desired power in PHY_Init(). In the upcoming release there is PHY_SetTxPower() function.

xtal_88 wrote:
5. What does this function do?
Puts transceiver into TRX_OFF state. It can be useful for battery powered devices that need to perform some calculations before sending the data and don't care about being on the network. For example it can be sleeping device that needs some time to read sensor value before sending it to network.

In general, set it permanently to true. Radio is disabled during sleep automatically, so you don't need to control it manually. I know that current WSNDemo does it, but it is not necessary and it was removed for the upcoming release.

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

Addition: for security you also need to request it: "nwkDataReq.options = NWK_OPT_ENABLE_SECURITY;".

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

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

Thank you Alexru for answers !

Again I have few questions to ask:

1. Can I use following function:

PHY_SetRxState(false);

on routing nodes to disable their routing function for some time for testing purposes?

My goal is to find out how to place nodes to achieve redundant paths. By using this function I would like to find out how good is link(LQI and RSSI) to some end device when I turn OFF TX on R1 and after that turn OFF TX on R2.

 
           -------- R1 -------           
          /                   \
COORDINATOR                    ED1
          \                   /
           -------- R2 -------

2. Does it make sence to let's say build network topology on routing records?
Like comparing BitCloud with LW Mesh, in BitCloud there is

ZDO_GetNeibTable()

There is nothing similar in LW Mesh.

3. In network I have moving nodes and e.g. one moving node is present in one part of network(in reach of "COORDINATOR") and other nodes in that part of network have this node in their routing table. Now
moving node moves to other part of network(NOT in reach of "COORDINATOR" ) and other nodes in that part don't have it in their routing table.

What happens if I send data to this moving node from COORDINATOR ?

Message is stuck in part of network which has moving node in it's routing table records?

It's more question about routing algorithm, hope you understand what I'm trying to ask.

4. Is in LW Mesh implemented CSMA/CA algorithm, because I would like to send a BROADCAST messages and I await responces form nodes?

5. Do I have to manually disable NWK_OPT_ACK_REQUEST when I send BROADCAT message or it is disabled dy default because of broadcast address 0xFFFF?

Thank you once again!

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

xtal_88 wrote:
1. Can I use following function:

PHY_SetRxState(false);

on routing nodes to disable their routing function for some time for testing purposes?


Yes, you can.

xtal_88 wrote:
2. Does it make sence to let's say build network topology on routing records?
Like comparing BitCloud with LW Mesh, in BitCloud there is

ZDO_GetNeibTable()

There is nothing similar in LW Mesh.

There is no direct analog of neighbor table, because it is not needed by the stack, but there is routing table, which currently can be reached with some hacking of the code and will be accessible though the API in the next version.

But correct way of achieving the same functionality (and even better) is to write some application code to do this. In BitCloud neighbor table is built based on the Link Status messages routers send every 15 seconds. You should do the same - send a local broadcast message very 15 seconds (or however often you like tbales to be updated) and receive this message on the other nodes and build tables based on the received info.

xtal_88 wrote:
What happens if I send data to this moving node from COORDINATOR ?
Few delivery attempts will be made (see NWK_ROUTE_DEFAULT_SCORE) and the route will be re-discovered.

xtal_88 wrote:
4. Is in LW Mesh implemented CSMA/CA algorithm, because I would like to send a BROADCAST messages and I await responces form nodes?
LwMesh uses CSMA/CA. But depending on how many nodes do you have in one place you might want to delay responses by a random time from the application.

xtal_88 wrote:
5. Do I have to manually disable NWK_OPT_ACK_REQUEST when I send BROADCAT message or it is disabled dy default because of broadcast address 0xFFFF?
Yes, you do. It might work if you don't, but it is not guaranteed to be this way in future version.

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

Thanks Alex !

Few questions came to my mind:

1. In LW Mesh datasheet is stated that:

An application running Lightweight Mesh is responsible for:

Advanced network operation scenarios (sleeping routers, parent-child relationship, data delivery to the sleeping nodes, etc)

So there is no POLLING mechanism like in BitCloud.

Is there going to be something slimiar to POLLING technique in future releases of LW Mesh since in new release there is API for neighbor/routing table?

When sending BROADCAST message there are NO retries(deliveries to sleeping NODEs), which nodes are awake they receive BROADCAST and send it further(in case or routers) and that's it ?

2. Suppose I have situation like this :

   -------- R1 -------	
  /                   \ 
C                      ED1 
  \                   /
   -------- R2 -------

C sends message to ED1 and on ED1 I look at LQI and RSSI of the received frame.

How can I know if message came through R1 or R2 ?

Do I have to disable routing on e.g. R1 with

PHY_SetRxState(false); 

and that way I know that message to ED1 was delivered through R2 or there is some other way?

3. Can I use stack functions(in comment) like this (in int main()):

int main(void)
{
	SYS_Init();
	HAL_UartInit(38400);
	
	
	//HAL_GPIO_LED_set();
	//HAL_GPIO_DEFAULT_read();

	//Timer.interval = 3000;
	//Timer.mode = SYS_TIMER_INTERVAL_MODE;
	//Timer.handler = TimerHandler;
	//SYS_TimerStart(&Timer);	

	while (1)
	{
		SYS_TaskHandler();
		  
		HAL_UartTaskHandler(); 
		  
		APP_TaskHandler();
	}
}

Functions(commented) are used before while(1) loop which is main thing in app?

Thank you !

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

1. No, there won't be anything like this. There is API for the routing table, but polling is not needed for maintaining the routing table. In fact this API is already there from the first release, it is just not public. Polling can be implemented on the application layer and hence it will not be in the stack.

Yes, there is no retries, whoever was listening at a time will receive a message, others will miss it.

2. There is no way to know how the frame was received. If you need to test something, then disable one of the routers. Disabling a receiver is one way of doing it.

3. For provided functions it is fine and it should be fine for majority of APIs, but I can not guarantee that it will work for everything..

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

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

Hi Alex,
I am facing another weird situation. I have tried many scenarios including two simultaneous sending nodes and one receiver - gateway. Packets are sent with no delay - after the previous was successfully sent out.
Each test was successfully done except the case when

appDataReq.options = NWK_OPT_ENABLE_SECURITY | NWK_OPT_ACK_REQUEST

. After receiving say 200 or 400 packets the gateway stuck on while loop in the function HAL_PhySpiWriteByteInline in halPhy.h waiting for the SPIF flag. No matter how big the message was (I have tried 1 to 105 B data payload). I am using IRIS motes (ATmega1281+RF230).

Do you know how to avoid this state please?

PS: Link to download software stack v1.1.0 doesn’t work.

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

This looks like a hardware problem. Can you trace where exactly in the code HAL_PhySpiWriteByteInline() that gets locked is located?

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:
This looks like a hardware problem.

I have tried today another module (Zigbit) and it behaves in the same way.

Quote:
Can you trace where exactly in the code HAL_PhySpiWriteByteInline() that gets locked is located?

As the problem occures after a few hundered of packets it is hard to follow debugging. I have tried to place Tracepoint to get the caller but there are too many calls and the program couldn't run normally. Can you suggest me the way to debug this please?

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

You can try to get the address of the place where it loops and match it to the code later using avr-objdump.

Or AS will probably show where it is locates right in the disassembly window. Just look at the surrounding 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

LwMesh version 1.1.0 is now public. Among other improvements it includes support for AODV routing and multicast messaging.

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 all!

I'm using ATZB-A24-UFLR and ATZB-A24-UFLB(when they'll be available on market).

I have question about PHY_SetTxPower() function.

This function takes only one parameter and that is uint8_t txPower.

Datasheet of AT86rf230 p. 59-60 says about txPower and it's values, so it can be 0x00-0x0F.

Datasheet of ATZB-A24-UFLB p. 8 says:

USA
Register Value Power Register Setting [dBm] Output Power [dBm] (at antenna feed) 
11 -5.2 +20 
12 -7.2 +18 
13 -9.2 +16 
14 -12.2 +12 
15 -17.2 +7 

European Union
15 -17.2 +7 

Are only these values allowed for ATZB-A24-UFLB ?

What about old ATZB-A24-UFLR ?

Can I set txPower = 0x00 ?

Regards !

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

According to this table amplifier gives +25 dB, so if you set 0, you should get +28 dBm output, that is almost a legal limit, and distortions are probably way too high for this thing to work.

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!

Quote:
What about old ATZB-A24-UFLR ?

Some time ago, I tried to measure output power of ATZB-A24-UFLR modules and this was the results (I set up a very simple testbed and I measured only one module):

Register_Value Output_Power(dBm at Antenna Feed)
0x0F 10.1
0x0E 13.3
0x0D 15.1
0x0C 16.5
0x0B 17.1
0x0A 17.9
0x09 18.5
0x08 19.0
0x07 19.3
0x06 19.6
0x05 19.8
0x04 19.8
0x03 20.1
0x02 20.1
0x01 20.2
0x00 20.5

Acording to this thread:
https://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=117362&highlight=amplifier
it could be possible to disable the module's amplifier and get less output power, but, after many attemps, I didn´t manage to disable it...

Regards,

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

Yes, this looks about right. Because of distortion, all energy goes to higher harmonics, breaking FCC rules.

It is possible to disable the amplifier in case of BitCloud - just use non-amp version of the stack. It is harder to do dynamically.

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 !

Today I received ATZB-A24_UFLB new modules.

I currently working on old ones, ATZB-A24_UFLR.

Here (2nd post):

https://www.avrfreaks.net/index.p...

discussion was about how to enable PA on LW Mesh on old module (it's about pin c1 of uC).

This whole time I was experimenting with nodes on my desk (0.5m distance) and everything's OK.

But when I put one node on wall (to be door sensor, 3m away) it doesn't work.
Seems to me that PA is not properly turned ON or something else is wrong.

I don't have internal schematics of old ATZB-A24_UFLR module. Whole discussion mentioned above was based on schematics of new modeule.

I don't know if something else needs to be done to enable PA on old module on LW Mesh and how it is supposed to be done correctly.

Basicaly my questions again are:

How to enable PA on LW Mesh on ATZB-A24_UFLR and ATZB-A24_UFLB module ?

Thank you !

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

Your code still looks correct. Try to set TX power to a value from the recommended range. Or just set minimum (0x0f) - it still should be better that non-amplified module.

Combination of public ATZB-A24_UFLB schematic and BitCloud code that was written for ATZB-A24_UFLR tells me that they use exact same design, so modules should be compatible (and I would be surprised if they were not).

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

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

Hi Alex !

I haven't made any progress yet.

I uploaded BitCloud version which worked OK and thing is the same (communication doesn't work more then 1m).

I've removed setting PC.1 form phy.c and set it on application level, in main() actually, like this:

HAL_GPIO_PIN(POW_AMPLF_SLP,C, 1);

int main(void)
{
		
	HAL_GPIO_POW_AMPLF_SLP_out();      // make out
	HAL_GPIO_POW_AMPLF_SLP_set();      // turn ON PA
	
	
	SYS_Init();
	HAL_UartInit(38400);

	while (1)
	{
		SYS_TaskHandler();
		  
		HAL_UartTaskHandler(); 
		  
		APP_TaskHandler();
	}
}

I haven't cleared this pin, so PA should be turned ON all the time. Everything is the same.

I also tried to put PHY_SetTxPower(0x0F); as you suggested, nothing changed.

I don't know if PC.1 is OK. How can I check that ?

You said that PA switches from TX to RX state and vice versa automatically, so all I have to do is set PC.1 and that's it, right?

Thank you once again !

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

Yes, at this point I'd start checking your entire design for noise and other sources of interference. Also check your antenna connection. PC1 is the right pin, that's what BitCloud does and that's what schematic says.

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 kind of antenna 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

alexru wrote:
Yes, at this point I'd start checking your entire design for noise and other sources of interference. Also check your antenna connection. PC1 is the right pin, that's what BitCloud does and that's what schematic says.

OK, I'll do that.

alexru wrote:
What kind of antenna do you use?

I use 5.5 dBi antenna, something like this:
http://uk.rs-online.com/web/p/wi...|cav

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

Hi Alex!

First of all, thanks for your inestimable assistance.

alexru wrote:
It is possible to disable the amplifier in case of BitCloud - just use non-amp version of the stack. It is harder to do dynamically.

Finally I had time to go to the lab and make a test using the non-amp version of BitCloud on an ATZB-A24-UFLR module, but without any success. Again, I measured an output power at antenna feed between 10 and 20 dBm.

I tried to enable/disable PA and LNA through PORTC1, as you said in other thread (and such as the BitCloud stack does), but I didn't see any change in the output power.

Regards,

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

Hi xtal_88!

xtal_88 wrote:
I use 5.5 dBi antenna, something like this:

Although it might seem a platitude, did you check U.FL/SMA cable polarity againts antenna polarity (female/female)? At 0.5 m modules can communicate through the U.FL connector (without antenna).

In my case, I don´t manage to *disable* the amplification of the ATZB-A24-UFLR modules, it is always on.

Regards,

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

Thanks Alexru and rober !

Problem solved.

Pigtail on my Router didn't have connection and Coordinator's PA doesn't work.

I don't know why PA doesn't work, at first I didn't enabled PA, and everything worked OK(but only on short distances), maybe this could be the reason?

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

I don't understand your description of what does/did not work.

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:
I don't understand your description of what does/did not work.

OK, sorry for bad description.

2 nodes are involved C and R(on both PC.1 is set).

Pigtail on R didn't have connection, so I had only module without antenna.

With sniffer(RSSI value, if I can relay on that) I found out that signal form C is very low/weak, so I suppose PA or/and AT86RF230 is not OK.

I can receive signal on C from R, but I don't receive signal on R form C.

----------------------------

Now I have new module ATZB-A24-UFLB which is now C.

Everything works now : this new C and old R(with new pigtail of course, PC.1 set of course).

----------------------------

At first I used C(ATZB-A24-UFLR and did not set PC.1, so without PA) and was experimenting with RBC-128-RFA1 and it was OK on short distance.

Maybe something went wrong because I didn't turn ON PA during this experimenting.

More or less that's it. Hope you understand me better now.

Thnx, Alex !

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

It looks like a hardware issue, maybe module was damaged somehow.

Anyway, I'm glad it works now.

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

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

Hi Alex,

I am still facing the problem with stucking on HAL_PhySpiWriteByteInline function as posted a month ago.

vladacr wrote:
I have tried many scenarios including two simultaneous sending nodes and one receiver - gateway. Packets are sent with no delay - after the previous was successfully sent out.
Each test was successfully done except the case when
appDataReq.options = NWK_OPT_ENABLE_SECURITY | NWK_OPT_ACK_REQUEST

. After receiving say 200 or 400 packets the gateway stuck on while loop in the function HAL_PhySpiWriteByteInline in halPhy.h waiting for the SPIF flag. No matter how big the message was (I have tried 1 to 105 B data payload). I am using IRIS motes (ATmega1281+RF230).

Do you have any suggestions how to solve it?

Here is a print of disassembly view:
http://goo.gl/lMsRCj

Thank you.

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

It is impossible to tell anything from this screenshot. You need to set this bit manually in the debugger, to let this function exit and see where it is called from. I need to know what stack is doing when this happens and that function is called from multiple places.

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

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

Hi Alex,

I have been playing with the ATZB-24-A2 module. I have used it on a breakout board from Scott Schmit at Digikey. I used it with the LWM stack. I followed your video, “How to Develop Custom Applications Using the Light Weight Mesh”. It works great, thank you for posting it.
I have more of a hardware background so I have some basic questions regarding the code. I changed your code to transmit data for multiple sensors by just changing multiple bits in the uint8 variable you are sending. What would you recommend doing if I wanted to expend this to multiple units and more data? Would you recommend sending multiple 8 bit words, Should I come up with some sort of packet structure?
I would also like to be able to talk to the controller from other devices via a network. I was looking at your application note, AT03755 about a low cost gateway. It seems that sending characters versus other kind of variables (like an array or a structure) would make the application work over the network better, it would make it more portable.

BR

Arpad

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

arpadthetall wrote:
I changed your code to transmit data for multiple sensors by just changing multiple bits in the uint8 variable you are sending. What would you recommend doing if I wanted to expend this to multiple units and more data?
Just add more variables of any types you like to the same structure. You have 109 bytes that can fit into one frame.

arpadthetall wrote:
It seems that sending characters versus other kind of variables (like an array or a structure) would make the application work over the network better, it would make it more portable.
In that application note I used ASCII characters for Ethernet communication, because protocol was designed to be unified and there is a plan to run embedded web-server, so requests will be coming via HTTP, which only supports text. Wireless protocol is still binary.

Text-based protocols are a pain to decode and encode, binary is much easier, so if there is no limitation, I'd pick binary.

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 (spasibo) for the quick response. Five star service.

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

Hi Alex,

I have recently started using Lightweight Mesh stack and am facing some problems. I would really appreciate some help. My scenario is:

I have 2 ATMEGA256RFR2 Xplained Pro Boards.

I am trying to Broadcast messages. Both the boards are Broadcasting successfully.

I don't require any routing or security.

My scenario would further include other nodes that would also be broadcasting a frame including some random value.

I am using RSSI value to measure how close the nodes are but I guess it's not an accurate method. Any suggestions on this would be really helpful.

The problem is that after sometime they suddenly stop broadcasting. I have a counter for the number of frames received and it goes to a few thousands and then stops.

I checked the debugger and it was stuck in the below section:

static inline void phyTrxSetState(uint8_t state)
{
  TRX_STATE_REG = TRX_CMD_FORCE_TRX_OFF;
  while (TRX_STATUS_TRX_OFF!=TRX_STATUS_REG_s.trxStatus);

  TRX_STATE_REG = state;
  while (state != TRX_STATUS_REG_s.trxStatus);
}

I changed it as you said in your post:

static inline void phyTrxSetState(uint8_t state) 
{ 
  ATOMIC_SECTION_ENTER 
    TRX_STATE_REG = TRX_CMD_FORCE_TRX_OFF; 
    TRX_STATE_REG = state; 
    while (state != TRX_STATUS_REG_s.trxStatus); 
  ATOMIC_SECTION_LEAVE 
}

The problem is still there. However the code doesn't stop in the above section it keeps on running normally but the following callback is never called :

static bool appDataInd(NWK_DataInd_t *ind)
{
	frameCounter++;
	ltoa(frameCounter , count,	10);
	for (i=0; i

Here is how I am sending the frame:

static void appSendMessage(uint8_t state)
{
	appMessage.buttonState = state;	
	appNwkDataReq.dstAddr = NWK_BROADCAST_ADDR;
	appNwkDataReq.dstEndpoint = APP_ENDPOINT;
	appNwkDataReq.srcEndpoint = APP_ENDPOINT;
	appNwkDataReq.data = (uint8_t *)&appMessage;
	appNwkDataReq.size = sizeof(appMessage);
	appNwkDataReq.confirm = appDataConf;
	NWK_DataReq(&appNwkDataReq);
	appState = APP_STATE_WAIT_CONF;
}

And config.h :

#define APP_ADDR             boot_signature_byte_get(1)
#define APP_PANID            NWK_BROADCAST_PANID
#define APP_ENDPOINT         1
#define APP_CHANNEL	     0x0f

#define HAL_UART_CHANNEL          1
#define HAL_UART_RX_FIFO_SIZE     200
#define HAL_UART_TX_FIFO_SIZE     200

#define NWK_BUFFERS_AMOUNT                  10
#define NWK_DUPLICATE_REJECTION_TABLE_SIZE  50
#define NWK_DUPLICATE_REJECTION_TTL         2000 // ms
#define NWK_ROUTE_TABLE_SIZE                100
#define NWK_ROUTE_DEFAULT_SCORE             3
#define NWK_ACK_WAIT_TIME                   1000 // ms
#define NWK_GROUPS_AMOUNT                   3
#define NWK_ROUTE_DISCOVERY_TABLE_SIZE      5
#define NWK_ROUTE_DISCOVERY_TIMEOUT         1000 //ms

As you can see It's pretty simple and straightforward, I don't get why does is stops broadcasting :(

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

Where do you call appSendMessage() from? Are you sure it can not be called the second time before appDataConf() is called for the first request?

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

appSendMessage() is always called after appDataConf()

Here's the relevant code:

switch (appState)
  {
	  case APP_STATE_INITIAL:
	  {
		NWK_SetAddr(APP_ADDR);
		NWK_SetPanId(APP_PANID);
		PHY_SetChannel(APP_CHANNEL);
		PHY_SetRxState(true);	
             NWK_OpenEndpoint(APP_ENDPOINT,appDataInd); 
		appState = APP_STATE_IDLE;		
	  } break;

	  case APP_STATE_IDLE:
	  {
		appSendMessage(appButtonState);
	  } break;

	  case APP_STATE_WAIT_CONF:
	  break;
	 
  }

and appDataConf()...

static void appDataConf(NWK_DataReq_t *req)
{
	appState = APP_STATE_IDLE;
	(void)req;
}
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In this case I'd run it under the debugger and look at each buffer state in the nwkFrameFrames variable (located in nwkFrame.c). This might tell more.

Also, try to find out where it loops.

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

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

I have a simple LwMesh program that uses a poll/response application layer. A non-routing master node continuously polls 10 remote routing nodes (some remote nodes might be too far away to directly communicate with the master). When the remote node receives a poll it sends a response back to the master. My question is should I add some delay at the application layer on the master node between receiving a response and sending out the next poll. Do I need to have a bit of "dead air time" to prevent collisions between the master's next poll and any re-transmissions from the routing nodes? If I do need this dead air time what value should I use and should I add dead air time on the remote node between receiving a poll and sending back a response?

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

There is no specific reason why you would need a delay between the polls. But if your application allows longer poll intervals, I'd add the delay, just to reduce potential interference for other networks. Again, it is not required, just a way to be nice to others.

There is no need for delay between the request and response, it won't help anything.

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 for a node or router to choose which network to join if more then one exist on a chanel.

I just downloaded the stack, is there more information on the other examples apart from wsn?

Where and how can I modify the a 1281 project so that a 1284P can work?

Thanks

Regards

DJ

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

There is not joining or network discovery in the stack itself. You tell it which PAN ID to use and how you know it is up to you.

Network discovery will be implemented as an application service, but it is currently under development, so it won't be out for sometime.

Applications are very simple, just read though them.

Getting started guide talks about what HAL files are required for what platform. You will need to create your own HAL for m1284p and change MCU type in the project settings.

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 does that mean when switch on a device, your in the network?

I noticed that even nodes can send message directly to another node, without even a router or cord as it was in bitcloud.

Then what is the purpose Router, is nodes can sleep while routers can't?

Once I get my RF230 to work with M1284P, am I correct I can switch to RF231 with easy?

Thanks

Regards

DJ

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

djoshi wrote:
So does that mean when switch on a device, your in the network?
Yes. You set PAN ID, address, channel, security key.

djoshi wrote:
I noticed that even nodes can send message directly to another node, without even a router or cord as it was in bitcloud.
Correct, you don't need a coordinator in LwMesh.

djoshi wrote:
Then what is the purpose Router, is nodes can sleep while routers can't?
Non-routing nodes are never selected as a next hop for routing purpose. They may sleep, or may stay awake, stack won't care either way.

djoshi wrote:
Once I get my RF230 to work with M1284P, am I correct I can switch to RF231 with easy?
Yes, just switch PHYs.

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 see some WSN examples in the docs but not on the other examples

Thanks

Regards

DJ

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

There is no documentation for all applications. Most of them are self-explanatory.

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

Well I think I will stick to WSN, as bitcloud use this so my other application should notice no difference, plus I can use WSN a debug tool as well.

Thanks Alex.

Thanks

Regards

DJ

Pages