Hello friends,
I am trying to test a simple RX/TX sketch using the NRFLite library on the XIAO Nrf52840 BLE Sense combined with a nRF24L01 as a transmitter and Arduino Uno as a receiver using another nRF24L01 module. However when I try to upload the sketch to XIAO board it is giving me the following error.
I am not sure how to proceed. I have used the following pin connections for the BLE and Arduino.
The sketch seems to have uploaded but then the USB device is not recognized error is showing up and the COM port is no longer shown.
I tried using the RF24 library as well and it gave the same error. Retrying gives me the following message.
Any other sketch I try works fine with the BLE Sense MCU.
Code
/*
Demonstrates simple RX and TX operation.
Any of the Basic_RX examples can be used as a receiver.
Please read through 'NRFLite.h' for a description of all the methods available in the library.
****Connections****
mrF24 nrf52840
CE -> 6
CSN -> 7 (Hardware SPI SS)
MOSI -> 10 (Hardware SPI MOSI)
MISO -> 9 (Hardware SPI MISO)
SCK -> 8 (Hardware SPI SCK)
IRQ -> No connection
VCC -> 3.3 volts
GND -> GND
*/
#include "SPI.h"
#include "NRFLite.h"
const static uint8_t RADIO_ID = 1; // Our radio's id.
const static uint8_t DESTINATION_RADIO_ID = 0; // Id of the radio we will transmit to.
const static uint8_t PIN_RADIO_CE = 6;
const static uint8_t PIN_RADIO_CSN = 7;
struct RadioPacket // Any packet up to 32 bytes can be sent.
{
uint8_t FromRadioId;
uint32_t OnTimeMillis;
uint32_t FailedTxCount;
};
NRFLite _radio;
RadioPacket _radioData;
void setup()
{
Serial.begin(115200);
// By default, 'init' configures the radio to use a 2MBPS bitrate on channel 100 (channels 0-125 are valid).
// Both the RX and TX radios must have the same bitrate and channel to communicate with each other.
// You can run the 'ChannelScanner' example to help select the best channel for your environment.
// You can assign a different bitrate and channel as shown below.
// _radio.init(RADIO_ID, PIN_RADIO_CE, PIN_RADIO_CSN, NRFLite::BITRATE2MBPS, 100) // THE DEFAULT
// _radio.init(RADIO_ID, PIN_RADIO_CE, PIN_RADIO_CSN, NRFLite::BITRATE1MBPS, 75)
// _radio.init(RADIO_ID, PIN_RADIO_CE, PIN_RADIO_CSN, NRFLite::BITRATE250KBPS, 0)
if (!_radio.init(RADIO_ID, PIN_RADIO_CE, PIN_RADIO_CSN))
{
Serial.println("Cannot communicate with radio");
while (1); // Wait here forever.
}
_radioData.FromRadioId = RADIO_ID;
}
void loop()
{
_radioData.OnTimeMillis = millis();
Serial.print("Sending ");
Serial.print(_radioData.OnTimeMillis);
Serial.print(" ms");
// By default, 'send' transmits data and waits for an acknowledgement. If no acknowledgement is received,
// it will try again up to 16 times. This retry logic is built into the radio hardware itself, so it is very fast.
// You can also perform a NO_ACK send that does not request an acknowledgement. In this situation, the data packet
// will only be transmitted a single time and there is no verification of delivery. So NO_ACK sends are suited for
// situations where performance is more important than reliability.
// _radio.send(DESTINATION_RADIO_ID, &_radioData, sizeof(_radioData), NRFLite::REQUIRE_ACK) // THE DEFAULT
// _radio.send(DESTINATION_RADIO_ID, &_radioData, sizeof(_radioData), NRFLite::NO_ACK)
if (_radio.send(DESTINATION_RADIO_ID, &_radioData, sizeof(_radioData))) // Note how '&' must be placed in front of the variable name.
{
Serial.println("...Success");
}
else
{
Serial.println("...Failed");
_radioData.FailedTxCount++;
}
delay(1000);
}
Maybe radio library… I used to try to work with that nRF a while ago… but gave up and moved on… Keep us up to date on it… I had a problem getting all 6 wires to connect at the same time… i wanted to make a XIAO to Nrf daughter board… but i dont have all the skills
Hi there,
So it should work… What BSP are you compiling with , 9 times out of 10 the LIB and BSP are not compatible or supported. Try rolling it back 1 revision. (boards Tab)
Are you trying to use comm port ? to (pins 6 & 7)
make sure you are in BootLoader mode for the upload too.
HTH
GL
PJ 
XIAO---->NRF24<----BLE---->NRF24<----ArdUNO
? like this?
Thanks @cgwaltney ! I will definitely update here if I am able to resolve the issue.
1 Like
Thanks @PJ_Glasso ! I am using the nR52 mbed-enabled Boards. I am connecting the CE and CSN pins of nRF to the 6 and 7 pins of XIAO. I even tried pins 2 and 3 but got the same issue. Can you please explain a bit on how to get to the BootLoader mode? Is it when I double click on the reset button?
Hi there,
Yes, Double reset (fast ) will enable BL mode, check the com port sometimes it changes. Upload the code , I was able to compile with BSP 2.9.3 to verify your setup, below is the compiler output also verify’ s what BSP it’s using
the first 3 lines often the most key, the last 10 or so before it uploads.
FQBN: Seeeduino:mbed:xiaonRF52840
Using board 'xiaonRF52840' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.3
Using core 'arduino' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.3
Compiling core...
"C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -g3 -nostdlib "@C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\variants\\SEEED_XIAO_NRF52840/defines.txt" "@C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\variants\\SEEED_XIAO_NRF52840/cxxflags.txt" -DARDUINO_ARCH_NRF52840 -MMD -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARDUINO=10607 -DARDUINO_SEEED_XIAO_NRF52840 -DARDUINO_ARCH_MBED -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=0 "-IC:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\cores\\arduino" "-IC:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\variants\\SEEED_XIAO_NRF52840" "-IC:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\cores\\arduino/api/deprecated" "-IC:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\cores\\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/nfc/t2t_lib" "-IC:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\cores\\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/nfc/t2t_lib/hal_t2t" "-iprefixC:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\cores\\arduino" "@C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\variants\\SEEED_XIAO_NRF52840/includes.txt" "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\variants\\SEEED_XIAO_NRF52840\\variant.cpp" -o "C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303\\core\\variant.cpp.o"
Using precompiled core: C:\Users\Dude\AppData\Local\arduino\cores\Seeeduino_mbed_xiaonRF52840_b40b393947877826c32a7d1e4316b9f1\core.a
Linking everything together...
"C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -E -P -x c "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\variants\\SEEED_XIAO_NRF52840/linker_script.ld" -o "C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303/linker_script.ld"
"C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" "-LC:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303" -Wl,--gc-sections -Wl,--as-needed "@C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\variants\\SEEED_XIAO_NRF52840/ldflags.txt" "-TC:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303/linker_script.ld" "-Wl,-Map,C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303/sketch_may30a.ino.map" --specs=nosys.specs -o "C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303/sketch_may30a.ino.elf" "C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303\\sketch\\sketch_may30a.ino.cpp.o" "C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303\\libraries\\SPI\\SPI.cpp.o" "C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303\\libraries\\NRFLite\\NRFLite.cpp.o" "C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303\\core\\variant.cpp.o" -Wl,--whole-archive "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\cores\\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/nfc/t2t_lib/nfc_t2t_lib_gcc.a" "C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303/..\\..\\cores\\Seeeduino_mbed_xiaonRF52840_b40b393947877826c32a7d1e4316b9f1\\core.a" "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\variants\\SEEED_XIAO_NRF52840/libs/libmbed.a" "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\variants\\SEEED_XIAO_NRF52840/libs/libcc_310_core.a" "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\variants\\SEEED_XIAO_NRF52840/libs/libcc_310_ext.a" "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3\\variants\\SEEED_XIAO_NRF52840/libs/libcc_310_trng.a" -Wl,--no-whole-archive -Wl,--start-group -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -Wl,--end-group
"C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-objcopy" -O binary "C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303/sketch_may30a.ino.elf" "C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303/sketch_may30a.ino.bin"
"C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-objcopy" -O ihex -R .eeprom "C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303/sketch_may30a.ino.elf" "C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303/sketch_may30a.ino.hex"
"C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\mbed\\2.9.3/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe" dfu genpkg --dev-type 0x0052 --application "C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303/sketch_may30a.ino.hex" "C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303/sketch_may30a.ino.zip"
Zip created at C:\Users\Dude\AppData\Local\arduino\sketches\A379B8C39155270CE05A13C114EB2303/sketch_may30a.ino.zip
Using library SPI in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.3\libraries\SPI (legacy)
Using library NRFLite at version 3.0.6 in folder: D:\Arduino_projects\libraries\NRFLite
"C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-size" -A "C:\\Users\\Dude\\AppData\\Local\\arduino\\sketches\\A379B8C39155270CE05A13C114EB2303/sketch_may30a.ino.elf"
Sketch uses 89400 bytes (11%) of program storage space. Maximum is 811008 bytes.
Global variables use 44336 bytes (18%) of dynamic memory, leaving 193232 bytes for local variables. Maximum is 237568 bytes.
If the hardware is connected correctly it SHOULD work. Can you post a picture of the setup , how it’s connected.
Your close , so check it out and LUK
HTH
GL
PJ 