Project

General

Profile

arduiNode rfm12 mesh lib

Added by Jan about 7 years ago

Hi to all,
this is meant as a continuation of the old thread, which can be found here: http://forum.jeelabs.net/node/1411

I have a big problem with my library and i hope that someone of the forum can help me out. while developing i compiled the lib with make. everything was just fine then. for several weeks i now try to get it done with the arduino ide but i always get this error:

arduiNode_MASTER.cpp.o: In function `setup':
/arduino-1.0.3/arduiNode_MASTER.pde:18: undefined reference to `rfm12_tick()'
arduiNode/arduiNode.cpp.o: In function `arduiNodeSetup(unsigned char)':
/arduino-1.0.3/libraries/arduiNode/arduiNode.cpp:54: undefined reference to `rfm12_init()'
arduiNode/transport.cpp.o: In function `pktDaemon()':
/arduino-1.0.3/libraries/arduiNode/transport.cpp:27: undefined reference to `sendBufferRFM12()'
/arduino-1.0.3/libraries/arduiNode/transport.cpp:72: undefined reference to `sendBufferRFM12()'
/arduino-1.0.3/libraries/arduiNode/transport.cpp:56: undefined reference to `sendBufferRFM12()'
/arduino-1.0.3/libraries/arduiNode/transport.cpp:81: undefined reference to `sendBufferRFM12()'
/arduino-1.0.3/libraries/arduiNode/transport.cpp:151: undefined reference to `sendBufferRFM12()'
arduiNode/transport.cpp.o:/arduino-1.0.3/libraries/arduiNode/transport.cpp:163: more undefined references to `sendBufferRFM12()' follow
arduiNode/transport.cpp.o: In function `pktDaemon()':
/arduino-1.0.3/libraries/arduiNode/transport.cpp:212: undefined reference to `rfm12_poll()'
/arduino-1.0.3/libraries/arduiNode/transport.cpp:212: undefined reference to `rfm12_poll()'

this is the same with 1.0.1 and 1.0.3 as well as the old versions (18 and 22)
to be honest with you, i dont understand the problem.. everything is included in the file includes.h and as stated before, with make it compiles..
the sources can be found here: http://code.google.com/p/arduinode/source/browse/\#svn%2Ftrunk%2Farduinode
any help is greatly appreciated!
jan


Replies (8)

RE: arduiNode rfm12 mesh lib - Added by tht about 7 years ago

Hi Jan,

Is /arduino-1.0.3 your main Sketches directory? Arduino needs the files to be in there to work. Maybe this document could help you: http://arduino.cc/en/Hacking/BuildProcess

Good luck! I’m looking forward to test ArduiNode!

Thomas

RE: arduiNode rfm12 mesh lib - Added by Jan about 7 years ago

Hi Thomas,
thanks for your tip!
/arduino-1.0.3 is the directory where the arduino1.0.3 files are located. the arduiNode lib is in the library dir and the sketch i try to compile is in the lib/arduiNode/example dir. should not be the problem i think.. damn!

the file which gives the include problems is in /arduiNode/driver/rfm12/ dir, could it be that its too deep in the file system? i updated the svn to my local version, so if you need a challenge you can always give it a try ;)

RE: arduiNode rfm12 mesh lib - Added by tht about 7 years ago

Move (or symlink) everything into your Arduino Sketches directory (SketchesDir/libraries). This is the only way Arduino will find and compile all the required .cpp files. Don’t go too deep inside SketchesDir/libraries. First level for library-name and I know that one additional level is ok too. Don’t include other.cpp, .c,.h which do not belong to the library itself inside libraries/arduiNode/examples to make sure Arduino does not try to compile them. And don’t forget to restart the Arduino IDE whenever you’ve added or removed a file from the libraries folder.

I think this whole build-system is quite a mess. Works well for beginners with a few libraries but fails horrible as soon as you start adding more libraries.

I’ll test arduiNode, that’s for sure. But my spare time is quite limited right now and I don’t have JeeNodes left. So some soldering has to be done first…

Looks like you bring your own RFM12B driver code. does your code have any kind of checksum included? There are JeeNode packets flying around here.

RE: arduiNode rfm12 mesh lib - Added by Jan about 7 years ago

yeah well maybe the dir depth is too high then. will check tonight after work, thanks for the hint!

is there a documentation about the jee node packet format some where? for the moment i dont have a checksum, but i would like to include one. thought of crc16 of the hole packet with header.

at the moment i implement some sort of application layer, where certain functions are called depending on the number of the first data byte. the user can configure this feature in setup() and use it to process data differently. hope to solve this nasty bug soon!

RE: arduiNode rfm12 mesh lib - Added by tht about 7 years ago

How deep it’s in the filesystem should not matter as paths are very long at my place. I also do have spaces in the path, this works too. It’s only the depth inside the libraries-folder which could be a problem.

You have to include a checksum as transmit errors are relatively common. Bad things could happen if there arrive some wrong values…

The JeeNode packet format is described here: http://jeelabs.org/2011/06/09/rf12-packet-format-and-design/ The 16bit CRC starts with the groupid and includes header, len and all payload bytes.

If you do a ‘#include ’ you’ll get the crc16_update(…) as described here: http://www.nongnu.org/avr-libc/user-manual/grouputil_crc.html . That’s the one used on JeeNode packets.

Pleas don’t make it too compatible with JeeNode packets as it should be possible for all of us to test arduiNode without disturbing the existing communication too much. It should (at least) be a different groupid by default.

RE: arduiNode rfm12 mesh lib - Added by Jan about 7 years ago

me too i meant the dir-depth inside the lib :)
thanks for the links!
as for crc i am thinkink of using a 8bit crc http://www.nongnu.org/avr-libc/user-manual/group\_*util*\_crc.html, do you have any experience with this? i want to keep resource usage as small as possible.

the compatibility with jee nodes isnt there, as i have no group ids and only 2 bytes preamble.

RE: arduiNode rfm12 mesh lib - Added by tht about 7 years ago

The preamble and GroupID are actually from the RFM module itself ;-). The GroupID is the second byte of the synchron pattern as set with 0xCExx during initialization, it defaults to 212. Do you know the article about RFM12B on mikrocontoller.net (german)? http://www.mikrocontroller.net/articles/RFM12 . It helped me a lot while rewriting some parts on the existing RFM12 driver.

I don’t think it really does matter if you use a 8 or 16bit checksum. Even the smallest possible packet has at least 6 bytes and do we really care if it’s 7 or 8 bytes long at the end? So use whatever you like. I do have some experience using this 16bit CRC but never analyzed it on an ATmega. On a ARM Cortex-M4 it needed about 30µs for 10 bytes (+3µs per additional byte) for the CRC calculation. I was able to offload this task to the hardware CRC unit in this IC which was quite a bit faster: 3µs for 10 bytes (+0.25µs per additional byte)

So actually using an 8bit crc will make sure all your packets are incompatible to JeeNode packets. Sounds like a good idea…

RE: arduiNode rfm12 mesh lib - Added by martynj about 7 years ago

Choosing a different GroupID to keep traffic segregated is preferred - then ‘wrong protocol’ incoming packets will reject at hardware level and not generate any driver interrupts.
Curiously, not all Group ID’s are created equal. The bit pattern of the first synchron byte (fixed 2Dh) + the default second byte (D4h) is carefully chosen. This is because on marginal signals, the receiver section is still busy adjusting to the received actual frequency and deviation. Reducing the rate of deviation change (by having two of the same bit states in a row) then a ‘flick-flack’ helps. E.g. Group ID = 0, bad choice, not enough transitions, Group ID = 211, good - similar structure, 3 bit cells different from 212.

    (1-8/8)