I'm working on a project to receive data by nRF24L01+ and show on 1.77" TFT module.
The nRF24L01+ and TFT module works well separately.
When put together on Duemilanove board, the TFT module still can show me some text.
But the nRF24L01+ is not working, and the radio.printDetails() gets nothing, looks like below:
Can anybody help?
STATUS = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1 = 0x0000000000 0x0000000000
RX_ADDR_P2-5 = 0x00 0x00 0x00 0x00
TX_ADDR = 0x0000000000
RX_PW_P0-6 = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA = 0x00
EN_RXADDR = 0x00
RF_CH = 0x00
RF_SETUP = 0x00
CONFIG = 0x00
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = Disabled
PA Power = PA_MIN
I followed the wiring tutorial of TFT module :
sd_cs : pin 4
lcd_cs : pin 10
d/c : pin 9
reset : pin 8
The nRF24L01+ is wiring as below:
CE : pin 7
CS : pin 6
Here is the code?
#include <SPI.h>
#include <SD.h>
#include <TFT.h> // Arduino LCD library
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
// pin definition for the Uno
#define sd_cs 4
#define lcd_cs 10
#define dc 9
#define rst 8
TFT TFTscreen = TFT(lcd_cs, dc, rst);
//
// Hardware conf
//
// Set up nRF24L01 radio on SPI bus plus pins 9 & 10
RF24 radio(7, 6);
//
// Topology
//
// Radio pipe addresses for the 2 nodes to communicate.
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
char buffer[PAYLOAD_SIZE];
void setup(void)
{
// initialize the GLCD and show a message
// asking the user to open the serial line
TFTscreen.begin();
TFTscreen.background(255, 255, 255);
TFTscreen.stroke(0, 0, 255);
TFTscreen.println();
TFTscreen.println("Arduino TFT Bitmap Example");
TFTscreen.stroke(0, 0, 0);
//
// Print preamble
//
Serial.begin(9600);
printf_begin();
// clear the GLCD screen before starting
//TFTscreen.background(255, 255, 255);
// try to access the SD card. If that fails (e.g.
// no card present), the setup process will stop.
Serial.print("Initializing SD card...");
if (!SD.begin(sd_cs)) {
Serial.println("failed!");
//return;
}
Serial.println("OK!");
//
// Setup and configure rf radio
//
radio.begin();
radio.setRetries(15,15);
//radio.setChannel(0x4c);
//radio.setPALevel(RF24_PA_MAX);
//radio.setDataRate(RF24_2MBPS);
//radio.setPayloadSize(PAYLOAD_SIZE);
radio.openWritingPipe(pipes[0]);
radio.openReadingPipe(1,pipes[1]);
radio.startListening();
radio.printDetails();
printf("PayLoadSize : %d\n", radio.getPayloadSize());
}
void loop(void)
{
unsigned long message;
if ( radio.available() )
{
printf("radio.available!\n");
radio.read( &message, sizeof(unsigned long) );
TFTscreen.println("message get : %ld\n", message);
}
}