HopeRF RFM12-S2 Modules help needed

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

HopeRF RFM12-S2 Modules help needed

Post by Jordy101091 »

Hi All,

I have made a RF sensor board with the following modules RFM12B 433MHz S2"" Trancievers.
The Transmitter is working because in Idle mode it draws about 5mA and when its working (transmitting) it draws 40mA so that should be OK.
By the way both modules are initialized correctly.

When I try to receive a byte "123" with the following macro's:

Send_Byte
Recieve_Byte

Its always returns 255 which indicates a timeout, That was strange I dit some further testing a I made a little program that checks the buffer of the recieving end, and the data form this buffer can tell me several things:
char Check_Buffer ( char Timeout )

Puts the RF module in data mode and checks for an incoming data packet.

This function also accepts the reception of the values 0-null and 255 which is not available in the send_byte, send_string functions.

The timeout parameter specifies how many milliseconds to try and wait for a valid data buffer to be received.

A return value of 255 indicates a timeout.

A return value of 254 indicates that the length byte was received but no data.

A return value of 253 indicates that some data was received but the packet was incomplete.

A return value of 252 indicates a CRC checksum error meaning one or more of the received bytes is incorrect.

A return value between 1 and 8 indicates a valid reception and also indicates the number of data bytes received in the packet.
So this happend,
When the transmitter has been powered down (No transmission) the check_Buffer macro returns a 255 code which indicates a timeout which is understandable when I apply power to the transmitter the code 255 changes into 252 which indicates a CRC Checksum error. Why is that,
Has anybody an Idea on how to fix this.

Let me know,
Jordy Kleian

Image

Image
the will to learn, should not be stopped by any price

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: HopeRF RFM12-S2 Modules help needed

Post by Jordy101091 »

Oke I have done some more testing,

I have put a program togheter that shows the error code of the check_buffer macro, it also show the following information:

Signal Quality
Data Bytes recieved
Buffer Content

When the transmitter is not active the reciever shows a timeout message (Code 255), "Signal quality = 0 , Data Bytes = 0 and Buffer content = 0".
When I power up the transmitter, the reciever shows a CRC Checksum Error (Code 252), "Signal quality = 3 , Data Bytes = 1 and Buffer content = Random".

The CRC Checksum error stays I doesnt change to valid data, also the signal quality changes sometimes to the value's 5,6 ore 7 its not even possible if you follow the help file. The help file says its only goes from 0 to 3 strange ????

Sometimes It shows a value that has been recieved it looks random because the program in the transmitter is counting to fast, so it appears to be random numbers, but still this rf connection has to be fast enough to show the counting progress.
The CRC Checksum error Wht does that mean and what can I ore Matrix do to solve this,

I have included my RX and TX program so you can have a go with it.

Regards Jordy

[/youtube]
Attachments
Aquatronics_Sensor_Module.fcf
Sensor Unit
(8.5 KiB) Downloaded 328 times
Reciever.fcf
Controller Part
(15.79 KiB) Downloaded 348 times
the will to learn, should not be stopped by any price

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: HopeRF RFM12-S2 Modules help needed

Post by Jordy101091 »

Hi guys,

I want to share a quick update on my problem with you,

The reciever Doesnt show the CRC Error (Code: 252) anymore, instead it shows the Incomplete message (Code: 253) which indicates a incomplete data packet which could be that not all 8 data bits where recieved I think.
And sometimes it shows valid data and I see the recieved value counting up at least sort of counting up.

after a few moments it turns back to the incomplete, timeout messages.

I use the same program as stated above I only changed some settings

this are the settings I'm using wright now:

Reciever

Image

Transmitter

Image

Also here is video of the sittuation:

[/youtube]
the will to learn, should not be stopped by any price

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: HopeRF RFM12-S2 Modules help needed

Post by Jordy101091 »

No body,

Has nobody an idea how to solve this, also can somebody explaine what the function is of the frequency defiation, and what the function is of the threshold, gain and bandwidth. What have these setting for effect on each other.
It not clear for me.

Regards jordy
the will to learn, should not be stopped by any price

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: HopeRF RFM12-S2 Modules help needed

Post by Benj »

Hello Jordy,

I will try and help get you up and running with these devices.

Center Freq - Main RF Channel Central Frequency

Transmitter

Freq deviation - The amount of offset to use on the central frequency to transmit a logic 1. The bigger the deviation the easier the receiver will pick up the signal but the less RF channels that can co-exist together at the same time.

Power - The amount of power used to drive the transmitter circuitry. The higher the better unless you are tuning your system to run on batteries etc.

Receiver

Bandwidth - The maximum amount of offset to expect on the central frequency. If this is smaller then the tx freq deviation then the signal will not be received correctly. Narrowing the bandwith should help to add more co-existant devices.

Gain - The amount of amplification to provide to a signal before processing it.

Threshold - The amount of difference between a active channel and background noise. The higher the number the more noise you will receive but also the better a signal may come through.

Getting the RF modules to work can be a bit tricky as you have to balance several settings to all work together. The baud rate also has a significant impact so I would stick with 4800 bps or lower until you have a reliable connection and then take it from there.

Once you have all the settings correct the modules work really well, I managed to leave work with one and walk a few hundred yards up the road before starting to loose the signal. At least this is what I have experienced with the Alpha range of modules and the raw Microchip ICs.

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: HopeRF RFM12-S2 Modules help needed

Post by Jordy101091 »

Ben,

Thanks for your reply,
I didn't realise that the settings for these modules where so critical.
I have done some more testing I only get:

"When I read the retval of the check_buffer macro"

CRC checksum error and No Data ( if you look into my example program that I have uploaded you can see where I get the no data and CRC error error codes from.

Can you explain what these error mean and is this related to the module settings.
Also the read_tx_signal_strenght returns values greater then 3 why is this happening, sometimes I get a value of 5, 6 or 7

Regards jordy
the will to learn, should not be stopped by any price

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: HopeRF RFM12-S2 Modules help needed

Post by Jordy101091 »

Ben,

I have tryed every possible settings that i can make but I the only message i have is Timeout, CRC Error and No Data
What can I do, its super frustating want to pull my hair out :evil:

I hope you can give me some advice.

Regards Jordy
the will to learn, should not be stopped by any price

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: HopeRF RFM12-S2 Modules help needed

Post by Jordy101091 »

Hi Ben Im hooping your following my posts because I have found something really strange.

Ok here it goes:

I have configured my reciever to recieve a String Value. But I havent configured my transmitter to send a string yet. What I discovered is that on my LCD screen Im getting the message Valid Data. Mmmm whats going on here.
So I changed my transmitter for sending a byte into a string value "Test" and what do you think, the message Valid Data was gone and Im only getting a timeout message what the hell is going on here.

So I have changed it back to recieving and sending bytes, And the message CRC Error appears with ever one in a while Valid Data but not continues as you would expect. I have tryed every possible combination of settings but nothing seems to work.

Is my flowcode correct, is the component macro correct I dont know, bassicaly Im at a point that I dont know what I doing anymore, just dumb way trying.
I cannot get the settings correct.

In one way Im thinking "yeag what the hell, Im done with it" and On they other hand "No way Im going to quit this, That &^%$% is going to work on way or the other"

So please I can use any help you guys can give me,
I dont want to sound desparate :roll:

Any way thanks for trying

Regards Jordy
the will to learn, should not be stopped by any price

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: HopeRF RFM12-S2 Modules help needed

Post by Benj »

Hi Jordy,

I will test this for you now and get back to you.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: HopeRF RFM12-S2 Modules help needed

Post by Benj »

Hello,

Right I think I have replicated your findings. Data is getting through but not every transmission is successful.

I will see if I can sort it out for you.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: HopeRF RFM12-S2 Modules help needed

Post by Benj »

Ok I have managed to fix the problem.

It seems to be caused by the SPI running too fast and therefore the RF modules sometimes don't sync up quite right.

To fix the problem you must use the custom code on the RF component in both of your programs.

The function you need to edit is the [defines] function.

Scroll down and you will find this line.

Code: Select all

	#define MX_SPI_PR_SCALE_1		4
Change to this.

Code: Select all

	#define MX_SPI_PR_SCALE_1		16
There are 4 SPI slots so I would advise changing for the other 3 slots too just in case there is another SPI based component using slot 1.

Please note I am currently using the hardware SPI version.

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: HopeRF RFM12-S2 Modules help needed

Post by Jordy101091 »

Hi ben Thanks for your quick reply.
I will test this as soon as possible I'm at work now.

Any way big thanks for helping me.

Regards jordy
the will to learn, should not be stopped by any price

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: HopeRF RFM12-S2 Modules help needed

Post by Jordy101091 »

Ben,

you are fantastic, some much thanks for you by settings the prescaler to 16 for all 4 SPI Slots made it to work.
Thank you so much.

If I can ever do something for you in return, you can ask me.

Again Thank you.

Regards Jordy
the will to learn, should not be stopped by any price

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: HopeRF RFM12-S2 Modules help needed

Post by Benj »

Hi Jordy,

Thanks for letting me know and glad it's working for you. All in a days work, sorry it took so long to get resolved.

Post Reply