Electric Potato
Well-known member
Teensy LC + nrf24l01 = BRICK
Hey all,
I've got an nrf24l01 wireless sketch running smoothly between two T3.1's. I'd like to change the transmitter to a Teensy LC, but have found that simply dropping the new board into the system doesn't work. In fact, loading the transmitter sketch onto the TLC bricks it, so that it doesn't make it into the main loop. **I found that the line that's bricking the TLC is radio.openReadingPipe() . I'll look at the library source but it might be beyond me.
The library I'm using is recommended here:https://forum.pjrc.com/threads/24307-nRF24L01-working-in-Teensy-2-0-and-Teensy-3-0?highlight=nRF24L01%2B
************EDIT
As far as I've been able to discern, this is the method that bricks TeensyLC:
**************
If it helps, here is the transmitter test sketch I'm using:
Thanks for any assistance!
Hey all,
I've got an nrf24l01 wireless sketch running smoothly between two T3.1's. I'd like to change the transmitter to a Teensy LC, but have found that simply dropping the new board into the system doesn't work. In fact, loading the transmitter sketch onto the TLC bricks it, so that it doesn't make it into the main loop. **I found that the line that's bricking the TLC is radio.openReadingPipe() . I'll look at the library source but it might be beyond me.
The library I'm using is recommended here:https://forum.pjrc.com/threads/24307-nRF24L01-working-in-Teensy-2-0-and-Teensy-3-0?highlight=nRF24L01%2B
************EDIT
As far as I've been able to discern, this is the method that bricks TeensyLC:
Code:
void RF24::openReadingPipe(uint8_t child, uint64_t address)
{
// If this is pipe 0, cache the address. This is needed because
// openWritingPipe() will overwrite the pipe 0 address, so
// startListening() will have to restore it.
if (child == 0)
pipe0_reading_address = address;
if (child <= 6)
{
// For pipes 2-5, only write the LSB
if ( child < 2 )
write_register(pgm_read_byte(&child_pipe[child]), reinterpret_cast<const uint8_t*>(&address), 5);
else
write_register(pgm_read_byte(&child_pipe[child]), reinterpret_cast<const uint8_t*>(&address), 1);
write_register(pgm_read_byte(&child_payload_size[child]),payload_size);
// Note it would be more efficient to set all of the bits for all open
// pipes at once. However, I thought it would make the calling code
// more simple to do it this way.
write_register(EN_RXADDR,read_register(EN_RXADDR) | _BV(pgm_read_byte(&child_pipe_enable[child])));
}
}
If it helps, here is the transmitter test sketch I'm using:
Code:
#include <stdio.h>
#include <EEPROM.h>
#include <SPI.h>
#include <RF24.h>
//radio stuff
RF24 radio(7, 8);
const uint64_t pipes[3] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL, 0xF0F0F0F0C3LL };
byte noteOnCommand = 0x90;
byte noteOffCommand = 0x80;
elapsedMillis testTimer;
boolean testFlip = true;
void setup (){
Serial.begin(9600);
radio.begin();
radio.setRetries(15,15);
radio.setPayloadSize(2);
radio.setChannel(0x4c);
radio.setPALevel(RF24_PA_MAX);
radio.setDataRate(RF24_250KBPS);
radio.openWritingPipe(pipes[0]);
radio.openReadingPipe(1,pipes[1]);//this line locks up the teensyLC
radio.powerUp();
radio.startListening();
testTimer = 0;
}
void loop(){
if(testTimer >1000){
if(testFlip)
noteOnWirelessRelay(noteOnCommand,90);
else
noteOnWirelessRelay(noteOffCommand,90);
testTimer = 0;
testFlip = !testFlip;
}
}///////END OF MAIN LOOP
void noteOnWirelessRelay(byte koomand, byte note){ //sends a message for a single note on
byte payload[] = {koomand,note};
radio.stopListening();
bool ok = radio.write( &payload, sizeof(byte)*2 );
radio.startListening();
}
Thanks for any assistance!
Last edited: