AT86RF230 code examples....

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

Hi ppl...

I've got the sample code from page two of this thread working...
[url]https://www.avrfreaks.net/index.p...

However, I'm having trouble porting the code from AVR2001: Software programmers guide....
I using an ATMEGA128...

I'm hoping someone can share some example code for the AT86RF230 ....
Just simple stuff, I'm not looking for a zigbee stack...

Thanks!!
Michael

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

e.g. http://uracoli.nongnu.org/, it provides basic access routines for AT86RF2xx.
Some simple examples are here http://uracoli.nongnu.org/manual...

Regards Axel

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

Thanks, that's exactly what I was looking for...
Oddly, I had been on your website a few times looking at the hardware but I missed the software...

We have got the code ported to our hardware...
However, we seem to be having the same problem as we had with the AVR2001 library code...

Here is the message from my friend who is working on this project with me...

------------
Sniffer 0.01 [todm128]

FATAL ERROR: TRX not in state TRX_OFF [0x04]
-------------
0x04 is the returned value of  val = trx_reg_read(RG_TRX_STATUS);

which is in the TRX Init. Exact same place as last night. Basically something doesn't happen when we try to boot into TRX_OFF mode....

Which is basically the chip is on, but we can't turn on the radio transceiver... 

Any suggestions? Thanks!

Michael

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

Hi again...

We have traced the problem to the timer...

The LED and UART example code works...
But anything with a timer doesn't...

Our board is a MEGA128 running at 16MHz...
Where as the other boards defined are at 8Mhz..
The AT86RF230(b) is level shifted and running off 3.3v from an FTDI232RL ...

Timer setup is:
TCCR3B |= (_BV(CS31) | _BV(WGM32));
ETIMSK |= _BV(OCIE3A);
OCR3A = 2000;

And I've tested that and it works...

Any suggestions ??

Thanks!
Michael

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

I think we got it running....
After setting the M128 clock down to 8MHz...

Will run some tests and see what's up...
Unfortunately, both of us working on this project only have one PCB each and we are about an hour apart...

I will have to solder a few more...

Thanks!!
Michael

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

sorry I was offline ...

The example xmpl_trx_base.c should be the first step to run. It checks all communication with the radio transceiver. I guess, that probably the sleep or reset pin is not yet configured properly. To set F_CPU correct is offcourse essential since the initial waiting delay after state P_ON is needed. Can you press reset of the MCU without power cycle the board and is it working then ? This would indicate a wrong F_CPU setting (check if xmpl_led.c blinks with 500 ms). The hardware timer is not involved at this initialization stage.

Cheers, Axel.

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

Have someone experience of the wireless range with the AT86RF230, line of sight?

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

Jonil, AFAIK it depends on a few things, I have heard it can be up to 1 mile with the proper antenna...

Axel, we got it working with the MCU at 8Mhz...
With the ATmega128 at 16MHz, there were a couple of errors...
I haven't bothered to figure out why, as the project is a bit rushed and 8MHz will prolly be ok for the rest of the code we are running...

We do seem to have a range problem...
Currently it's only good for about 30 cm with a 2db chip antenna...
Any idea's what might be limiting the range?
The xtal used on the RF section was spec'd at 50ppm, could that limit the range?
After I get a couple more boards built I will try some 10ppm xtals...
I should prolly post this question to Jorg (dl8dtl)...
He really knows his RF...

Thanks!
Michael

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

For 16Mhz question:

a) as far as I know the AVR needs 4.5V, the RF230 is specd for max 3.6V, how do you convert the levels between the chips?

b) the RF230 is specd for SPI speed 7.9MHz asynchronous and 8MHz synchronous to CLKM.

For the range: One trial could be to switch the signal CLKM (provided by th RF230) off.
Otherwise the data sheet states in terms of the 16MHz crystal for the RF230:

Quote:

The external components of the crystal oscillator should be selected carefully and the related board layout should be done meticulously (refer to section 5)

Cheers, Axel

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

Hey...

We are using a level shifter between the M128 and the RF230...

I will try turning off the CLKM output...

Thanks!!
Michael

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

> Any idea's what might be limiting the range?

Apart from the obvious things (like a broken PCB / bad solder), here
are some ideas about what to check:

  • are all channels poor, or just a single one?
  • any interferers around?
  • what's the RSSI or ED value of the received signal? Keep in mind that RSSI reflects the current actual energy on the channel (updated each
    microsecond), while ED reflects the median RSSI value from the last
    ED measurement (either explicit, or implied at the start of a received
    frame); two neighbouring boards should yield something around -40 dBm,
    assuming the Tx side is set to 0 dBm
  • how's your chip antenna attached? there's probably going to be a balun then -- on my board, I could benefit from the symmetrical antenna design
    of the reference board, and the symmetric RF pins

p.s.: My tiny230 boards are working across a distance of about 10...20 m
within a building, i.e. some (light) walls between

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

pps: Regarding your fears about the crystal inaccuracy, just check the
actualy frequency error. If you turn on CLKM, you can measure the
(divided) crystal frequency there. Both, the absolute error and the
jitter (i.e. the worst case result when adding both errors) have to
be within the limits specified in the datasheet.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Hey...

I ran the rdiag, set one to continuous send ..
The other to receive and turned up verbose to 1 ...

The boards are facing each other with the antennae about 2 cm apart...

Power was set to zero, all channels give the same result...
The best I could get was about RSSI = 12 when the boards were about 5mm apart...
The maximum distance I could establish with the wireless uart app was about 50cm...

The xtals I changed to 10ppm parts...
I can't really measure the cklm freq as I don't really have anything accurate to measure it with,
Other than an AVR based frequency meter that I built sometime ago...
Also, the CKLM pin I left unconnected and the output is disabled...

The chip antenna is attached after the balun on my board.. Like the schematic in AVR2005 ...

The balun part number is RGBLN1608070A5T...
The antenna part number is RFANT3216120A1T...
These are both Walsin parts ordered from Mouser...

I tried switching which board sends and which receives and the results are the same...
Also my friend has another 2 boards at his house and reports the same behavior...

Here is the output...

++FRAME len=42, crc= OK, lqi=255 rssi=6 seq=182
++FRAME len=42, crc= OK, lqi=255 rssi=6 seq=213
++FRAME len=42, crc= OK, lqi=255 rssi=6 seq=244
++FRAME len=42, crc= OK, lqi=255 rssi=6 seq=21
++FRAME len=42, crc= OK, lqi=255 rssi=6 seq=50
++FRAME len=42, crc= OK, lqi=255 rssi=6 seq=81
++FRAME len=42, crc= OK, lqi=255 rssi=6 seq=112
++FRAME len=42, crc= OK, lqi=255 rssi=6 seq=143
++FRAME len=42, crc= OK, lqi=255 rssi=6 seq=174
++FRAME len=42, crc= OK, lqi=255 rssi=7 seq=207
++FRAME len=42, crc= OK, lqi=255 rssi=6 seq=238
++FRAME len=42, crc= OK, lqi=255 rssi=6 seq=13

Thanks!!
Michael

Last Edited: Mon. May 25, 2009 - 02:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Attached is a jpg of the RF layout....

The top right is the FTDI232...
The top left is the MEGA128...
Left side is the level shifter...

Maybe some problem can be easily found.. :<

Thanks!!

Michael

Attachment(s): 

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

> The best I could get was about RSSI = 12 when the
> boards were about 5mm apart...

Just to make sure: this is still measured while the frame is still "on air",
e.g. at the RX_START IRQ, is it?

A value of 12 would be (-91 + 3 * 12) -55 dBm, which is pretty weak for
such a tight setup. Something must be wrong within your RF path.

Any chance you could use a different board as a 3rd party reference?

Also, maybe you can unsolder the coupling Cs for a test, and use a
simple folded dipole antenna for a comparison? As a DC path is
permissible between RFN and RFP, you could solder it directly onto
the pads of the coupling Cs. With a lambda of 13 cm, the length of
the dipole should be about 6 cm, just simple 0.5 mm copper wire
folded as a dipole loop.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

The sequence numbers in the rdiag dump shows, that only every 32th frame is received.
This looks like a very systematic interference.

Can you change the frame length ('l' increments by 1 and 'L' by 10, length wraps around by 127 ... undocumented feature)

Which radio channel you are using? ('-': channel -= 1, '+': channel += 1)

Interferer:

Can you disable the FTDI232 ?

Try to use xmpl_trx_tx.c, it sends without the need of the host interface (RS232) (channel=17, xmpl.h), so you can disable the FTDI232 at the sender.

With xmpl_tx_aret.c and xmpl_rx_aack.c you can disable the FTDI at both ends. The LEDs should blink with 500ms intervall. This would give a very basic range test setup. Feel free to extend the examples for debugging purposes.

Cheers Axel

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

Hey...

Jorg... I tried the dipole, it gives much better results... Getting an RSSI of 28 with the boards close together...

I don't know about RX_START IRQ, I set one board to transmit continuously, the other to receive...
The data shown below streams in on terminal...

Unfortunately, we don't have any other boards for reference or testing...

Also, I noticed when the diag was running, a regular ball pen touched against the antenna gave much better resutls.... lol

Axel...

L and l don't seem to have an effect on the frame length...
I'm using "Radio Diag 0.12"....

All channels seem to be behaving the same...

Also SEQ does change once in a while...
I will add a larger sampling of data...

I can try the other test apps tomorrow to see if the ftdi is interning...
However, the power 3.3v, for the at86rf230b is coming from the ftdi's onboard regulator....

++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=27
++FRAME len=42, crc= OK, lqi=255 rssi=25 seq=59
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=91
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=123
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=155
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=189
++FRAME len=42, crc= OK, lqi=255 rssi=25 seq=221
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=253
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=29
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=61
++FRAME len=42, crc= OK, lqi=255 rssi=25 seq=93
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=125
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=157
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=189
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=223
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=255
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=31
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=63
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=95
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=127
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=159
++FRAME len=42, crc= OK, lqi=255 rssi=26 seq=191

Thanks!
Michael

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

Hey....

So it seems the RF path is not right...
There are but 3 things after the AT86RF230b...
The 22pf c0g caps, the balun, the antenna ...

As it stands, with the folded dipole wire antenna, I can get between 6 to 8 RSSI at 8 meters distance...

For this application that should be well enough...
We probably don't have time to order any new parts as this art project will be shipped to Austria at the end of this week...

So, the important question is... is it allright to use the dipole?
Will it cause any problems over the next 6 months or so the art project needs to be active?
We won't have access to the project once it's installed, so it needs to be semi-reliable ...

Also, if the dipole is allright for long term use, What do you suggest for making it a bit more durable...
The wire is a bit flimsy as it is now...
Can I glue it between two pieces of paper to make it rigid?
Any suggestions?

Thanks !!!
Michael

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

Also... I have some 0.7mm and 1mm magnet/trafo wire available...
Would that be a better choice than the 0.5mm copper wire I scavenged from a LAN cable?

Thanks!

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

Just an stupid question, since I'm not an RF guy... Is the chip antenna located just above a ground plane? What say the antenna datasheet respect to ground planes? IIRC, the ones I read about (three years ago!) didn't like ground planes too close.

OTOH, a wire perpendicular to a ground plane bejaves like a dipole, thus it gaves better results.

EDIT: spelling :(

Guillem.
"Common sense is the least common of the senses" Anonymous.

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

> There are but 3 things after the AT86RF230b...
> The 22pf c0g caps, the balun, the antenna ...

Not too much. While chip antennas aren't too brilliant in their gain
(which is usually rather a loss instead), they should for sure get
somewhat better results.

> As it stands, with the folded dipole wire antenna, I can get between
> 6 to 8 RSSI at 8 meters distance...

...which translates into -73 ... -67 dBm. That looks good to me.
Each 6 dB means a theoretically doubled link distance (without any
interference, of course), so this should max out at about 100 m.

> So, the important question is... is it allright to use the dipole?

If you can get it mechanically stable, yes, the dipole is certainly a
good solution. After all, if you get it into resonance, it'll yield
you a sure 2.15 dBi gain.

What your design is lacking though is any kind of filtering against
radiating harmonics. While there's a theortically good suppression of
the first harmonic in a symmetrical design, the radiation of the
second harmonic (3 * f) could be above the regulatory level.

I think the Atmel appnote uses a dual Pi lowpass filter (which I
also designed into my tiny230), but you might as well get away by
simply introducing a couple of small resistors (about 5 Ω each)
instead. In theory, this causes a higher loss than the full Pi
lowpass filter, but I didn't notice much difference.

> Also, if the dipole is allright for long term use, What do you
> suggest for making it a bit more durable...

> Can I glue it between two pieces of paper to make it rigid?

As long as the paper doesn't get wet (or the glue), that's probably
OK.

You can also use thicker wire. In theory, this will lead to slightly
smaller dimensions of the antenna, but as long as you don't check the
resonance anyway, that doesn't matter much. (If you could tune it for
resonance though, it will yield you optimal radiation, as well as act
as an additional supression of non-harmonic spurious radiation.
Unfortunately, it doesn't help for harmonics though as the antenna is
also resonant for them.)

Maybe you could use the PCB antenna from the Atmel appnote then?

> Also... I have some 0.7mm and 1mm magnet/trafo wire available...
> Would that be a better choice than the 0.5mm copper wire I scavenged
> from a LAN cable?

Probably, the only question is how you are going to fix it to the PCB
then without breaking it due to the mechanical forces applied.

> Just an stupid question, since I'm not an RF guy... Is the chip
> antenna located just above a ground plane? What say the antenna
> datasheet respect to ground planes? IIRC, the ones I read about
> (three years ago!) didn't like ground planes too close.

I agree.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

You feed the AT86RF230 from the FTDI232 regulated power supply. Is the provided supply current high enough for driving the radio in RX/TX active?

Does the distance of the received sequence numbers change with the verbosity level of the application ? Maybe you can check the RF230 supply with a scope.

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

> Is the provided supply current high enough for
> driving the radio in RX/TX active?

The FT232RL datasheet says it can drive up to 50 mA. That ought
to be enough.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.