LW_Mesh on deRFmega128-22M12

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

Hi!

can deRFmega128-22M12 be ran on newest LW_Mesh ?

I mean there is WSNDemo app. but for Rbc128rfa1, so can I use it and adopt it to my needs?

This module has PA and according to datasheet
http://www.dresden-elektronik.de/funktechnik/products/radio-modules/oem-modules-derfmega/description/?L=1&eID=dam_frontend_push&docID=1250
I need to implement mechanism to control it.
I've done this for ATZB24-ufrl module, so something similar needs to be done here.

It shouldn't be too much effort, right?

Has anybody done this maybe?

Thank you !

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

I don't see why there could be any problems at all. Just configure PA in PHY_Init() and possibly switch it off in PHY_Sleep() and enable back in PHY_Wakeup().

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 see why there could be any problems at all. Just configure PA in PHY_Init() and possibly switch it off in PHY_Sleep() and enable back in PHY_Wakeup().

Thnx Alex !

Apart from that I need to control PA chip described in picture.

I don't plan to use 2 antennas only e.g. RFout 1.

So, it doesn't matter where I put this code, right?

HAL_GPIO_PIN(ANTENNA1, G, 1);

HAL_GPIO_ANTENNA1_out();
HAL_GPIO_Antenna1_clr();

What concerns me more are RX LNA and TX modes of work.

I need to do something similar as above with PD6 and PG0.

For the most time module should be in RX LNA - receive mode.

I think that this state should be set in:
1) at application start - in main() maybe

2) after module wakes up - that is in PHY_Wakeup() function

3) immediately after the frame is sent - I don't know where?

TX mode is only used when sending frame both form:
1) application level
2) stack (routing frames)

Where should I place code to activate TX mode?

Thank you !

Attachment(s): 

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

The code for HAL_GPIO_ANTENNA1_xxx() is not going to be used at all here. It is used for Xplained PRO boards to switch to on-board antenna instead of using antenna diversity.

You need to read about TRX_CTRL_1 register and PA_EXT_EN bit there. Radio will do the rest.

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 !

alexru wrote:

You need to read about TRX_CTRL_1 register and PA_EXT_EN bit there. Radio will do the rest.

OK, I've read that, but not all is clear to me.

alexru wrote:
The code for HAL_GPIO_ANTENNA1_xxx() is not going to be used at all here. It is used for Xplained PRO boards to switch to on-board antenna instead of using antenna diversity.

So, by deRFmega128-22M12 I'm using antenna diversity or not ?

It seems to me that pins DIG1-DIG4 are internally controlled to drive PA and user doesn't have to deal with that.

But why they gave whole page in datasheet about this and pin PD6 is involved in?

I'm still not sure what I have to do actually...

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

xtal_88 wrote:
So, by deRFmega128-22M12 I'm using antenna diversity or not ?
According to the block diagram from two posts back, both PA/LNA and and Antenna Diversity are used on the module.

xtal_88 wrote:
It seems to me that pins DIG1-DIG4 are internally controlled to drive PA and user doesn't have to deal with that.
Yes, after you go and tell the transceiver to control them, it will do so.

xtal_88 wrote:
But why they gave whole page in datasheet about this and pin PD6 is involved in?
Because when radio goes to sleep PA/LNA will remain in the same state as it was a moment before sleep and will consume extra current. Radio has no intelligence to know what to do with the external circuitry when it goes to sleep.

If you are not concerned with current consumption, then just configure radio to drive DIG1-4 and stick PD6 to "on" level, whatever it happens to be.

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 so far !

I'm going to use only one antenna. Unsued antenna I'm going to pull to GND by 50 Ohm resistor.

Can I use antenna diversity even if only one antenna is used?

My plan is like this:

Before while() loop in main() : enable PA and antenna diversity

int main(void)
{
	SYS_Init();

	HAL_GPIO_PA_ON_out();		// PD6 pin used to contorl PA 
	HAL_GPIO_PA_ON_set();		// PD6 set	
	
	TRX_CTRL_1 |= (1<<PA_EXT_EN);		// External PA support enable  ON	

	ANT_DIV |= (1<<ANT_DIV_EN) | (1<<ANT_EXT_SW_EN); 	// enable antena diversity

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

sleep code: disable PA and antenna diversity before going to sleep and enable them immediately after wake up

	if ( !NWK_Busy())
	{
		ANT_DIV &=  ~((1<<ANT_DIV_EN) | (1<<ANT_EXT_SW_EN)); 	// disable antena diversity
		TRX_CTRL_1 &=  ~(1<<PA_EXT_EN);		// External PA support enable OFF	
		HAL_GPIO_PA_ON_clr();			// PD6 clear	
							
		NWK_SleepReq();
		HAL_Sleep( (uint32_t)(sleep_period));
		NWK_WakeupReq();
		
		HAL_GPIO_PA_ON_set();		// PD6 set	
		TRX_CTRL_1 |= (1<<PA_EXT_EN);		// External PA support enable  ON	
		ANT_DIV |= (1<<ANT_DIV_EN) | (1<<ANT_EXT_SW_EN); 	// enable antena diversity
	
	}

Is this OK?

I don't have to worry about ANT_SEL bit in ANT_DIV register, hardware does this ?

Thanks again Alex !

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

Yes, this looks correct. And you don't need to worry about ANT_SEL unless you want to use a particular antenna.

Quote:
Can I use antenna diversity even if only one antenna is used?
Technically, nothing will stop you from doing that, but there is really no reason to do so. Just disable AD and select whatever antenna you want to use.

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

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

OK Alex,

if I can go with code above, but I'm still not quiet sure.

As you said AD is disabled, there is no (1<<ANT_DIV_EN).

What does ANT_SEL bit in ANT_DIV register do?

In picture above RF port is controlled by DIG1 pin. But since this is read bit only, I can't select desired RF port with ANT_SEL, right?

I think it should be :

ANT_DIV |=  (1<<ANT_EXT_SW_EN) | (1<<ANT_CTRL_1) ;    

for ANTENNA 0

or

ANT_DIV |=  (1<<ANT_EXT_SW_EN) | (1<<ANT_CTRL_0) ;    

for ANTENNA 1.

What concerns me is(from datasheet p.116) :

Quote:
Do not enable Antenna Diversity RF switch control (ANT_EXT_SW_EN = 1) and RX Frame Time Stamping (IRQ_2_EXT_EN = 1, see register TRX_CTRL_1) at the same time.

Does LW_mesh use this IRQ_2_EXT_EN bit ?

ATmega128RFA1 datasheet p.116

Attachment(s): 

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

xtal_88 wrote:
As you said AD is disabled, there is no (1<<ANT_DIV_EN).
My bad, I meant ANT_CTRL bits. The point is to select one antenna.

xtal_88 wrote:
Does LW_mesh use this IRQ_2_EXT_EN bit ?
No, it does not.

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