0

Will the nrf24l01 work with the Atmega 32u4 if I am using the 32u4's internal clock, or must I have an external clock source?

  • Knowing the interface between nrf24l01+ and Atmega32U4 is also answer to your question. And even with using asynchronous serial it should be possible (but might be less reliable sometimes) – KIIV Jun 6 at 16:32
  • Connecting to nrf24 via CE, CSN, SCK, MOSI, MISO - I have the nrf24 working fine on my Pro Micro, now trying it on my custom pcb where I do not use an external oscillator. My custom pcb works fine other wise, including the SPI as I have another device working on the SPI. Just not working with the nrf24. – NewToArduino Jun 6 at 17:07
  • 1
    And SPI is synchronous interface, so there is a master sending CLK signal to clock data to selected slave – KIIV Jun 6 at 17:10
  • Correction, My other device is connected via I2C, not SPI. But I am programming the 32u4 via SPI. – NewToArduino Jun 6 at 17:14
  • Without at least schematics, test scenarios and so on (what works or not works and where), it's hard to guess. – KIIV Jun 6 at 17:24
1

You ask a yes/no question, to which the answer is yes, nRF24L01 as a serial peripheral device will work as well as if you had used an Arduino UNO or any other microcontroller, provided the SPI bus is correctly initialized.

Generally you want the following in the setup() part of your sketch/program:

  pinMode(CE_pin, OUTPUT);//chip enable set as output
  pinMode(CSN_pin, OUTPUT);//chip select pin as output
  pinMode(MOSI_pin, OUTPUT);//SPI data out
  pinMode(MISO_pin, INPUT); //SPI data in
  pinMode(SCK_pin, OUTPUT);//SPI clock out

  digitalWrite(CSN_pin, HIGH);//SPI idle
  digitalWrite(CE_pin, LOW);

  SPI.setBitOrder(MSBFIRST);//SPI Most Significant Bit First
  SPI.setDataMode(SPI_MODE0);// Mode 0 Rising edge of data, keep clock low
  SPI.setClockDivider(SPI_CLOCK_DIV2);//Run the data in at 16MHz/2 - 8MHz
  SPI.begin();//start up SPI library

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.