Problems with packetgen

I'm doing some work on a central heating controller and have reached the stage where I'm sending set point changes etc from my RaspberryPi + HDD setup via the RFM12Pi using the packetgen module. I have come across an issue with packet sizes > 20 bytes resulting in the later values above this size being corrupt. Checking rfm12piphp.log I'm seeing the following for packets > 20 bytes 

MESSAGE RX:> 0s

LENGTH: -> 20 b

The size of packets below <= 20 bytes is reported (and the packet received) correctly but once the packet exceeds 20 bytes the length continues to be reported as 20 b.

I'm perusing the code but can't fathom the problem as yet, I'm using the RFM12Pi v2 purchased in the OEM shop a few months ago so I'm guessing the firmware should be ok.

Bra1n's picture

Re: Problems with packetgen

Hmmm 59 reads and no comments :(

I've worked round the problem for now by removing the hr, min and sec fields to reduce the packet size below 20 bytes (I've got an RTC on board the CH controller and can manage without them)

cybergibbons's picture

Re: Problems with packetgen

I'm going to try and get this going next week, and suspect I will need to send longer packets as well.

I'll get back to you with anything I find.

Bra1n's picture

Re: Problems with packetgen

Cheers for that.

I'm thinking I may have to rewrite some of it anyhow as I don't need (or want) to be sending packets continuously, just when set-points are changed or the heating schedule is overridden. I'm currently checking for the packets arrival then setting the send interval to zero but it's all a bit clunky.

I would prefer just to send the packet to a specific node using an ack to indicate it's been received correctly. I'll have to have a look at making a custom version of rfm12piphp

Bra1n's picture

Re: Problems with packetgen

I've upgraded the RFM12Pi firmware to the latest version due to an RFM12Pi crash but the problem with packets over 20 bytes persists.

Bra1n's picture

Re: Problems with packetgen

I've looked at the firmware code here https://github.com/mharizanov/RFM2Pi/tree/master/firmware and it looks to me (although I'm a C++ novice) as if the buffers used for sending are declared as byte arrays of size 20 (stack[20] and testbuf[20]) which I believe would explain the issue I'm seeing.

Bra1n's picture

Re: Problems with packetgen

I've increased the buffer sizes to 66 and uploaded the new firmware to the RFM12PI , initial tests seem ok but I'll test a bit deeper then submit a pull request if no problems arise.

Bra1n's picture

Re: Problems with packetgen

I've submitted a pull request for the above change https://github.com/mharizanov/RFM2Pi/pull/8

Bra1n's picture

Re: Problems with packetgen

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.