Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 28, 2024, 03:48:51 15:48


Login with username, password and session length


Pages: 1 [2]  All
Print
Author Topic: Looking for RFM22B demo code working with PIC  (Read 16550 times)
0 Members and 1 Guest are viewing this topic.
jamesbond
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 50
-Receive: 9


« Reply #25 on: April 11, 2013, 09:48:24 21:48 »

best way is a hf-reciever if you have one. I'am not.

Second method.
put a 1 ohm resistor in the power line to the rfm22.
view on an oscilloscoop the voltage over the resistor.
if the powerconsumption rise at setting testoutput=1 and fall at testoutput=0 you can assume the transmitter sends.
if your testboards are identical,try this on both boards to test if the two modules working properly. (see attachment)

the nIRQ is also used by the FIFO in the tx_mode.
you can test the nIRQ pin if there is any response when sending

i use 868Mhz, its normaly written on the back side .     

Logged
lcn
Junior Member
**
Offline Offline

Posts: 42

Thank You
-Given: 15
-Receive: 1


« Reply #26 on: April 12, 2013, 06:52:39 06:52 »

Yes, I have 2 identical boards, as same the picture I sent.
One as been programmed to transmit the string every 3 seconds, the second module is programmed as receiver.

My modules are 433mhz, do you think I should modify frequency registers ?
I guess I should not use the same init config that you have sent in your code ?

What line of the code sets nIRQ pin going low when FIFO gets full ?
I do not find it.

I will double check on the sender module if nIRQ goes low, but if I remember well I think so !
So issue might come from the receiver.



Posted on: April 11, 2013, 11:10:03 23:10 - Automerged

I've checked again the logic analyser capture of TX_mode();

i can see the following :
Before TX_mode starts, nIRQ pin was '1' and will stay '1' while TX_mode runs

-At the beginning of TX_mode();  i can see TX-ANT pin going '1'
- FIFO is cleared, we read see on logic analyser (0x88),(0x03) - (0x88),(0x00)
- Then, i can see many 12 couples of (0xFF), (character hexa code of the string sent)
- I see (0x87),(0x09) and (0x87),(0x04)
- TX_ANT goes '0'
- nIRQ pin goes '0' at about 90ms AFTER TX-ANT went '0'   not sure this is normal

Normally, if i'm not wrong , at the end of TX_mode
we first wait ( do nothing ) until nIRQ is '1'
then if nIRQ goes low TX_ANT is set to '0'

Code:
  while(RFM_nIRQ!=0);
  RFM_TX_ANT = 0;


In the reality, TX-ANT goes '0' first and nIRQ goes '0' 90ms later.
This was also confirmed by my debugger, i PAUSE the code run i can see that programs waits on that line :
Code:
while(RFM_nIRQ!=0);

When my board is not transmitting anything current sucked is : 25mA
During TX_mode current reached 45 mA, so TX_mode sucks about 20mA .



Logged
jamesbond
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 50
-Receive: 9


« Reply #27 on: April 12, 2013, 10:01:35 10:01 »

After executing rfm_init() the nIRQ =1.
The first time (after the rfm_init())  you enter tx_mode the nIRQ=1 until the FIFO is empty.(if nIRQ=0  FIFO is emtpy and transmission is completed)
If only the TX_mode is in a loop, the nIRQ stays low.
nIRQ=1 after rfm_write(0x07,0x09); //start sending.
 
It seems that your PIC do not read the nIRQ.
In this case you disconnect the antenna (TX_ANT=0) before the the rfm22 has finished transmitting.
The transmission time of 90mS seems OK.
To test you can force the 90mS wait time (rfm =sending)  by inserting a waitloop (100mS) before the while(RFM_nIQR!=0);

the increase of current during tx mode indicates that the rfm is trying to send.
The exact current i do not know.
 
Logged
lcn
Junior Member
**
Offline Offline

Posts: 42

Thank You
-Given: 15
-Receive: 1


« Reply #28 on: April 13, 2013, 11:16:13 11:16 »

Hello

I'm back with good news  Wink
The SENDER & RECEIVER modules are now working perfectly.

Thank you very much Jamebond for your help, i wouldn't success without your advices.

For people who following this post i've attached the SPI capture when RFM22-S2 modules receives a string from the SENDER module.
In this capture, the RX_string lenght was set to 12 and we receive the message "Hi!"

I also attach the SPI capture for the SENDER module, the message in TX_string sent out is "Hi!"

In order to read them, you need to download the free logic analyser software : http://www.saleae.com/downloads


My modules are 433Mhz, so i had to modify in RFM_init(); the frequency settings as below :
Code:
/**** FREQUENCY SETTING ****/
  rfm_write(0x73,0x00);             // freq offset
  rfm_write(0x74,0x00);             // freq offset
  rfm_write(0x75,0x53);             // hbsel = 0, sbsel =1, fb = 19
  rfm_write(0x76,0x64);             // 25600 = 0x6400 for 434Mhz
  rfm_write(0x77,0x00);             // freq offset
  rfm_write(0x79,0x00);             // no freqhopping
  rfm_write(0x7A,0x00);             // no freqhopping

Hope it could help.

--

Since the modules are now communicating together, i've found that TX & RX headers are not used in the code provided by Jamesbond.

-Would you please tell me how to enable them ?
Are they supposed to enhance the occuracy of the transmission ? as suggested at page 43 of the datasheet ( preambles )

Jamesbond code is using GFSK mode, but what are antenna diversity and AFC enabled ?
I do not understand well the datasheet on these points.


- I still have problem to calculate the TX/RX frequencies for the modules.

Does a software calculator exist to calculate 0x75 - 0x76 - 0x77 registers ?

I need to use 4 pairs of modules for my project and would like to set differents frequencies on each of them in order to avoid TX/RX collisions.
ie : 433.1 Mhz, 433.4 Mhz, 434.1 Mhz, 434.7 Mhz


« Last Edit: April 13, 2013, 11:27:51 11:27 by lcn » Logged
jamesbond
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 50
-Receive: 9


« Reply #29 on: April 14, 2013, 10:33:56 10:33 »

Good to hear that it work.

I found this a while ago, maybe  you can use it.
http://www.hoperf.com/upload/rf/RF22B%2023B%2031B%2042B%2043B%20Register%20Settings_RevB1-v5.xls

About TX and RX headers, change one byte in the header of the sender and see if the receiver still receives data.

the antenna diversity is also not clear to me.I have to read the datasheet again.I will do soon.

AFC enabled is Automatic frequency control = to lock on the frequency of sender. 
Logged
lcn
Junior Member
**
Offline Offline

Posts: 42

Thank You
-Given: 15
-Receive: 1


« Reply #30 on: May 01, 2013, 02:31:26 14:31 »

Hello,

I've received new modules i ordered : RFM23BP

I do confirm these are fully compatibles with RFM22B code.

For test purposes i've used a RFM23BP module as 'sender' and a RFM22B module as 'receiver'
The communication works properly so modules are compliants each other and code as well.

However i've found RFM23BP module gets very hot, 2 chips on the board go up than 150°C (302°F)    Shocked
( my test code transmit a string every 3 seconds )

Does anyone also confirm that RFM23BP modules are very hot when they are in use ?
Logged
TucoRamirez
Senior Member
****
Offline Offline

Posts: 307

Thank You
-Given: 257
-Receive: 115


Tuco ... dead or Alive


« Reply #31 on: May 02, 2013, 02:05:46 02:05 »

So do you have a FLIR Thermal Camera ...  Interesting !!

Logged

Whoever double crosses me and leaves me alive... he understands nothing about Tuco.
jamesbond
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 50
-Receive: 9


« Reply #32 on: May 02, 2013, 05:11:52 17:11 »

the rfm22 and 23bp are pin compatible
only the TXON and RXON pins are driven inverted.
refer to datasheet to be sure.
Logged
lcn
Junior Member
**
Offline Offline

Posts: 42

Thank You
-Given: 15
-Receive: 1


« Reply #33 on: May 02, 2013, 08:58:31 20:58 »

Many thanks Jamesbond i did not notice that.

In order to enhance the transmit & receive distance, i would like to use a 433Mhz antenna instead of 17,4 cm copper wire.

I've found a Aurel antenna in my stock, maybe a newbie question but i don't know how to connect it to the module.
See the antenna picture attached below.

Should connect the end of the black wire to RFM antenna pin ?
and red wire would be a virtual ground staying unconnected ?

The Aurel antenna measure 19,8 cm , isn't it too long for 433Mhz purposes ?

Posted on: May 02, 2013, 07:55:54 19:55 - Automerged

I'm back with new tests done with RFM23BP modules
i've inverted the states of RX_ON and TX_ON.

But my RFM23BP module set as emetter is not working properly  Shocked

Actually it gets stuck in tx_mode() : it waits for nIRQ going low but is does not, i don't know why  Sad

--->  while(RFM_nIRQ == 1);     // Wait nIRQ goes HIGH to LOW : will mean packet has been transmitted
        RFM_TX_ON = 1;            // Transmission completed, disable TX antenna


In the mean time GPIO2 is '1' but it should not because the init function has previously set it to low state and tx_mode does not change GPIO2 state at all.
So this is another outstanding thing.


Edit :
I've found that the board works properly approximately 1 time / 20 start/restart cycles.
If i power off and put back several times, sometimes the RFM23 board inits and works properly, i don't know why.
« Last Edit: May 03, 2013, 07:17:36 07:17 by lcn » Logged
jamesbond
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 50
-Receive: 9


« Reply #34 on: May 03, 2013, 08:08:19 20:08 »

calculation for 1/4 whip antenna (300/433)/4 = 17.3cm.

The connection between RFM module and antenna should be as short as possible.
For a strong antenna signal you need a ground plane.
See datasheet    http://www.rfm.com/corp/appdata/antenna.pdf.
I use a piece of brass rod mounted on a PCB which is also the grond plane.
This is good for 5km distance.


I had the same problem as you in tx-mode.It took me a day to find the problem.
It has something to do whit the smart reset on the rfm module.

I replaced the 5V voltage regulator for a 1Amp and more stable type.
Add a extra capacitor to the input of the voltage regulator.
There should be no voltage drop in the 5 volts while transmitting.
 
Check your pcb for ground loops. This was the main problem in my pcb.

I hope this helps you.Let me know your progress !

Logged
lcn
Junior Member
**
Offline Offline

Posts: 42

Thank You
-Given: 15
-Receive: 1


« Reply #35 on: May 04, 2013, 03:32:02 15:32 »

I've made some deeper tests with my debugger :

I've tried to make a stop point in tx_mode function when code reaches :
Code:
RFM_TX_ON = 1;            // Transmission completed, disable TX antenna

It is just after nIRQ pin state test.
Code:
while(RFM_nIRQ == 1);     // Wait nIRQ goes HIGH to LOW : will mean packet has been transmitted

Actually the debugger never stops because it does not see nIRQ going low.
The SPI capture i got with logic analyser confirms this too.

According to logic analyser capture, i can see tx_mode function transmits each characters of the string properly,
even the lines below are also well transmitted on the SPI line, nIRQ don't turn to low state when the transmission ends, thus TX_ANT is not desactivated and not set back to high state.
Code:
rfm_write(0x07,0x09);     // TX in Manual Transmit Mode : ON  - READY Mode - (nIRQ goes high '1')
rfm_write(0x05,0x04);     // Packet Sense Interrupt enabled. (nIRQ will go low when a packet will be transmitted)

I'm not using PCB yet, i'm testing my RFM23BP module with a Lab board powered by +12V battery and +5V LDO regulator.
Because i'm using a battery as power supply i should not get dropdown voltage at regulator input, i've added a 330uF tantalium cap close to RFM23 power pins but this does not help.


Edit : added SPI capture file from Saleae Logic Analyser showing RFM23 tx_mode() function
« Last Edit: May 04, 2013, 03:37:22 15:37 by lcn » Logged
bbarney
Moderator
Hero Member
*****
Offline Offline

Posts: 2430

Thank You
-Given: 405
-Receive: 545


Uhm? where did pickit put my mute button


« Reply #36 on: May 04, 2013, 10:35:07 22:35 »

would be better if you posted a bitmap or other more common picture format like jpeg or png
not everyone has the software to read your file
Logged

Ever wonder why Kamikaze pilot's wore helmet's ?
jamesbond
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 50
-Receive: 9


« Reply #37 on: May 06, 2013, 08:01:33 20:01 »

Sorry for the late response.

I still think the problem is in RFM23bp module.

I use the voltage regulator L7805CV which is 1.5A from ST.
In previous post I had said 1A, this should be 1.5A.

I had the same problem.Maybe 1 of 5 transmissions were succesful, in all the other cases it stopped also at the IRQ loop.
The rfm23bp itself never leave the tx_mode, that is the the reason for the high temperature.
You can check that bij measuring the current.
 
In Previous post I forgot to mention to measure Gpio ports on logic level on a scope.
On my testboard the gpio ports of the rfm23bp are 3.3V at a supply voltage of 5V at the rfm23bp Huh?
At last i had powered the pic16 on 3.3V and rfm23bp at 5V.

Look carefully at the wiring of your board and experiment with that.
Logged
lcn
Junior Member
**
Offline Offline

Posts: 42

Thank You
-Given: 15
-Receive: 1


« Reply #38 on: May 07, 2013, 06:27:55 18:27 »

Actually i do use the same regulator like you.
I'm using +12V battery cell + regulator as power supply.
There is 10uF cap at regulator Vin pin and 330uF tantalium cap at Vout side.

I'm using a lab board for my tests and RFM23BP module is wired to it with small wires soldered on it, maybe because lab boards are not shielded, it could explain this trouble ?

Has your PCB 2 layers with ground plane on both sides ?
« Last Edit: May 10, 2013, 11:07:54 11:07 by lcn » Logged
jamesbond
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 50
-Receive: 9


« Reply #39 on: May 10, 2013, 10:55:16 10:55 »

On my modules the underside is fully grounded.

I have a bitmap of my pcb attached. Maybe it is usefull for you.
to clarify the strange drawing method.
The original is a autocad dwg so I can easily import it to a usable format for my cnc machine.
This pcb is in low numbers in production, it should be improved in the future.

As you can see the pic16 is powered to 3.3V only for the input/output levels on the rfm23bp
The logic levels on my rfm23bp are not 5V.It is better to check that on your modules.

Has you measure the current to see if the tx-mode is terminated on expected point.
Logged
lcn
Junior Member
**
Offline Offline

Posts: 42

Thank You
-Given: 15
-Receive: 1


« Reply #40 on: June 01, 2013, 01:39:42 13:39 »

Hello,

I've asked some questions to Hoperf support, here are their answer :
Quote
Our RFM23BP module, power is 5V, for the PA ont the module need 5V power supply, but there is a LDO on the module, so our RF IC on the module also powered by the 3.3V, so the module connect to the MCU should be 3.3V power.
When you set the module work in transmitter, whether the area of the module GND and your board GND connected is enough large ?  For the module has a large power, so it need enough area GND.

So RFM23 modules are 3.3V compatibles.
In order to solve the transmission issue i've built a 2 layers PCB with ground plane on both sides.
I'm waiting to receive them from Futurlec

I will update that post with the results once that new board will be tested.
Logged
lcn
Junior Member
**
Offline Offline

Posts: 42

Thank You
-Given: 15
-Receive: 1


« Reply #41 on: July 27, 2013, 05:14:10 17:14 »

Hello

I'm back, i've build a RFM23BP module on a 2 layers PCB with grounded background.

But, in transmission mode, most of the time nIRQ does not go low and i don't know why it won't to !
The code stays wainting tx_mode(); function on : while(RFM_nIRQ == 1);

Code:
 // During transmission process nIRQ is HIGH, transmission takes about 90ms
  // nIRQ will go LOW once transmission completed.
  while(RFM_nIRQ == 1);     // Wait nIRQ goes HIGH to LOW : will mean packet has been transmitted (tant que nIRQ = 1 -> attente)


Note the regulator i've used is a 3A LDO from Exar : SPX29300T-L-5-0

Sometimes transmission works during a couple of secondes and then gets locked on the while test ...
« Last Edit: July 27, 2013, 05:19:05 17:19 by lcn » Logged
lcn
Junior Member
**
Offline Offline

Posts: 42

Thank You
-Given: 15
-Receive: 1


« Reply #42 on: November 28, 2013, 10:35:26 22:35 »

Hello,

Did someone ever test the Frequency HOPPING on RFM22B / RFM23BP modules ?

I have set a table with some hopping values to be written into 0x79 register, the TX module is able to hope frequency for a tranmission but i do not see to the RX module could hope properly.

Code:
// Select Numbers of Frequency channels
#define NB_HOPPING_CHANNELS 6
// Select the hopping channels between 0-255
// Frequency = CARRIER_FREQUENCY + (StepSize(xx khz)* Channel_Number)
unsigned char hop_list[NB_HOPPING_CHANNELS] = {37,4,34,45,28,3};


void Hopping(void)
{
CH++;
if (CH > NB_HOPPING_CHANNELS) CH=0;
rfm_write(0x79, hop_list[CH]);
}

Any suggestion or idea would be much appreciated.
Logged
Ikaros
Junior Member
**
Offline Offline

Posts: 83

Thank You
-Given: 422
-Receive: 48


« Reply #43 on: December 05, 2013, 02:01:51 14:01 »

I have tried but in vein.

Maybe HopeRF can give a hand, but had not time to look into it more.

They are quite difficult to handle...
Logged
movf_jmpz
Newbie
*
Offline Offline

Posts: 12

Thank You
-Given: 8
-Receive: 4


« Reply #44 on: June 16, 2014, 04:46:18 16:46 »

According to freq hopping, are you waiting enough long for osc to stabilize carrier ?
If not, then your transmittion may be rejected by RFM22...
Logged
Pages: 1 [2]  All
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC