Aurora on SmartMatrix + RF24 Library – Apparently broken :(

OK so I’ve spent this afternoon trying to get Aurora equipped with wireless sync using nRF24L01 2.4GHz radios. I’ve used these radios for other projects, and they work great. They are not technically a “WiFi” and do not connect to any network, but instead create their own mesh networks. One radio can “speak” to up to five others, and they cost $2 each. Using the brilliant RF24 library communication between them is a breeze. Well, most of the time :slight_smile:

What the hell am I doing?:

So I have Aurora running on SmartMatrix with no SD card, but with the MSGEQ7 chip, and the infrared receiver. Audio input and audio-sensitive patterns work great, infrared control also works.

I want to have several SmartMatrices running Aurora but synced over the wireless network. Imagine a four corner dancefloor. Each corner has a SmartMatrix. One of the four is connected to the live audio input, and transmits 30 times a second the following info: current playlist, current pattern, and the 7 audio bands. This allows the other 3 matrices to show the same patterns, and to “react” to the same beat without being actually wired to the audio. Neat? I think so. I really thought I could do this all in one Sunday, and to be honest I got ridiculously close. The only issue now is that when combined with the Aurora software, RF24 library spews corrupted data, and acts as if there is data to receive all the time.

There are two versions of the RF24 library:

I’ve mapped the radio to the pins unused by the matrix. I can load the radio sketch onto the Teensy while it’s connected to SmartMatrix, and it works like a charm, communicating with another teensy. So the hardware is wired correctly and definitely works. The issue is in the software somewhere.

To get RF24 spew crap here is what I added:

// somewhere at the top
#include <RF24.h>
RF24 radio(15,16);  // chip select, CS (note that I commended out SD card pin reset)
.....
void setup() {  
     Serial.begin(115200);
     delay(250);
     radio.begin();
     radio.printDetails();
 }

The printDetails() method normally (and without Aurora on the same hardware) prints the following info:

STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0x7276636552 0x72646e6553
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR          = 0x7276636552
RX_PW_P0-6       = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA            = 0x3f
EN_RXADDR        = 0x03
RF_CH            = 0x4c
RF_SETUP         = 0x03
CONFIG           = 0x0e
DYNPD/FEATURE    = 0x00 0x00
Data Rate        = 1MBPS
Model            = nRF24L01+
CRC Length       = 16 bits
PA Power         = PA_LOW

However: when the same code is run together with Aurora, it outputs this garbage:

STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0x7276636552 0x72646e6553
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR          = 0x7276636552
RX_PW_P0-6       = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA            = 0x3f
EN_RXADDR        = 0x03
RF_CH            = 0x4c
RF_SETUP         = 0x03
CONFIG           = 0x0e
DYNPD/FEATURE    = 0x00 0x00
Data Rate        = FF� F
Fodel            = 0����p FF
 ��d(��Fd$)F"F  H
                 �.�    Kp      K`      K�𴿲\CK<`��p@��詿
CRC Length       = ��d(��Fd$)F"F        H
                                         �.�    Kp      K`      K�𴿲\CK<`��p@��詿
PA Power         = �C�FKFFF

Obviously subsequent to this, using radio is useless, so I am trying to get just this part working – simple radio initialization. If anyone had seen this problem before or knows where to look, I’d be much obliged. Thanks!

Konstantin

It could just be low on RAM, Aurora is really maxing out the Teensy. Try deleting a few patterns that take up RAM, @Jason could point out which ones those are.

Have you tried a simple SmartMatrix sketch running RF24? Take something simple like Bitmaps or even FastLED_Functions and add your RF24 stuff to it and make sure that works. It could be the low-priority interrupt that is refreshing the panel is interfering with the RF24 library.

I agree with Louis, I would try to get it working outside of Aurora first. If RAM end up being the issue, we can work on making it easier to disable the biggest offenders.

I haven’t found a good way to inspect the memory use. Here are what I assume to be the largest single uses of RAM:

  • leds2 buffer (in effects.h) used by the noise streaming effect uses 3K
  • boids array (in Boid.h) likely uses around 2K.
  • noise array (in effects.h) uses 1K
  • heat array (in effects.h) uses 1K

Those are great suggestions! I’ll try the SmartMatrix demo sketch with RF24. Totally agree that it does look like a memory overwrite or insufficient, etc. These particular print out statements are using pgm macros that might be more limited in RAM than regular heap on Teensy.

I really want the sync to work wirelessly :slight_smile: It would be so kewl :blush:

Ever make any progress with this?

Not sure how much RAM RF24 requires, but tonight I was able to get Aurora working on a 64x64 display by commenting out a lot of memory-hungry features: Aurora on 64x64 display, SmartMatrix 3.0 Beta

You might be able to use the same branch (modified for 32x32 or whatever your display size is): GitHub - pixelmatix/aurora at sm3.0-64x64

Is there a timer conflict?

I don’t see any use of hardware timers in the RF24 library.