Project

General

Profile

FORTH & RF69 & RF12 network

Added by arwed about 1 year ago

Hi,

I've bought one of these nice little STM32 boards (actually the second from right in the picture in http://jeelabs.org/article/1610a/) and was successful in setting up a Mecrisp installation. Meanwhile I'm trying to recapture my former FORTH knowledge ...

Currently I'm playing with an RF69 chip connected to the STM32 as desribed and after rf-init I can query the RF registers via rf. So I think everything is fine so far.
Unfortunately I do not receive any packet from my little home network, build with the old RF12 chips on JeeNodes and EmonTx boards.
Is there some kind of "RF12 compatibility" option similar to the arduino library?

I'm using network group 210 and plain 868MHz nodes, that's why I changed the init values to

210 8686 rf-init <CR>

After that I see the registers as

rf. <CR>
     0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F 
00: -- 10 00 02 8A 02 E1 D9 26 40 41 60 02 92 F5 20
10: 24 9F 09 1A 40 B0 7B 9B 08 4A 42 40 80 06 5C 00
20: 00 FB CD 00 C8 00 07 90 00 A0 00 00 00 05 88 2D
30: 2A 00 00 00 00 00 00 D0 42 00 00 00 8F 12 00 00
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00
50: 14 45 88 08 00 00 01 00 1B 09 55 80 70 33 CA 08 ok.

I was also playing with some other frequencies (8680, 8681 etc.) -- but nothing appears.

Does anyone have an idea? Any help is very appreciated.
Thanks a lot and best regards
Arwed

(edited by jcw - verbatim code block formatting requires triple-backticks iso tildes, as on GitHub)


Replies (11)

RE: FORTH & RF69 & RF12 network - Added by arwed about 1 year ago

Just saw that rf-init leaves freq and group on stack when finished -- was that intended?
~~~
210 8686 rf-init ok.
u. u. 42 210 ok.
u. 3031925178 Stack underflow
~~~
Actually it's correct according to the current code in rf69.fs:
~~~
: rf-init ( group freq -- ) \ init the RFM69 radio module
spi-init
$AA rf-check $55 rf-check \ will hang if there is no radio!
rf:init rf-config!
rf-freq rf-group ; \ <---- here; why this?
~~~

Arwed

RE: FORTH & RF69 & RF12 network - Added by jcw about 1 year ago

The Forth driver only implements RF69 native mode. You could try using the RF12 driver from JeeLib in "compat" mode, but these cross-mode implementations always place one of the sides in a (very) non-standard setup, which may reduce the range or success rate of proper exchanges.

rf-freq rf-group ; \ <---- here; why this?

These are not values, they take values from the stack and store them in the radio module.

RE: FORTH & RF69 & RF12 network - Added by arwed about 1 year ago

Hi Jean-Claude,

ok, that means I will switch over to RFM69 modules for my ATMega nodes as well. ... For doing some first tests I used the native driver as you presented in the article http://jeelabs.org/book/1522c/index.html. With rfdemo I was able to receive the packets at the STM32 from the ATMega node. But I got stuck in sending some data from the STM32 board.
I tried
~~~
0 variable data
77 data ! \ store a magic number
data 2 28 rf-send \ send 2 bytes from address of data to id 28 (ATMega running RF69demo.ino) -- correct?
~~~
I got an ok, but the ATMega did not show any received data.

I expect to have made a mistake in preparing the data for rf-send.
Could anyone please give a little example for sending from Mecrisp? Would be really great ...

Regarding my last question:
OK, understood the purpose of rf-group. But I still think that rf-group should get a final drop or end with rf! instead of rf@
~~~
: rf-group ( u -- ) RF:SYN2 rf@ ; \ set the net group (1..250)
~~~
shouldn't it?
At least after each rfdemo the stack is not clean but contains the group id.

Thanks a lot!
Arwed

RE: FORTH & RF69 & RF12 network - Added by jcw about 1 year ago

end with rf! instead of rf@

Aha, of course! - Fixed now, thx.

RE: FORTH & RF69 & RF12 network - Added by arwed about 1 year ago

And could you -- please -- give a little example for sending RFM69 data with rf-send?
Although playing around with this and that; I cannot receive any data from the STM32 (running Mecrisp) on another RFM69 node (ATMega, running arduino RF69 demo).

Any help highly appreciated ...
Arwed

RE: FORTH & RF69 & RF12 network - Added by arwed about 1 year ago

Hi, I played something more around and also compared the code with the Arduino C code in rf69.h To me it looks like there is something wrong with the header data. But I'm not an expert in RFM data transmission details ...

Arwed

RE: FORTH & RF69 & RF12 network - Added by jcw about 1 year ago

Thanks for looking into this - I'm not sure sends are working reliably, this was one of the last things I added & briefly tried... I will look into this in the coming days. It may well be that the header setup is peculiar at the moment - or some other unfinished business.

RE: FORTH & RF69 & RF12 network - Added by jcw about 1 year ago

Hm, did a quick test, on one board I have "rfdemox" running.
Then on the other I do "42 8686 rf-init" and "1234567 txtry" - the first one reports:

OKX 800131323334353637

As expected. The two units are about 25 cm apart (txtry sets power level to 15 out of 31).
Both are based on HyTiny's, i.e. STM32F103RB's with an RFM69 radio attached, running the rnw code.

RE: FORTH & RF69 & RF12 network - Added by jcw about 1 year ago

Top right is the RF Node Watcher (SSEL = PA4).
Bottom uses a base board and an Arduino shield w/ RFM69 (SSEL = PA15).
Each on their own Black Magic Probe for serial port access.

DSC_5351.jpg (213 KB)

RE: FORTH & RF69 & RF12 network - Added by arwed about 1 year ago

Hah! Here we go! There were two problems that I was not aware:
1. I did not set rf-power before.
2. I tried to send plain numbers instead of strings.

Now it works!
Great. Thanks a lot. No I will try to bring my old RFM12 nodes into RF69 compatibility mode and update all existing JeeNodes (et al.) to RF69 mode.

Regarding data protocol: the leading 0x80 is the header byte and encodes in the lower bits the originating nodeID (here node 0), correct?
And what about the second byte, here 0x01?

You made my day! Thanks again.
Looking forward to midnight, when your next weblog post will (hopefully) appear ... ;-)

RE: FORTH & RF69 & RF12 network - Added by jcw about 1 year ago

First byte is destination - 0 = broadcast. Top two bits come from xor-ed group bits.
Second byte is origin (1..60). Top two bits are for ACK req/reply.
This evidently needs a write-up...

    (1-11/11)