Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
toki78
PostPosted: Feb 07, 2012 - 03:55 PM
Newbie


Joined: Feb 07, 2012
Posts: 2


Hi,
can anyone extend my program to a minimal setup
for monitoring frames ? At the moment it is sufficient
to catch at least 1 arbitrary frame.
I use STK600 and atmega128RFA1.

Code:

#include <avr/io.h>
#include <avr/interrupt.h>

ISR(TRX24_RX_END_vect){
   PORTB = 0xff;
   reti();
}

int main(void)
{
   DDRB = 0xff;
   IRQ_MASK = 1 << RX_END;
   TRX_STATE = TRX_OFF;
   
   sei();
   
    while(1)
    {
    }
}


Best Regards
Thorsten
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Feb 07, 2012 - 04:14 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4870
Location: San Jose, CA

You need at least:
1. Set channel.
2. Enable promiscuous mode or set addressing information.
3. Switch to one of RX modes.

There is no need to put reti() at the end of ISR(). Compiler will take care of this.

_________________
The opinions and views expressed by me on this forum are my own and do not represent my employer or anyone else that I’m affiliated with.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
toki78
PostPosted: Feb 07, 2012 - 04:45 PM
Newbie


Joined: Feb 07, 2012
Posts: 2


Thanks,
now my program looks like this :
Code:

/*
 * AVRGCC4.c
 *
 * Created: 07.02.2012 15:41:43
 *  Author: thorsten
 */

#include <avr/io.h>
#include <avr/interrupt.h>

ISR(TRX24_RX_END_vect){
   PORTB = 0xff;
}

int main(void)
{
   DDRB = 0xff;
   PHY_CC_CCA = 12 << CHANNEL0;
   XAH_CTRL_1 = 1 << AACK_PROM_MODE;
   TRX_STATE = 0x06 << TRX_CMD0;
   IRQ_MASK = 1 << RX_END;
   
   sei();
   
    while(1)
    {
    }
}


Still no reaction.
Can it capture 802.11 frames, too ?

Regards
Thorsten
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Feb 07, 2012 - 04:55 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4870
Location: San Jose, CA

It looks like promiscuous mode is only enabled for RX_AACK mode. Don't forget to disable ACKs in CSMA_SEED_1.

What is your source of frames? And what is your final goal?

This approach will allow you to implement a sniffer-like device, but is not usable for communications.

_________________
The opinions and views expressed by me on this forum are my own and do not represent my employer or anyone else that I’m affiliated with.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
dak664
PostPosted: Feb 07, 2012 - 08:58 PM
Posting Freak


Joined: Jun 15, 2008
Posts: 1762
Location: North Carolina USA

That 0x06 command looks like RX_ON which is promiscuous by default I think. But I am not sure it will respond to any PAN in that mode. RX_AACK_ON is 22, and if you search for sniffer in the data sheet it tells how the other address registers have to be configured.
You may be fooling yourself that one packet was received. At a mimimum read the rssi and frame length, and back in foregound you can dump the frame in a wireshark import format if you have a serial link:
Code:

ISR(TRX24_RX_END_vect)
   uint8_t frame_length, last_rssi,*rx_data,*rx_buffer;
   last_rssi=hal_register_read(RG_PHY_ED_LEVEL);
   frame_length =  TST_RX_LENGTH;  //frame length, not including lqi
    rx_buffer=(uint8_t *)0x180;  //start of fifo in i/o space
    rx_data = &mybuffer;
    do{
        *rx_data++ = _SFR_MEM8(rx_buffer++);
    } while (--frame_length > 0);
 
 View user's profile Send private message  
Reply with quote Back to top
uracolix
PostPosted: Feb 08, 2012 - 09:05 AM
Hangaround


Joined: Jun 17, 2008
Posts: 454
Location: Meissen, Germany

>Still no reaction.
Check if you are really in state RX_ON (TRX24_STATUS).
Check if you get a PLL lock IRQ. In order to verify your
programm, just run a periodic frame transmission on another
board. Feel free to checkout uracoli.nongnu.org, the project provides the basic functions to control the
Atmel transceivers with examples.

>Can it capture 802.11 frames, too ?
No way this way. But you can measure ED or RSSI
in state RX_ON. The ED measurement averages several RSSI values so it gives better results. With ED = 0 after a measurement it means that the receveived input power is at or below -90dBm.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
dl8dtl
PostPosted: Feb 08, 2012 - 09:13 AM
Raving lunatic


Joined: Dec 20, 2002
Posts: 7277
Location: Dresden, Germany

> That 0x06 command looks like RX_ON which is promiscuous by default I think.

Exactly. In RX_ON mode, *any* frame is going to be received,
regardless of its addressing information (which can be completely
absent or not conforming to the IEEE 802.15.4 MAC addressing
conventions), and regardless of FCS failures.

_________________
Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.
Please read the `General information...' article before.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
Tron[ic]
PostPosted: Feb 08, 2012 - 07:43 PM
Hangaround


Joined: Oct 25, 2011
Posts: 249
Location: Brussels, Belgium

Quote:

while (--frame_length > 0);


Totally offtopic and maybe a silly question but I wonder where "--" before frame_length stands for.
I couldn't find it on google and I am still a novice with C++
 
 View user's profile Send private message  
Reply with quote Back to top
dak664
PostPosted: Feb 08, 2012 - 11:23 PM
Posting Freak


Joined: Jun 15, 2008
Posts: 1762
Location: North Carolina USA

Its a predecrement, equivalent to frame_length = frame_length -1 before the test. frame_length-- would do the decrement after the test.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits