Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Connecting A Star 32U4 to nrf24L01 transceiver


#1

Hello
I am trying to connect the nrf24L01 transceiver to A-Star 32U4. Pin 13 (CSK) in RF24 library calls for pin 13 which is the LED with no pin out. There is however a CSK in SPI section of the board. What changes must I make for the library to recognize and use it?

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

Renald
RF24_config.h (1.3 KB)
RF24.h (25.2 KB)
nRF24L01.h (3.35 KB)


A-Star 32U4 and Nrf24L01
#2

Hello.

We are not really familiar with the transceiver’s library that you are using. The library code you attached in your post does not provide enough information (you only attached the header files). Can you post a link to the documentation, guide, or tutorial that you are using so we can get a better understanding of the connections between the NRF24L01 and the Arduino (or A-Star)?

- Amanda


#3

The only file left to post is RF24 C++ source file or check the link for all information regarding the transceiver.
github.com/TMRh20/RF24

Thank you
RF24.cpp (25.4 KB)


#4

Hello
For full documentation check the following:
tmrh20.github.io/RF24/

Thanks
Renald


#5

Hi, Renald.

I briefly glanced at the documentation (that you linked in your most recent post) and noticed at the top of the “Related Pages” tab:

It sounds like the SPI pins on your A-Star 32U4 can be connected to the NRF24L01 module without having to modify the RF24 library. You can find all of the hardware SPI pins on the A-Star’s ISP header and look at the pinout and components section for your A-Star version in its user’s guide as reference.

Also please note, that the SPI pins on the A-Star do not correspond to the same SPI pins on the Arduino Uno. The A-Star uses the ATmega32U4, which is similar to the Arduino Leonardo; not the Arduino Uno. You do not have to change connections for the chip-enable (CE) and chip-select (CS) pins, but you will need to connect SCK, MOSI, and MISO to the correct SPI pins (pins 15, 16, and 14, respectively) on the A-Star.

- Amanda


#6

Hello
I did connect to SPI pins 14,15,16 before and still I cannot verify that the transmitter is working.
Not sure what to do at this point.

Thanks
Renald


#7

Which NRF24L01 transceiver module are you attempting to use? I hope you are aware that most, if not all of them, run on 3.3V and will be destroyed if connected to 5V power or 5V I/O.

It would help if you posted a hand drawn diagram showing ALL the connections between the MCU and the radio, including power and ground. Be sure to clearly identify which connections go to which pins (with pin numbers and names).

You should verify that the pin numbers/names on the MCU correspond to the defaults in the library.


#8

Hello,
I drew a schematic explaining my connections and provided codes for both. I switch the controller’s program from Sender to receiver to see if there is a change. the behavior is the same " No radio available". I am going to use A Star only for both and see what happens.

Thanks
TSG
Ard_Uno_Tx.ino (2.16 KB)
Ard_Astar_RX.ino (1.81 KB)



#9

I don’t think that can work. Your diagram does not show level shifters on CE and CSN (level shifters are not required on MISO etc, as long as you have pullup resistors to 3.3V).

It is very likely that the NRF24 has been damaged.


#10

Hi
I don’t understand. The examples provided did not mention anything like level shifters. I only forgot to add the 2 resistors I added to the transmitter to emulate a joystick. Do you know of a way to test a radio to see if it is sending data without the receiver?

Regards,
TSG


#11

Sorry, I rechecked the docs and the NRF24L01 has 5V tolerant inputs. I use them with 3.3V micros and forgot that point.


#12

I looked at your code and did not see anything obviously wrong, and the wiring diagram of your A-Star to the NRF24L01 module looked fine. Did you ensure that you have the transmitter active while you were testing the receiver? (It will display “No radio available” if there is no data to be received.)

After looking further into the NRF24L01 documentation, I came across this blog post written by the original library author. Can you verify that the GettingStarted example code runs on both your Arduino Uno and A-Star 32U4 by following the instructions under the “Software” section of that blog?

If you are still having problems, can you post pictures of your actual setup showing all your connections? That way we can verify that the connections matches the wiring diagram.

- Amanda


#13

Amanda
I appreciate you trying to help. I went over my stuff so many times. The wiring is very simple. At this point, I feel that your team can get a few of those nrf24L01 and try my configuration. I invested nearly $1000 in parts from Pololu to get A Star32U4 and other stuff. I need to get the controllers working for my project. If you get 2 A Star32U4 to communicate I will be in good shape otherwise I have to return all those items and look for other MCUs.
I use the Arduino Uno for ease but the goal is to use (2) A Star32U4 in pairs or network for the project. You can check my orders if you would like. I am tired of searching for the answer all week. I have been building stuff for many years.

Renald Surpris


#14

Renald, you give up too easily. These radios aren’t hard to use, and (perhaps tens of) thousands of people have successfully used them with Arduino Unos and other variants. I am absolutely confident that they will work with A-Star.

Evidently, you have not yet established that your radios are actually functional. I suggest to get a pair of radios working with Arduino Unos or Pro Minis (for which there are many working examples), and then, after you know how they work and what to expect, migrate to the A-Star.

I use the ManiacBug library and recommend this very clear example, using Pro Minis for starters: gammon.com.au/forum/?id=12821

Finally, it seems very unreasonable to expect the Pololu engineers to make someone else’s library work with yet another manufacturer’s product. Why not use Wixels instead?


#15

Considering that the RF24 library is “fully compatible with Arduino Boards” (quoted from this page of the documentation) and it works with other Arduino boards (as Jim stated), I suspect the library will also work with our Arduino-compatible A-Star controllers. However, it is difficult to help you troubleshoot if you are not willing to verify that your modules are functional. Has the NRF24L01 module ever worked with your Arduino Uno before you tried using it with an A-Star?

It sounds like you are giving up on trying to get this to work yourself, which is unfortunate. As Jim said, it is not reasonable to expect us to figure out how to get your project working on our own, though we did look around to see if we have any nrf24L01 modules around the office (unfortunately, we don’t). However, we are still willing to help you. If you want to continue troubleshooting, can you try one of the examples that Jim and I linked in our posts and let us know which example you tried and what the results are? Also, can you post pictures of your setup showing all your connections?

- Amanda


#16

I do appreciate your help. I have not given up yet. I just purchase an extra Arduino UNO to test with the other one. I will let you know the result since both will use the same setup.
Thank you again
TSG


#17

Amanda
I was able to successfully make 2 Arduino Uno to communicate. However, when I replaced one UNO with A Star using the same nrf24L01, it does not work. Take a look at the previous schematic I sent before. It seems there is a problem with the SPI connections. All I do is reconnect the same transceiver to SPI in A Star and load it using the right COM and Controller selection. Something about the A Star when it comes to SPI is not working.
TSG


#18

[quote] It seems there is a problem with the SPI connections[/quote]What is the evidence for the above assertion?
What actually happens when you run the program on the A Star?


#19

Hello
I use the same pin for CE and CSN on both modules Arduino Uno and A Star. The others, MISO, MOSI and SCK are directly attached to SPI on A Star. The transmitter is sending values X=220 and Y=450. The receiver on Arduino Uno is showing the values but when I connect A Star I get something else:

no radio available
no radio available
no radio available
no radio available
no radio available
X = -1 Y = -1
X = -1 Y = -1
X = -1 Y = -1
X = -1 Y = -1
X = -1 Y = -1
X = -1 Y = -1
X = -1 Y = -1
X = -1 Y = -1
X = -1 Y = -1
no radio available
no radio available
no radio available
no radio available

Sometimes the SCK pin is not connected and I get the same result shown above.
Thanks
TSG
RF24_Transmit.ino (1.86 KB)
RF24_receive.ino (1.97 KB)


#20

[quote]Sometimes the SCK pin is not connected[/quote]Now why would that be? It obviously can’t work if the SPI clock pin is not connected, so you really need to be more clear.

The confusion may be due to the SS (Slave Select) of the SPI protocol defaulting to different pins on an ATmega (PB2, Arduino Digital Pin 10) as opposed to the A-Star (PB0, Arduino Digital Pin 8).

However, the code you most recently posted (RF24_receive.ino) does not agree with your wiring diagram. The receiver code identifies CE as Arduino pin 9, and CSN (SS) as pin 10, whereas your wiring diagram for the A Star shows connections to Arduino pins 7 and 8.

It should be obvious that the code and wiring will have to agree AND be correct, if this is ever to work.