Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

RFM22B/RFM23B Bascom-AVR examples
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM Project Blog
View previous topic :: View next topic  
Author Message
AndersL

Bascom Member



Joined: 25 Jan 2010
Posts: 92
Location: Kragerø,Norway

norway.gif
PostPosted: Wed Jan 04, 2012 11:09 pm    Post subject: Reply with quote

@MAK3
The latest 2.0.7.3.
I suppose I have to dig more into this....

_________________
Anders
Back to top
View user's profile
MAK3

Bascom Member



Joined: 24 Sep 2010
Posts: 449
Location: Germany

germany.gif
PostPosted: Thu Jan 05, 2012 5:59 pm    Post subject: Reply with quote

Quote:
The latest 2.0.7.3.
I suppose I have to dig more into this....


You do not need to dig into this further because in the next version it will work.
(in 2.0.7.3 there is a problem with set/reset for passed parameters to sub)


MAK3
Back to top
View user's profile
AndersL

Bascom Member



Joined: 25 Jan 2010
Posts: 92
Location: Kragerø,Norway

norway.gif
PostPosted: Thu Jan 05, 2012 9:29 pm    Post subject: Reply with quote

@MAK3, yes Mark confirmed it.
I did some more testing now and noticed that RSSI value decrease at receiver when
the transmitter are moved toward it. Ie the RSSI is inverted somehow.
Did you test this?

Another thing: did the temperatur sensor give you aprox correct temperature?
Mine seems to be at least 5degc to high.

_________________
Anders
Back to top
View user's profile
MAK3

Bascom Member



Joined: 24 Sep 2010
Posts: 449
Location: Germany

germany.gif
PostPosted: Mon Jan 09, 2012 9:21 pm    Post subject: Reply with quote

Quote:
Ie the RSSI is inverted somehow.
Did you test this?


No, not really yet (at least I can't remember)


Quote:
Another thing: did the temperatur sensor give you aprox correct temperature?
Mine seems to be at least 5degc to high.


I can confirm mine was also several degree too high.

But this temp sensor is not that accurate.

After calibration you can achieve better than +-3 degree.

Quote:
Calibration of Temperature Sensor
The slope of the temperature sensor is linear and monotonic. However, for better than 10 °C absolute accuracy,
each chip has to be calibrated. This document describes two different calibration methods. After using one of the
two or both calibrations, better than ±3 °C absolute accuracy can be achieved.


MAK3
Back to top
View user's profile
MAK3

Bascom Member



Joined: 24 Sep 2010
Posts: 449
Location: Germany

germany.gif
PostPosted: Sun Feb 19, 2012 7:25 pm    Post subject: Reply with quote

Hi AndersL,

BASCOM AVR 2.0.7.4 BETA is now available over UpdateWizard so you can use XTEA now

--> http://register.mcselec.com/login.php

MAK3
Back to top
View user's profile
AndersL

Bascom Member



Joined: 25 Jan 2010
Posts: 92
Location: Kragerø,Norway

norway.gif
PostPosted: Mon Feb 20, 2012 6:29 pm    Post subject: Reply with quote

Hi MAK3,
Yes! Have been waiting for that. Unfortunatly I'm in the middle of a DCS uppgrade, so time only allows me to look briefly on
it for now.

_________________
Anders
Back to top
View user's profile
Flyby123

Bascom Member



Joined: 05 Jul 2008
Posts: 73

blank.gif
PostPosted: Wed Apr 11, 2012 10:58 pm    Post subject: Reply with quote

To MAK or other knowledable,

Can this also be used in conjuction with a bootloader?
I am somewhat hesitant since bootloaders normaly load from UART.
But on the other side SD card bootloader also exists which is SPI..
Any pointers if yes?

TIA,

Jim
Back to top
View user's profile
MAK3

Bascom Member



Joined: 24 Sep 2010
Posts: 449
Location: Germany

germany.gif
PostPosted: Thu Apr 12, 2012 8:56 pm    Post subject: Reply with quote

Quote:
Can this also be used in conjuction with a bootloader?

Dave posted his project with RFM12B which you can rewrite to use with RFM22B/23B
http://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=10360

And the RFM22B/23B have in addition features like transmit and receive packets with longer than 64 bytes payload using the FIFO.


But sure the Bootloader over SD-Card should also work good in combination with RFM22B/23B. The SD-card is then just another SPI slave where you need an additional Slave Select pin. The example is in samples folder of bascom-avr.


MAK3
Back to top
View user's profile
jure_m

Bascom Member



Joined: 14 Jan 2005
Posts: 68
Location: Ljubljana

slovenia.gif
PostPosted: Thu Jun 07, 2012 12:50 pm    Post subject: Reply with quote

@MAK,

according to your SW below
Code:
' Hardware Connections:

' ATMEGA88                       RFM23B
' ATMEGA88 Portb.2         ----> nSEL (RFM23B)
' ATMEGA88 Portb.3         ----> SDI  (RFM23B)
' ATMEGA88 Portb.4         ----> SDO  (RFM23B)
' ATEMGA88 Portb.5         ----> SCK  (RFM23B)
' ATMEGA88 Portd.2 (INT0)  ----> nIRQ (RFM23B)


I wonder how you program AVR in circuit? Does RFM23B connected to MISO; MOSI; SCK disturb AVR programming?

According to my experience it's best to leave MISO; MOSI; SCK unconnected for easy AVR in circuit programming.

Best regards
Jure
Back to top
View user's profile Visit poster's website
MAK3

Bascom Member



Joined: 24 Sep 2010
Posts: 449
Location: Germany

germany.gif
PostPosted: Sun Jun 10, 2012 3:03 pm    Post subject: Reply with quote

Hello Jure,


Quote:
I wonder how you program AVR in circuit? Does RFM23B connected to MISO; MOSI; SCK disturb AVR programming?

With a bootloader over serial interface. I don't think the RFM23B will disturb the AVR programming but I have not tried it.


MAK3
Back to top
View user's profile
tolisn

Bascom Member



Joined: 02 Jul 2005
Posts: 123
Location: Greece

greece.gif
PostPosted: Fri Nov 30, 2012 6:38 am    Post subject: Re: RFM22B/RFM23B Bascom-AVR examples Reply with quote

MAK3 wrote:
Here you find examples for RFM22B and RFM23B with Bascom-AVR


As already posted here
http://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&p=51175#51175

here is an example for using a RFM23B or RFM22B from Hope Rf with Atmega88
http://www.hoperf.com/rf_fsk/fsk/RFM23B.htm

Data rate = 56 kBps
Center Frequency = 868 Mhz (which you can adapt to your country settings according the excel calculator)
Excel Calculator was already posted here: http://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&p=51085#51085

The RFM23B is based on the SI4431 from Silicon Labs so I used the different Silabs data sheets.

This example is using many of RFM22/23B included features like 64 Byte FIFO, header or CRC.
With the header the RFM22/23B is acting like a filter so you can define from which node address you want to receive date (e.g. only from address 1).

The only featue I missed with RFM23B is in my opinion data encryption/decryption.

Therefore this example also show the new XTEA encryption/decryption function of Bascom-AVR ! Laughing
(It is also no problem to run this XTEA function with ATTINY variants of AVR’s because it is really tiny)

Code:
 ' Transmit and Receive Packets Using the FIFO

'  +-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
'  |   P   |   P   |   P   |   P   |  2D   |   D4  | HEADER|Length |Data 0 |Data 1 |  .... |Data 63|  CRC  |   CRC |
'  +-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
'  <-------32Bit Preamble-------- -><Sync. Pattern ><-Addr->       <----------Data (Payload)------><--16-Bit CRC-->


In the example the transmitter is sending a string with 64 Byte to a receiver Node. The receiver node send back an Acknowledge (16 Byte) to the transmitter.


Terminal output of Transmitter:
Code:
 --- RFM23B - ATMEGA88  ---

Device Type   : 08
Device Version: 06

Node Address = 2
This Node receive from Address 1   and broadcast address (&HFF)
<Addr 2> receive from <Addr 1>   Data = ACKNOWLEDGE    ! /  Length= 16 RSSI= 75    AFC Corr= 312.5 Hz
<Addr 2> receive from <Addr 1>   Data = ACKNOWLEDGE    ! /  Length= 16 RSSI= 78    AFC Corr= 625.0 Hz
<Addr 2> receive from <Addr 1>   Data = ACKNOWLEDGE    ! /  Length= 16 RSSI= 72    AFC Corr= 312.5 Hz
<Addr 2> receive from <Addr 1>   Data = ACKNOWLEDGE    ! /  Length= 16 RSSI= 78    AFC Corr= 625.0 Hz
<Addr 2> receive from <Addr 1>   Data = ACKNOWLEDGE    ! /  Length= 16 RSSI= 107    AFC Corr= 312.5 Hz
<Addr 2> receive from <Addr 1>   Data = ACKNOWLEDGE    ! /  Length= 16 RSSI= 104    AFC Corr= 625.0 Hz



Terminal output of Receiver:
Code:
 --- RFM23B - ATMEGA88  ---

Device Type   : 08
Device Version: 06

Node Address = 1
This Node receive from Address 2   and broadcast address (&HFF)
<Addr 1> receive from <Addr 2>  Data= Hello Bascom Freaks !, This is 64 Byte Buffer sent out by RFM23B /  Length= 64 RSSI= 74  AFC Corr= 79687.5 Hz
<Addr 1> receive from <Addr 2>  Data= Hello Bascom Freaks !, This is 64 Byte Buffer sent out by RFM23B /  Length= 64 RSSI= 75  AFC Corr= 79375.0 Hz
<Addr 1> receive from <Addr 2>  Data= Hello Bascom Freaks !, This is 64 Byte Buffer sent out by RFM23B /  Length= 64 RSSI= 106  AFC Corr= 79375.0 Hz
<Addr 1> receive from <Addr 2>  Data= Hello Bascom Freaks !, This is 64 Byte Buffer sent out by RFM23B /  Length= 64 RSSI= 74  AFC Corr= 79375.0 Hz
<Addr 1> receive from <Addr 2>  Data= Hello Bascom Freaks !, This is 64 Byte Buffer sent out by RFM23B /  Length= 64 RSSI= 80  AFC Corr= 79375.0 Hz
<Addr 1> receive from <Addr 2>  Data= Hello Bascom Freaks !, This is 64 Byte Buffer sent out by RFM23B /  Length= 64 RSSI= 76  AFC Corr= 79375.0 Hz
<Addr 1> receive from <Addr 2>  Data= Hello Bascom Freaks !, This is 64 Byte Buffer sent out by RFM23B /  Length= 64 RSSI= 76  AFC Corr= 79375.0 Hz
 



To find the right values for init of the RFM23B I used the Excel calculator from here:
http://www.hoperf.com/upload/rf/RF22B%2023B%2031B%2042B%2043B%20Register%20Settings_RevB1-v5.xls


MAK3



Hi

I'm trying to use these modules for sending temperature information

from what I seen in you code in the section "Hardware connection"


' ATMEGA88 RFM23B
' ATMEGA88 Portb.2 ----> nSEL (RFM23B)
' ATMEGA88 Portb.3 ----> SDI (RFM23B)
' ATMEGA88 Portb.4 ----> SDO (RFM23B)
' ATEMGA88 Portb.5 ----> SCK (RFM23B)
' ATMEGA88 Portd.2 (INT0) ----> nIRQ (RFM23B)

' (RFM23B) GPIO0 <----> TX_ANT (RFM23B)
' (RFM23B) GPIO1 <----> RX_ANT (RFM23B)
' (RFM23B) SDN (Shutdown) <---> GND


If I understand correctly pin 6 is connected to pin 4 and pin 7 is connected to pin 3 of the RFM23B module.
Correct me if I'm wrong.

Also I would like to make a small network, with 3 slaves and 1 master, how is this possible and has anyone done it ?
Back to top
View user's profile
MAK3

Bascom Member



Joined: 24 Sep 2010
Posts: 449
Location: Germany

germany.gif
PostPosted: Fri Nov 30, 2012 8:13 am    Post subject: Reply with quote

Quote:
Also I would like to make a small network, with 3 slaves and 1 master, how is this possible and has anyone done it ?




See example: atmega88_rfm23b_Transmit_64bytes_GFSK_56kbps.bas.bas



Code:
'+++++++++++++++ NODE SPECIFIC INITIALIZATION+++++++++++++++++++++++++++++++++++
' Automatic header generation and qualification by RFM23B (up to four bytes)
' For example, a node just wants to receive packets from a specific node or group of nodes.

'                                                   <HEADER>
'  +-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
'  |   P   |   P   |   P   |   P   |  2D   |   D4  | HEADER|Length |Data 0 |Data 1 |  .... |Data 63|  CRC  |   CRC |
'  +-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+


'  Value in RECEIVED_HEADER_3 (e.g. = 1 )         -->+-----+
'                                                    |     |
'  Value in HEADER_ENABLE_3   (e.g. = &B11111111) -->|TRUE | ----> header OK !
'                                                    |     |
'  Value in CHECK_HEADER_3    (e.g. = 1 )         -->+-----+

' If any of the received header bytes fails the filter check, the header bit in the Device Status register is set.

' SET NODE ADDRESS = 2
   Node_address = 2
Call Rf23b_write_value_by_ref(transmit_header_3 , Node_address)       '3A    'Header 3  = ADDRESS   ;   &HFF = broadcast message

'With address_filter_pass you can define which address will be passed (beside broadcast = &HFF )
  Address_filter_pass = 1
Call Rf23b_write_value_by_ref(check_header_3 , Address_filter_pass)       '3F    'Header 3  = ADDRESS   (Check for Address)

 'The filter should check every single bit
 ' for example you could also check for &B0000_1111. Then only the lower nibble will be checked
  Header_check_filter = &B11111111
Call Rf23b_write_value_by_ref(header_enable_3 , Header_check_filter)       '3F

'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


MAK3
Back to top
View user's profile
tolisn

Bascom Member



Joined: 02 Jul 2005
Posts: 123
Location: Greece

greece.gif
PostPosted: Fri Nov 30, 2012 8:33 am    Post subject: Reply with quote

Can you please explain Sir ? I'm new to this module and there are many paramenters. I'm all mixed up

Thank you for your patience
Back to top
View user's profile
MAK3

Bascom Member



Joined: 24 Sep 2010
Posts: 449
Location: Germany

germany.gif
PostPosted: Fri Nov 30, 2012 11:06 am    Post subject: Reply with quote

see Application note AN415 page 24:

http://www.silabs.com/pages/Silabs-Search.aspx?q=an415

MAK3
Back to top
View user's profile
tolisn

Bascom Member



Joined: 02 Jul 2005
Posts: 123
Location: Greece

greece.gif
PostPosted: Fri Nov 30, 2012 7:24 pm    Post subject: Reply with quote

I have read the application note and I cannot understand how to do it. Forgive me but my coding knowledge is not advance. I'm an electronics engineer and my coding knowledge is strictly amateur at the most
Does anyone care to explain how it can be done with a simple example?

Thanks
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM Project Blog All times are GMT + 1 Hour
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum