Just as an update to anyone that may be interested... My issue was in fact due to RAM usage. I switched from using the GOFi2cOLED library to the u8glib library to drive my OLED display and my ram usage dropped from 91% to 45%. Most OLED libraries (including ADAFRUIT which is the base code for GOFi2cOLED) are going to store the display buffer in ram which makes them a memory hog. Using a 128x64 display means you will consume 8192 bytes just for the display buffer @ 1 byte per pixel, add on top of that all the operational code. The u8glib "pages" the display buffer meaning it can essentially make the buffer as small as you need at the cost of slowing down the refresh rate. For just plain text its not an issue and the paging is not visible on the screen.
Best posts made by d4rkr3b3l
-
RE: [Solved] PVER Mismatch with MY_DEBUG
-
RE: [Solved] Non-healing !TSM:MSG:LEN error hours into run
So I seem to have figured out my issue. Long story short, it was the brushed motor putting noise on the power lines going to the nrf24 radio.
I was able to isolate the root cause to be a conducted susceptibility of the radio (ie. The motor was inducing noise onto the power lines of the radio) which caused communication issues between the radio and the arduino. Due to not having an O'scope at home to characterize the noise I was isolating the issue through process of elimination. I was able to get the same message length errors by unplugging the power lines to he radio after communications had been established. I then tried running my sketch, with the motor unplugged, and I never got the errors. I also powered the motor through a separate external power supply and never got the errors. This last step showed that there was a conducted issue instead of a radiated issue from the sparking of the brushes inside the motor.
I tried to clean up the power lines by doing the following, none of which caused the error to go away:
- added 2 additional .1uF caps to the motor (already had 1 from motor terminal to terminal, added 1 from each terminal to motor case)
- added a 100uF cap on he 3.3v bus of he arduino
- added additional 100nF and 10nF ceramic caps to the radio terminals to filter out higher frequencies that he 100uF and 47uF caps can't filter.
After doing all this I was surprised that the errors persisted, so I focused on cleaning up the regulation. After I did the following, most of my issues went away:
- moved ceramic caps (10nF and 10nF) directly on the nrf24 board.
- upgraded my 3.3v regulator to an LD33 TO-220 package
- added a series inductor (33uH) after the regulator and before the 147uF worth of of bypass caps
After I did this, most of the msg length errors went away with the exception of 1 or 2 right when i turn the motor on. I added a second 33uH inductor bringing my total series inductance to 66uH. With this last change all my message length errors went away.
-
RE: [Solved] PVER Mismatch with MY_DEBUG
I think my code is pretty well optimized. Short of using PROGMEM for my strings I'm not sure what else to do. As soon as I start using the OLED library, memory usage jumps by about 50%. I think I'll need to look into using a different i2cOLED library, or modify the one that I'm trying to use.
Thanks for the input!