nRF5 action!
-
For anyone else caught in the same limbo as me, here's a more proper update of the earlier example:
#define MY_CORE_ONLY #ifndef ARDUINO_ARCH_NRF5 #define MY_NODE_ID (1) #define SND_TO (2) #else #define MY_NODE_ID (2) #define SND_TO (1) #endif // Enable debug #define MY_DEBUG //#define MY_DEBUG_VERBOSE_RF24 //#define MY_DEBUG_VERBOSE_NRF5_ESB // RF24_250KBPS RF24_1MBPS RF24_2MBPS #define MY_RF24_DATARATE (RF24_1MBPS) // NRF5_250KBPS NRF5_1MBPS NRF5_2MBPS #define MY_NRF5_ESB_MODE (NRF5_1MBPS) // Enable and select radio type attached #ifndef NRF5 #define MY_RADIO_NRF24 #else #define MY_RADIO_NRF5_ESB #include <nrf.h> #endif #include <MySensors.h> void setup() { Serial.begin(115200); Serial.println("Starting...."); Serial.print("MY_NODE_ID="); Serial.println(MY_NODE_ID); Serial.print("SND_TO="); Serial.println(SND_TO); Serial.flush(); #ifdef ARDUINO_ARCH_NRF5 NRF_CLOCK->TASKS_HFCLKSTART=1; //activate the high frequency crystal oscillator while ((NRF_CLOCK->EVENTS_HFCLKSTARTED==0)) {}; //wait until high frequency clock start is confirmed #endif hwInit(); transportInit(); transportSetAddress(MY_NODE_ID); } uint32_t theTime=0; uint32_t loopCounter=0; void loop() { // Check for packages while ((millis()-theTime)<1000) { while (transportAvailable()) { uint8_t buffer[256]; uint8_t num = transportReceive(&buffer); Serial.print(loopCounter); Serial.print(", RECEIVED="); for (int i=0;i<num;i++) { if (buffer[i]<0x10) Serial.print("0"); Serial.print(buffer[i], HEX); Serial.print(" "); } Serial.println(); Serial.flush(); } } theTime=millis(); //delay(1000); Serial.print(loopCounter++); Serial.println(", SENDING: abcdefghijklmnopqrstuvwxyz01234"); Serial.println(); Serial.flush(); // Send data transportSend(SND_TO, "abcdefghijklmnopqrstuvwxyz01234",32, false); }The serial output shown by the nRF52 is what you would expect:
Starting.... MY_NODE_ID=2 SND_TO=1 0, RECEIVED=61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 30 31 32 33 34 00 0, SENDING: abcdefghijklmnopqrstuvwxyz01234 1, RECEIVED=61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 30 31 32 33 34 00 1, SENDING: abcdefghijklmnopqrstuvwxyz01234 2, RECEIVED=61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 30 31 32 33 34 00 2, SENDING: abcdefghijklmnopqrstuvwxyz01234 3, RECEIVED=61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 30 31 32 33 34 00 3, SENDING: abcdefghijklmnopqrstuvwxyz01234However, the serial output of the pro mini often seems to include a 1-byte packet:
Starting.... MY_NODE_ID=1 SND_TO=2 0, RECEIVED=61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 30 31 32 33 34 00 0, SENDING: abcdefghijklmnopqrstuvwxyz01234 1, RECEIVED=61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 30 31 32 33 34 00 1, RECEIVED=61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 30 31 32 33 34 00 1, SENDING: abcdefghijklmnopqrstuvwxyz01234 2, RECEIVED=41 2, RECEIVED=61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 30 31 32 33 34 00 2, SENDING: abcdefghijklmnopqrstuvwxyz01234 3, RECEIVED=41 3, RECEIVED=61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 30 31 32 33 34 00 3, SENDING: abcdefghijklmnopqrstuvwxyz01234 4, RECEIVED=47 4, RECEIVED=61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 30 31 32 33 34 00 4, SENDING: abcdefghijklmnopqrstuvwxyz01234 5, RECEIVED=46 5, RECEIVED=61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 30 31 32 33 34 00 5, SENDING: abcdefghijklmnopqrstuvwxyz01234 6, RECEIVED=47 6, RECEIVED=61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 30 31 32 33 34 00 6, SENDING: abcdefghijklmnopqrstuvwxyz01234Is that a bug?
-
@d00616
Thanks for trying. That would probably work with a linux machine, but mine is running Windows. I'm surprised there's no easy way to do this from Windows.I guess I'll just wait for the next developers release of mysensors.
@NeverDie said in nRF5 Bluetooth action!:
Thanks for trying. That would probably work with a linux machine, but mine is running Windows. I'm surprised there's no easy way to do this from Windows.
I guess I'll just wait for the next developers release of mysensors.This depends on Git installed not on Linux. The Pull Request is now into the developer branch.
@NeverDie said in nRF5 Bluetooth action!:
However, the serial output of the pro mini often seems to include a 1-byte packet:
...
Is that a bug?This is the RSSI value, which is send back as ACK payload. I check what's the best way to deal with.
-
Good news. Thanks to the work of @d00616 on making the ESB transport available, I'm getting very good range using the nRF52832 as a receiver and a pro mini with an inexpensive power amplified nRF24 as the sender, all at 2mbps. :) Not sure if there are yet power amplified nRF52832 available (?), but if not, this does the business.
-
One thing I do notice though is that the amount of time it takes to send a packet from an nRF24L01 using this ESB transport is pretty long: about 27ms passes between sending one packet and the next packet, and that's running on an ESP8266, which is pretty fast.
-
One thing I do notice though is that the amount of time it takes to send a packet from an nRF24L01 using this ESB transport is pretty long: about 27ms passes between sending one packet and the next packet, and that's running on an ESP8266, which is pretty fast.
Looking at the nRF24L01 datasheet (file:///C:/Users/CoolerMaster/Downloads/nRF24L01_Product_Specification_v2_0%20(3).pdf), it appears that one simply needs to keep the TX FIFO full, and the radio will then send things as fast as it can (which should be a lot faster than 27ms). So, I'll give that a try.
-
Oddly enough, in the current mysensors-development release, it takes even longer: 97ms between packets.
-
Oddly enough, in the current mysensors-development release, it takes even longer: 97ms between packets.
@NeverDie isn't it because quality of the radio link is bad, and it needs to send each packet many times while waiting for the ACK between each sending ?
I'm not sure what/how you measure but if you have many packets in your TX FIFO the next packet is processed only when first packet is acknowledged and removed from FIFO, so if radio link is bad the delays of retransmission will add up while processing the TX FIFO and last packet will be sent only after a "long" delay.When an ACK is successfully received from a PRX, it implies that the payload was successfully received and added to the PRX's RX FIFO, the successfully transmitted packet will be removed from the TX FIFO so that the next packet in the FIFO can be transmitted. -
Good news. Thanks to the work of @d00616 on making the ESB transport available, I'm getting very good range using the nRF52832 as a receiver and a pro mini with an inexpensive power amplified nRF24 as the sender, all at 2mbps. :) Not sure if there are yet power amplified nRF52832 available (?), but if not, this does the business.
-
Looking at the nRF24L01 datasheet (file:///C:/Users/CoolerMaster/Downloads/nRF24L01_Product_Specification_v2_0%20(3).pdf), it appears that one simply needs to keep the TX FIFO full, and the radio will then send things as fast as it can (which should be a lot faster than 27ms). So, I'll give that a try.
@NeverDie said in nRF5 Bluetooth action!:
Looking at the nRF24L01 datasheet (file:///C:/Users/CoolerMaster/Downloads/nRF24L01_Product_Specification_v2_0%20(3).pdf), it appears that one simply needs to keep the TX FIFO full, and the radio will then send things as fast as it can (which should be a lot faster than 27ms). So, I'll give that a try.
If "noACK" is enabled, each packet is send 15 times, which consumes ~27ms. Both NRF24 and NRF5 do the same here.
-
Well, there are these:
https://www.aliexpress.com/item/PTR5618PA-Nordic-nRF52832-Module-PA-module-BLE-4-0-Module-Free-shipping/32761051086.html?spm=2114.search0104.3.8.MXhqTf&ws_ab_test=searchweb0_0,searchweb201602_4_10152_10065_10151_10130_5560016_10068_10344_10342_10343_10340_10341_10307_10060_10155_10154_10056_10055_10054_5370016_10059_10534_10533_10532_100031_10099_10338_10339_5580016_10103_10102_10052_10053_10107_10050_10142_10051_10324_10325_9947_10084_513_10083_10080_10082_10081_5590016_10178_10110_10111_10112_10113_10114_143_10312_10314_10078_10079_5570016_10073-9947,searchweb201603_1,ppcSwitch_4&btsid=40a5015f-dcf6-44e1-aba0-2ebedd393fb8&algo_expid=122380a9-0e93-4cf0-b147-38cdf7c5df53-1&algo_pvid=122380a9-0e93-4cf0-b147-38cdf7c5df53
but who knows how well they work. Have to buy 5 just to find out.In time, I'm sure there will be more available with PA's on them.
-
I need to be able to send back-to-back packets from an nRF24L01 in order to guarantee waking up an nRF52832 receiver that's in a "listen mode" but otherwise asleep.
-
Well, there are these:
https://www.aliexpress.com/item/PTR5618PA-Nordic-nRF52832-Module-PA-module-BLE-4-0-Module-Free-shipping/32761051086.html?spm=2114.search0104.3.8.MXhqTf&ws_ab_test=searchweb0_0,searchweb201602_4_10152_10065_10151_10130_5560016_10068_10344_10342_10343_10340_10341_10307_10060_10155_10154_10056_10055_10054_5370016_10059_10534_10533_10532_100031_10099_10338_10339_5580016_10103_10102_10052_10053_10107_10050_10142_10051_10324_10325_9947_10084_513_10083_10080_10082_10081_5590016_10178_10110_10111_10112_10113_10114_143_10312_10314_10078_10079_5570016_10073-9947,searchweb201603_1,ppcSwitch_4&btsid=40a5015f-dcf6-44e1-aba0-2ebedd393fb8&algo_expid=122380a9-0e93-4cf0-b147-38cdf7c5df53-1&algo_pvid=122380a9-0e93-4cf0-b147-38cdf7c5df53
but who knows how well they work. Have to buy 5 just to find out.In time, I'm sure there will be more available with PA's on them.
-
@Toyman said in nRF5 Bluetooth action!:
@NeverDie have you tried adding ipx antennae to Ebyte module?
Does it help?You need to move the tiny cap for that, not easy :)
-
@Toyman said in nRF5 Bluetooth action!:
@NeverDie have you tried adding ipx antennae to Ebyte module?
Does it help?Yes, but it made no difference. NCA78's post explains why. So, I guess that connector, which looks so promising, amounts to just marketing bait? i.e. in terms of practicality, it's little more than a decoration? And if so, then which would be a good module to buy if intending to hook up using an ipx? Presumably a module that has only an ipx connector and no other antenna already on it? Which module exactly? I'd like to try it with an eye for use on a gateway.
-
By the way, with the latest library, time between packets is now down to around 1ms. I guess there was a favorable change in the library? I'm now not sure if it's that, or something I may have inadvertantly done while mucking around with it.
-
I just received 2 of those little boards.
Ideal for small sensor nodes, I'd say, but not very breadboard friendly.
So I dug out the verowire, and did a little soldering.
@Uhrheber said in nRF5 Bluetooth action!:
I just received 2 of those little boards.
Ideal for small sensor nodes, I'd say, but not very breadboard friendly.
So I dug out the verowire, and did a little soldering.
Looks as though the module itself is missing the SW pinouts. Is that what the two wires you soldered near the chip are for?
-
@Toyman said in nRF5 Bluetooth action!:
@NeverDie have you tried adding ipx antennae to Ebyte module?
Does it help?Yes, but it made no difference. NCA78's post explains why. So, I guess that connector, which looks so promising, amounts to just marketing bait? i.e. in terms of practicality, it's little more than a decoration? And if so, then which would be a good module to buy if intending to hook up using an ipx? Presumably a module that has only an ipx connector and no other antenna already on it? Which module exactly? I'd like to try it with an eye for use on a gateway.
@NeverDie said in nRF5 Bluetooth action!:
Yes, but it made no difference. NCA78's post explains why. So, I guess that connector, which looks so promising, amounts to just marketing bait? i.e. in terms of practicality, it's little more than a decoration?
I did the change on a PA LNA nrf24 from CDEByte, it was a real pain especially when the module was already soldered and surrounded by connectors. In the end I lost the cap somewhere on my desk and so I replaced it with a 0603 of the same capacity. Not looking great but much easier and it works better with the ipx antenna than with PCB.
-
From the nRF24L01 datasheet:
The nRF24L01+ transmitter PLL operates in open loop when in TX
mode. It is important never to keep the nRF24L01+ in TX mode for more than 4ms at a time.So, I guess I won't be able to use the nRF24L01+ for continuous transmits after all. :(
-
Looks as though maybe this nRF52832 module would not require modification in order to use the IPX?
https://www.aliexpress.com/item-img/1pcs-NRF52832-Bluetooth-module-M4-kernel-Bluetooth-4-1BLE-module/32821473149.html?spm=2114.10010108.1000017.2.2d1f5eccJxyODh -
So, I just did what NCA78 inspired me to do: resoldered the capacitor to enable the IPX connector. The results? It is an improvement, and I can see the difference at the margin, but still nothing like the 20dbi of the amplified modules. Not surprising. So, I guess I'll try to find one of those as either an nRF52832 or an nRF51822, and give that a try.