Closed massivespace closed 4 years ago
Never mind. I was powering the Wifi 1010 with 3.3V, since I had read everywhere that it ran at 3.3V. I didn't read the specs like I should have. The Vin pin must be 5V. The onboard regulator drops it to 3.3 for everything. Powering it with 5V and the nRF24 with 3.3V fixed the problem. I have no idea why things weren't working with the USB port plugged in and the serial terminal closed. Call it a fluke for now.
A bit more testing after I closed this revealed that the 5V did not fix the problem. It boiled down to me calling Serial.begin(). When I removed all calls to Serial, the RF24 code works like a charm. If I put Serial.begin() in setup, even without calling any prints, running purely on battery power will not work until I plug in the USB. I'm not sure where that problem lies, or if it's even to be expected, so I'll keep this closed for now but leave this for others if they come across this.
Is your feature request related to a problem? Please describe. I am sending some simple test packets from an Arduino Uno, and receiving them on an Arduino MKR 1010. I have been struggling for a couple of days to understand why during development everything worked, but running stand-alone, the 1010 would not receive anything. At first I thought it was a power supply issue, but I don't believe it is, because I discovered how to reproduce the issue even with the PC connected for power.
I finally narrowed it down to the 1010's USB communication somehow interfering/unlocking the traffic, OR the internal USB libs setting something up in the SPI that maybe the RF24 library isn't (for the Wifi 1010). When plugged into my computer, if I opened the serial terminal window, everything would work as expected, LED would light up to indicate traffic being received. If I select a different port in the IDE, then power cycle the 1010, nothing works. As soon as I select the USB port in the IDE, the traffic starts to be received again. I will post the code below for this scenario, but it's basically the test tx/rx code in the examples.
I'm guessing there is something being called within the USB/serial library internally that is setting up the board's SPI (total guess here) so that communication with the nRF24 begins to work. However, if powered on and no USB connection, that "something" never gets initialized. I tried calling some SPI calls manually to try and get things moving, but I honestly don't know what I'm doing here, and it would just freeze up everything requiring a bootloader boot.
Describe the solution you'd like To be able to receive data on a MKR 1010 via an nRF24 chip without having a serial terminal window open.
Describe alternatives you've considered Running a Nano as a proxy to the 1010, but I'm controlling servos with the RF data and really don't want the added latency.
Additional context I wired pins 8 (MOSI), 9 (SCK), 10 (MISO) to the nRF24 device, and I am using pins 0 and 1 for the CE and CS outputs. I was a little weary of pins 0 and 1 as those are TX/RX and used by USB on other boards, but I also tried pins 2 and 3 to no avail. Pins 13 and 14 are TX/RX on the 1010 device. Also, it's notable that the MOSI, SCK, MISO pins on this device are different from most other Arduino devices.
TX Code:
RX Code:
When testing with 2 Nanos, or between a Nano and Uno, I can unplug, connect a 9V battery to regulated 3.3 supply, and all works fine.
I'm happy to look and help solve this issue, but I don't really know where to start. I do get the following warnings:
Also, calling radio.printDetails() just comes back blank, possibly due to the #defines for printf in RF24_config.h. I'm looking into that now, as it might help get things moving forward.