Arduino Due RF24 SPI不工作

时间:2017-06-08 17:54:25

标签: arduino spi arduino-due

我想将RF24连接到Arduino Due,但它无法正常工作。 Arduino Due板运行在3.3,所以我需要使用逻辑电平转换器,因为RF24引脚使用5v,Vcc(3.3v)除外。我将MISO / MOSI / SCK连接到电路板上的ICSP接头,并将CSN连接到引脚10,将CE连接到引脚9。

代码:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL; 
int LED1 = 13;

void setup() {
  Serial.begin(115200);
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
  delay(20);
  pinMode(10, OUTPUT);
  radio.begin();
  radio.setRetries(15,15);
  radio.openReadingPipe(1,pipe);            
  radio.setPALevel(RF24_PA_LOW);
  radio.printDetails();
  radio.startListening();
}

void loop() {
  byte gotByte;  
  while( radio.available()){  
    radio.read( &gotByte, 1 );                                                              
    Serial.println(gotByte);  
  }
}

输出(printDetails):

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    = 0xff 0xff

Data Rate    = 1MBPS

Model        = nRF24L01

CRC Length   = 16 bits

PA Power     = PA_MAX

输出没有意义,我做错了什么?

图书馆:https://github.com/nRF24/RF24

0 个答案:

没有答案