Author Topic: How to speed up RFM69 data throughput on Moteino M0? [solved]  (Read 42565 times)

ChemE

  • Sr. Member
  • ****
  • Posts: 419
  • Country: us
Re: How to speed up RFM69 data throughput on Moteino M0?
« Reply #30 on: April 04, 2020, 05:50:29 PM »
Post the run mode code and I bet you I can find some more Hertz!  What else have I got to do right now?!

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: How to speed up RFM69 data throughput on Moteino M0?
« Reply #31 on: April 04, 2020, 07:49:16 PM »
Since your packets are relatively small, how about the radio's continuous mode  ;)
The pipe is open all the time, no more packet overheads, you just probably need to implement a light protocol to ensure some data CRC.
Since corona has put the entire planet on vacation indefinitely, there's plenty of time for experiments.

ChemE

  • Sr. Member
  • ****
  • Posts: 419
  • Country: us
Re: How to speed up RFM69 data throughput on Moteino M0?
« Reply #32 on: April 05, 2020, 08:39:03 AM »
That's a good thought Felix; I've never fooled with continuous mode.  A few bits of error check would be fast and easy.

jdheinzmann

  • NewMember
  • *
  • Posts: 40
  • Country: us
Re: How to speed up RFM69 data throughput on Moteino M0?
« Reply #33 on: April 06, 2020, 12:08:19 PM »
Hi, ChemE.  Not sure how you want me to post the code so, rather than take up a bunch of space inline, I am attaching the files.

I continue to be puzzled by why I see radio.sends stretch out in bursts of 3 or 4 for upwards of 10 ms each every 2.5 s.

ChemE

  • Sr. Member
  • ****
  • Posts: 419
  • Country: us
Re: How to speed up RFM69 data throughput on Moteino M0?
« Reply #34 on: April 06, 2020, 03:58:15 PM »
Right away I see that there are digitalWrites and analaogWrites in both routines which really are slow.  You can *easily* ditch them in favor of faster variants to pick up speed basically for nothing.  Obviously don't worry about anything in setup just focus on loop.  I'm also betting the floating point math happening in the remote Mote is taking some decent clock.  Why not just read the data off the accelerometer as hex, stuff it in the radio packet as hex, and let the local node handle the floating point math?

jdheinzmann

  • NewMember
  • *
  • Posts: 40
  • Country: us
Re: How to speed up RFM69 data throughput on Moteino M0?
« Reply #35 on: April 06, 2020, 06:33:06 PM »
Hi, ChemE.  Yes, all good points.  Though the macros for toggling digital pins worked in Felix's library, I could not figure out how to do it from the sketch so I abandoned them there.  (I could not figure out what to #include to have OUTCLR and OUTSET defined).  Unless I can get them working from the sketch, I will wrap the digitalWrites in #if DEBUG_MODE #endifs so that I can easily turn them back on for debug and timing studies.  I hadn't thought about the write to the DAC.  Will do the same there.

I calculate angle from the X and Y accelerometers remotely because I only want to send data when it is important to send it.  Like after the shaft has gone 2° or reached top dead center (TDC).  If I do it on the local side, that information will be coming across more slowly and the decisions to use the data will be belated.  Doing it on the remote side I can do it nearly instantly.  This is especially important for me in precisely indicating TDC.

I should mention that there are changes I made in RFM69.cpp that aren't included in the files I posted.  The only one that has survived is the SPI clock speed up.  I eventually found that things weren't as stable with the changes to stop SPI thrashing so I took them out.  Sorry to say, I even took out the pin toggle speed ups (I can't remember exactly why).  I just put them back in and the radio.sends dropped from 1.5 ms to 1.44 ms.  Throughput increased from 409 to 419 Hz, so there are 10 Hz recovered. 

I've attached RFM69.cpp as I am presently using it.  Perhaps you can suggest (or even make) specific improvements there for me to try.  You can see my attempts to modify the SPI stuff in a block that is commented out.

If I understood all this better I would pursue these things like you do, but at >400 Hz now, I am less motivated.  I'm still willing to try things though but it has to be well spelled out.




jdheinzmann

  • NewMember
  • *
  • Posts: 40
  • Country: us
Re: How to speed up RFM69 data throughput on Moteino M0? [~Solved]
« Reply #36 on: April 12, 2020, 09:36:53 PM »
I declare this problem solved.  Throughput wise, it is working well enough for me to move on. 

Reliability wise, I am still puzzled by the bursts of long radio.send() durations I see every 2.5 s.  If that becomes a big enough problem, I will take it up as a separate conversation.

Thanks, Felix and ChemE for all your help! 

-JD
« Last Edit: April 12, 2020, 09:40:42 PM by jdheinzmann »