[SOLVED] STM32F4 +RF24 library problem

41300895
Sun Nov 06, 2016 11:31 am
I am using the library from this thread (uploaded by jbforrer – you can see his comment at the bottom):
http://www.stm32duino.com/viewtopic.php … 7&start=30
I think this library also worked well with STM32F4 discovery board, but as soon as I declare
RF24 radio(PA3,PA4)

Ollie
Sun Nov 06, 2016 4:35 pm
Sorry, I don’t have an answer for you, but only a friendly feedback. It is annoying to have the same message posted in 3 different places.

Cheers, Ollie


41300895
Sun Nov 06, 2016 5:32 pm
sorry, I was confused did not know where to post, so I posted any forum relevant, really apologize for annoying you

zmemw16
Mon Nov 07, 2016 10:58 am
does pd13 blink in the blinky sketch?
post a link to the board, although i suspect which one it is. i’ve 2 with a socket.
check the wiki

also this line intrigues me
#include <../../libraries/RF24/RF24.h>


41300895
Mon Nov 07, 2016 1:14 pm
As your suggestion, I deleted the path ../../library/.. and I compiled + uploaded successfully, now my led is blinking but there is another problem. It seems that my code is stuck at the line network.update (If i add this line, the pd13 led always HIGH, but when I comment it out, PD13 led blinks again) here is the code:
#include<RF24.h>
#include<RF24Network.h>
#include<SPI.h>
#include <DHT.h>
#define DHTPIN PC0
#define DHTTYPE DHT11 // DHT 11
#define DHTPIN PC0
DHT dht(DHTPIN, DHTTYPE);
// Radio with CE & CSN connected to pins PB0 & PB1
// Set up nRF24L01 radio on SPI-1 bus (MOSI-PA7, MISO-PA6, SCLK-PA5) ... IRQ not used?
HardwareSerial Myboard(USART1,PB6,PB7);
HardwareSPI SPI(1);
const uint64_t pipes[2] = { 0xCCCCCCCC3C, 0xCCCCCCCCC3 };
RF24 radio(PB0,PB1);
RF24Network network(radio);
const uint16_t this_node = 1;
const uint16_t parent_node = 0;
const unsigned long interval = 1000; // every sec
struct payload_t { // Structure of our payload
unsigned long node;
byte DHT11temp;
byte DHT11hum;
};
// Structure of our message

struct message_1 {
float temperature;
float humidity;
};
message_1 message;

// The network header initialized for this node
RF24NetworkHeader header(parent_node);

void setup() {
Myboard.begin(19200);
SPI.begin();
pinMode(PD13, OUTPUT);
radio.begin();
// optionally, increase the delay between retries & # of retries
radio.setRetries(15,15);
radio.setChannel(0x4c);
radio.setPALevel(RF24_PA_MAX);
// Open pipes to other nodes for communication
// This simple sketch opens two pipes for these two nodes to communicate
// back and forth.
// Open 'our' pipe for writing
// Open the 'other' pipe for reading, in position #1 (we can have up to 5 pipes open for reading)
radio.openWritingPipe(pipes[1]);
radio.openReadingPipe(1,pipes[0]);
// Start listening
radio.startListening();
// Dump the configuration of the rf unit for debugging
radio.printDetails();
delay(50);
network.begin(90, this_node);
// Initialize the DHT library
// Initialize the DHT library
dht.begin();
delay(50);
}

void loop() {
payload_t packet;
byte h = dht.readHumidity();
//Read temperature as Celsius
byte t = dht.readTemperature();
// Construct the message we'll send
message = (message_1){t,h};
// Headers will always be type 1 for this node
// We set it again each loop iteration because fragmentation of the messages might change this between loops
header.type = '1';
digitalWrite(PD13, HIGH);
Myboard.println("HIGH");
delay(1000);
// Update network data
network.update();
// Writing the message to the network means sending it
if (network.write(header, &message, sizeof(message))) {
Myboard.print("Temp = "); Myboard.println(t);
Myboard.print("Humid = "); Myboard.println(h);
} else {
Myboard.print("Could not send message\n");
}
digitalWrite(PD13, LOW);
Myboard.println("LOW");
delay(1000);
// Wait a bit before we start over again
delay(interval);
}


zmemw16
Mon Nov 07, 2016 4:23 pm
what does radio.printDetails(); give?

stevestrong
Mon Nov 07, 2016 5:03 pm
I am not sure, but I think the latest print class seems to be problematic, I also had to revert locally those changes in order to avoid some .print() related issues.

41300895
Mon Nov 07, 2016 5:39 pm
NOW this is getting weird now, after hours of editting, I realized the line” network.update() makes my code stuck because the pd13 led always ON. If I remove it, the PD13 led blinks normally.
I think the RF24Network library I used has some bugs with STM32F4 disc board!
Any suggestion?
The whole code:
#include<RF24.h>
#include<RF24Network.h>
#include<SPI.h>
#include <DHT.h>
#define DHTPIN PC0
#define DHTTYPE DHT11 // DHT 11
#define DHTPIN PC0
DHT dht(DHTPIN, DHTTYPE);
// Radio with CE & CSN connected to pins PB0 & PB1
// Set up nRF24L01 radio on SPI-1 bus (MOSI-PA7, MISO-PA6, SCLK-PA5) ... IRQ not used?
HardwareSerial Myboard(USART1,PB6,PB7);
HardwareSPI MySPI(1);
const uint64_t pipes[2] = { 0xCCCCCCCC3C, 0xCCCCCCCCC3 };
RF24 radio(PB0,PB1);
RF24Network network(radio);
const uint16_t this_node = 1;
const uint16_t parent_node = 0;
const unsigned long interval = 1000; // every sec
struct payload_t { // Structure of our payload
unsigned long node;
byte DHT11temp;
byte DHT11hum;
};
// Structure of our message

struct message_1 {
float temperature;
float humidity;
};
message_1 message;
// The network header initialized for this node
RF24NetworkHeader header(parent_node);
void setup() {
Myboard.begin(19200);
MySPI.begin(SPI_9MHZ,MSBFIRST,SPI_MODE0);
pinMode(PD13, OUTPUT);
radio.begin();
// optionally, increase the delay between retries & # of retries
radio.setRetries(15,15);
radio.setChannel(0x4c);
radio.setPALevel(RF24_PA_MAX);
// Open pipes to other nodes for communication
// This simple sketch opens two pipes for these two nodes to communicate
// back and forth.
// Open 'our' pipe for writing
// Open the 'other' pipe for reading, in position #1 (we can have up to 5 pipes open for reading)
radio.openWritingPipe(pipes[1]);
radio.openReadingPipe(1,pipes[0]);
// Start listening
radio.startListening();
// Dump the configuration of the rf unit for debugging
radio.printDetails();
delay(50);
network.begin(90, this_node);
// Initialize the DHT library
// Initialize the DHT library
dht.begin();
delay(50);
}

void loop() {
payload_t packet;
byte h = dht.readHumidity();
//Read temperature as Celsius
byte t = dht.readTemperature();
// Construct the message we'll send
message = (message_1){t,h};
// Headers will always be type 1 for this node
// We set it again each loop iteration because fragmentation of the messages might change this between loops
header.type = '1';
digitalWrite(PD13, HIGH);
Myboard.println("HIGH");
delay(1000);
// Update network data
network.update();
// Writing the message to the network means sending it
// if (network.write(header, &message, sizeof(message))) {
// Myboard.print("Temp = "); Myboard.println(t);
// Myboard.print("Humid = "); Myboard.println(h);
// } else {
// Myboard.print("Could not send message\n");
// }
digitalWrite(PD13, LOW);
Myboard.println("LOW");
delay(1000);
// Wait a bit before we start over again
delay(interval);
}


41300895
Sat Nov 12, 2016 12:30 am
Anyone could help me pls?

stevestrong
Sat Nov 12, 2016 8:19 am
1. Are you sure that the LED is on when PD13 is “HIGH”? Because more often the LEDs are driven with “LOW” signals.
2. If the LED is ON when PD13 is “LOW”, then your problem is actually the “Myboard.print()” function. And this, as I mentioned before, it may has to do with one of the latest commits in the repository (from xymopen), which introduces some problems. In this case I would recommend you to use this version, the version of the repository before the problematic commit. Just download and extract the ZIP, as usual.

zmemw16
Sat Nov 12, 2016 12:43 pm
41300895 wrote:NOW this is getting weird now, after hours of editing, I realized the line” network.update() makes my code stuck because the pd13 led always ON. If I remove it, the PD13 led blinks normally.

zmemw16
Sun Nov 13, 2016 7:37 am
zmemw16 wrote:41300895 wrote:NOW this is getting weird now, after hours of editing, I realized the line” network.update() makes my code stuck because the pd13 led always ON. If I remove it, the PD13 led blinks normally.

41300895
Sun Nov 13, 2016 9:44 am
https://www.google.com.vn/search?q=stm3 … KflCetM%3A
This is exactly my board,I’ll try your suggestion, glad that you answered me,
Thanks
EDIT: what do you mean by “use millis() to provide something as data to write to the radio.”? Can you write down the specific command to implement what you said?

zmemw16
Sun Nov 13, 2016 8:52 pm
well the schematic isn’t going to be a problem to find. its in the user guide :D

the logic behind removing the dht aspects and using millis is building blocks is that millis is a known and easily testable function, Serial.println(millis());
removing the dht aspect temporarily is to remove a potential problem. solve that by using their example as a test of dht.

using millis you can just create a packet structure with counter and millis as long int fields.
the dht example code i think converts the values to an ascii string for printing, but you could send the raw values as a field.
there’s getting started sending data example from rf24, essentially using notionally ‘good’ code.
combine the two sketches as a third and adapt.

a long time ago, my maths teacher was happy i was 3, 4 or 5 chapters worth ahead in the exercises, but not that everyone else got the same solutions.
mind you, he objected when i worked each side of ‘prove this equals that trig equation’ exercises. one forward, other backward until they met, 1==1 or 1 == 0 oops. i still don’t follow why.

stephen


41300895
Mon Nov 14, 2016 2:45 pm
Still no luck :(
Now things are totally a mess, I hope anyone could help me write a code to transmit/receive data using nrf24l01 with stm32f4 discovery . Because there are so many conflicts in using the libraries provided by previous authors in this forum

zmemw16
Mon Nov 14, 2016 3:10 pm
pretty sure i’ve a 407 discovery somewhere .. ..
i’ll go looking for it

stephen


Manny
Mon Nov 14, 2016 6:03 pm
I use this RF24 library that was attached to this post RF24_STM32 with RF24Network from Here I think it needed some minor commenting out to get it to compile.

41300895
Wed Nov 23, 2016 5:44 am
thanks for your both dedication!
Hey Manny, can you show me specifically how can I get it work?

41300895
Wed Nov 23, 2016 3:42 pm
I’ve managed to get things better a little bit!
Here’s what I did:
+ Commented out network.update(), because this line makes my code stuck!
+ I used the SPI library from here : https://github.com/rogerclarkmelbourne/Arduino_STM32 (in STM32F4/libraries/SPI) – I cut and paste it in the path: C:\Users\ASUS\Documents\Arduino\libraries\
+ I used the DHT library from here: https://github.com/markruys/arduino-DHT
+ And the RF24Network library from here: https://github.com/maniacbug/RF24Network
+ The RF24 library from here: http://www.stm32duino.com/viewtopic.php … =30#p11251 (the last comment of this link)
My code now:
#include "nRF24L01.h"
#include <RF24Network.h>
#include <RF24.h>
#include <C:\Users\ASUS\Documents\Arduino\libraries\SPI\src\SPI.h>
#include "DHT.h";
DHT dht;
HardwareSerial Myboard(USART1,PB6,PB7);
// Set up nRF24L01 radio on SPI-1 bus (MOSI-PA7, MISO-PA6, SCLK-PA5) ... IRQ not used?
RF24 radio(PB0,PB1);
RF24Network network(radio);
const uint64_t pipes[2] = {0xCCCCCCCC3C, 0xCCCCCCCCC3}; // Radio pipe addresses for the 2 nodes to communicate.
// Constants that identify this node and the node to send data to
const uint16_t this_node = 1;
const uint16_t parent_node = 0;
// The network header initialized for this node
RF24NetworkHeader header(parent_node);
void setup() {
// put your setup code here, to run once:
pinMode(PD13, OUTPUT);
Myboard.begin(115200);
dht.setup(PC0);
SPI.begin();
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(MSBFIRST);
radio.begin();
network.begin(90, this_node);
radio.setRetries(15,15);
radio.setChannel(0x4c);
radio.setAutoAck(false);
radio.setDataRate(RF24_1MBPS);
radio.setCRCLength(RF24_CRC_16);
radio.setPALevel(RF24_PA_MAX);
radio.openWritingPipe(pipes[1]);
radio.openReadingPipe(1,pipes[0]);
radio.printDetails();

}
void loop() {
// Update network data
//network.update();
delay(dht.getMinimumSamplingPeriod());
float h = dht.getHumidity();
float t = dht.getTemperature();
header.type = '1';
// Construct the message we'll send
struct message_1 {
float temperature;
float humidity;
};
message_1 message;
radio.setPayloadSize(sizeof(message));
message = (message_1){ t, h };
digitalWrite(PD13, HIGH);
Myboard.println("HIGH");
delay(1000);
radio.powerUp();
delay(1);
radio.stopListening();
delay(1);
bool ok = network.write(header,&message,sizeof(message));
if (ok)
Myboard.println("Send Ok.");
else
Myboard.println("Send Failed.");
digitalWrite(PD13, LOW);
Myboard.println("LOW");
delay(1000);
}


Manny
Thu Nov 24, 2016 5:18 pm
This is what radio.printdetails outputs on my STM32F1

STATUS = 0x0E RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xCC 0xCC 0xCC 0x3C 0xCC 0xCC 0xCC 0xCC 0x3C 0x3C
RX_ADDR_P2-5 = 0x33 0xCE 0x3E 0xE3
TX_ADDR = 0xE7 0xE7 0xE7 0xE7 0xE7
RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA = 0x3E
EN_RXADDR = 0x3F
RF_CH = 0x3C
RF_SETUP = 0x27
CONFIG = 0x0F
DYNPD/FEATURE = 0x3F 0x04
Data Rate = 250KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX


41300895
Thu Nov 24, 2016 6:24 pm
Manny wrote:This is what radio.printdetails outputs on my STM32F1

STATUS = 0x0E RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xCC 0xCC 0xCC 0x3C 0xCC 0xCC 0xCC 0xCC 0x3C 0x3C
RX_ADDR_P2-5 = 0x33 0xCE 0x3E 0xE3
TX_ADDR = 0xE7 0xE7 0xE7 0xE7 0xE7
RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA = 0x3E
EN_RXADDR = 0x3F
RF_CH = 0x3C
RF_SETUP = 0x27
CONFIG = 0x0F
DYNPD/FEATURE = 0x3F 0x04
Data Rate = 250KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX


Manny
Fri Nov 25, 2016 7:02 am
Can you implement the same thing with STM32F4 board

Sorry don’t have a F4 to try out.


41300895
Fri Nov 25, 2016 6:31 pm
so sad to here that, anyone can help me? I’ve been struggling with this for days and I’m rather desperate right now :?

zmemw16
Fri Nov 25, 2016 11:35 pm
i don’t understand why you’ve done or need to do this
+ I used the SPI library from here : https://github.com/rogerclarkmelbourne/Arduino_STM32 (in STM32F4/libraries/SPI) – I cut and paste it in the path: C:\Users\ASUS\Documents\Arduino\libraries\

it shouldn’t be looking there at all, is there a quirk with f4 spi?

stephen


41300895
Sat Nov 26, 2016 3:49 am
i did it because if i left the spi folder in side stm32f4 directory, it couldn’t compile if i add the line #include “SPI.h”

zmemw16
Sat Nov 26, 2016 5:41 am
compiling for Discover F407, simple blink on pb6/pb7 with just an added include SPI.h
it at first flagged missing library maintainer, add fred also added [email protected] for the email
thought i’d add it in, did, tried re-compile, same of course (i knew that honest :)), restarted

then it gave up with
In file included from /home/stephen/sketchbook/Blinki2c/Blinki2c.ino:19:0:
/home/stephen/sketchbook/hardware/Arduino_STM32/STM32F4/libraries/SPI/src/SPI.h:362:17: error: conflicting declaration 'SPIClass SPI'
extern SPIClass SPI;//(1);// dummy params
^
In file included from /home/stephen/sketchbook/hardware/Arduino_STM32/STM32F4/cores/maple/wirish.h:49:0,
from /home/stephen/sketchbook/hardware/Arduino_STM32/STM32F4/cores/maple/WProgram.h:27,
from /home/stephen/sketchbook/hardware/Arduino_STM32/STM32F4/cores/maple/Arduino.h:3,
from /tmp/arduino_build_22323/sketch/Blinki2c.ino.cpp:1:
/home/stephen/sketchbook/hardware/Arduino_STM32/STM32F4/cores/maple/libmaple/HardwareSPI.h:276:20: error: 'SPI' has a previous declaration as 'HardwareSPI SPI'
extern HardwareSPI SPI;
^
Using library SPI at version 1.0 in folder: /home/stephen/sketchbook/hardware/Arduino_STM32/STM32F4/libraries/SPI
exit status 1
Error compiling for board STM32 Discovery F407.


41300895
Sat Nov 26, 2016 9:56 am
I did have an exact error like you but I used method in this thread and I bypassed that error!
http://www.stm32duino.com/viewtopic.php … eSPI#p9227

Just simply comment out the line extern HardwareSPI … in your HardwareSPI.h file. If I recall correctly, this file is under …\STM32F4\cores\maple\libmaple


stevestrong
Sat Nov 26, 2016 12:04 pm
41300895 wrote:i did it because if i left the spi folder in side stm32f4 directory, it couldn’t compile if i add the line #include “SPI.h”

41300895
Sun Nov 27, 2016 2:36 am
stevestrong wrote:41300895 wrote:i did it because if i left the spi folder in side stm32f4 directory, it couldn’t compile if i add the line #include “SPI.h”

Manny
Sun Nov 27, 2016 11:57 am
Try the library attached, I hacked it so the the SPIclass is defined in line 13 of RF24_STM32.cpp, I find it easier to do that way, you just got to remember to change the class if you’re using different SPI pins.

Comment out all the SPI code in your sketch you just need to #include <SPI.h> and SPI.begin() in set up.

Another thing I noticed is you’re using SPIClass(3) which on the STM32F1 that I’m using shares the pins with JTAG debug, to get round this you will need to put disableDebugPorts() in setup. Not sure if this effects the F4 but it wouldn’t hurt to try it.
disableDebugPorts();


41300895
Sun Nov 27, 2016 1:45 pm
Dear Manny,
The number of SPI pins is actually able to change in my program, so as you said, I changed it to SPIClass MySPI(1). That’s means I dont have to use your disable port command
I copied your lib under the folder hardware\Arduino_STM32..\STM32F4\libraries
I also changed the #include “RF24.h” inside RF24Network.h to #include “RF24_STM32.h” so that it fits your lib.
#include<C:\Users\ASUS\Documents\Arduino\hardware\Arduino_STM32-7985f25fbcb06f7a38f55d84cdf4b0b58e72da11\STM32F4\libraries\RF24_STM32\RF24_STM32.h>
#include<C:\Users\ASUS\Documents\Arduino\hardware\Arduino_STM32-7985f25fbcb06f7a38f55d84cdf4b0b58e72da11\STM32F4\libraries\RF24Network-master\RF24Network.h>
#include <C:\Users\ASUS\Documents\Arduino\hardware\Arduino_STM32-7985f25fbcb06f7a38f55d84cdf4b0b58e72da11\STM32F4\libraries\SPI\src\SPI.h>
#include <C:\Users\ASUS\Documents\Arduino\hardware\Arduino_STM32-7985f25fbcb06f7a38f55d84cdf4b0b58e72da11\STM32F4\libraries\DHT-sensor-library-master\DHT.h>;
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
HardwareSerial Myboard(USART1,PB6,PB7);
SPIClass MySPI(1);
// Radio with CE & CSN connected to pins 7 & 8
RF24 radio(PB0, PB1);
RF24Network network(radio);
const uint64_t pipes[2] = {0xCCCCCCCC3C, 0xCCCCCCCCC3}; // Radio pipe addresses for the 2 nodes to communicate.
// Constants that identify this node and the node to send data to
const uint16_t this_node = 1;
const uint16_t parent_node = 0;
struct message_1 {
float temperature;
float humidity;
};
message_1 message;
// The network header initialized for this node
RF24NetworkHeader header(parent_node);
void setup() {
// put your setup code here, to run once:
pinMode(PD13, OUTPUT);
Myboard.begin(115200);
// Initialize the DHT library
dht.begin();
// Initialize all radio related modules
MySPI.begin();
radio.setRetries(15,15);
radio.setChannel(0x4c);
radio.setAutoAck(false);
radio.setPayloadSize(sizeof(message));
radio.setCRCLength(RF24_CRC_16);
radio.setPALevel(RF24_PA_MAX);
radio.openWritingPipe(pipes[1]);
radio.openReadingPipe(1,pipes[0]);
radio.begin();
delay(5);
network.begin(90, this_node);
radio.printDetails();
}
void loop() {
// Update network data
network.update();
// Read humidity (percent)
float h = dht.readHumidity();
// Read temperature as Celsius
float t = dht.readTemperature();
// Headers will always be type 1 for this node
// We set it again each loop iteration because fragmentation of the messages might change this between loops
header.type = '1';
// Construct the message we'll send
message = (message_1){ t, h };
digitalWrite(PD13, HIGH);
Myboard.println("HIGH");
delay(1000);
bool ok = network.write(header,&message,sizeof(message));
if (ok)
Myboard.println("Send Ok.");
else
Myboard.println("Send Failed.");
digitalWrite(PD13, LOW);
Myboard.println("LOW");
delay(1000);
}

klerone
Tue Mar 28, 2017 2:04 am
Manny wrote:Try the library attached, I hacked it so the the SPIclass is defined in line 13 of RF24_STM32.cpp, I find it easier to do that way, you just got to remember to change the class if you’re using different SPI pins.

Comment out all the SPI code in your sketch you just need to #include <SPI.h> and SPI.begin() in set up.

Another thing I noticed is you’re using SPIClass(3) which on the STM32F1 that I’m using shares the pins with JTAG debug, to get round this you will need to put disableDebugPorts() in setup. Not sure if this effects the F4 but it wouldn’t hurt to try it.
disableDebugPorts();


acronis
Thu Jul 27, 2017 8:17 am
Hello

How to assign this library to SPI3 ?
A special socket for the nRF24L01 on the Board STM32F407VET6 BLACK


stevestrong
Thu Jul 27, 2017 8:27 am
[acronis – Thu Jul 27, 2017 8:17 am] –
How to assign this library to SPI3 ?

SPIClass mSPI(3);


acronis
Thu Jul 27, 2017 8:32 am
Thank you !

Please tell me how to fix the following example for SPI3 STM32F407VET6 to work on SPI3
/*

Sensor Receiver.
Each sensor modue has a unique ID.

TMRh20 2014 - Updates to the library allow sleeping both in TX and RX modes:
TX Mode: The radio can be powered down (.9uA current) and the Arduino slept using the watchdog timer
RX Mode: The radio can be left in standby mode (22uA current) and the Arduino slept using an interrupt pin
*/

#include <SPI.h>
#include "nRF24L01_STM32.h"
#include "RF24_STM32.h"

// Set up nRF24L01 radio on SPI-1 bus (MOSI-PA7, MISO-PA6, SCLK-PA5) ... IRQ not used?
RF24 radio(PB0,PB1);

const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL }; // Radio pipe addresses for the 2 nodes to communicate.

struct payload_t { // Structure of our payload
unsigned long node;
unsigned long counter;
float DHT11temp;
float DHT11hum;
int batteryLevel;
};

void setup(){

Serial.begin(9600);
delay(1000);

Serial.println("\n\rRF24 Sensor Receiver");

SPI.begin();
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(MSBFIRST);

// Setup and configure rf radio

radio.begin();

// optionally, increase the delay between retries & # of retries
radio.setRetries(15,15);
radio.setChannel(0x4c);
radio.setPALevel(RF24_PA_LOW);

// Open pipes to other nodes for communication

// This simple sketch opens two pipes for these two nodes to communicate
// back and forth.
// Open 'our' pipe for writing
// Open the 'other' pipe for reading, in position #1 (we can have up to 5 pipes open for reading)

radio.openWritingPipe(pipes[1]);
radio.openReadingPipe(1,pipes[0]);

// Start listening
radio.startListening();

// Dump the configuration of the rf unit for debugging
radio.printDetails();
}

void loop(){

payload_t packet;

// Receive each packet, dump it out
if ( radio.available() ) { // if there is data ready
radio.read( &packet, sizeof(packet) ); // Get the payload, and see if this was the last one.

Serial.print("Received from Sensor: "); Serial.print(packet.node);
Serial.print(" #:"); Serial.println(packet.counter);
Serial.print("DHT11 Temp = "); Serial.print(packet.DHT11temp);
Serial.print(" DHT11 Humidity = "); Serial.print(packet.DHT11hum);
Serial.print(" Batt = "); Serial.println((float)packet.batteryLevel/(float)266.7);
}
}


stevestrong
Thu Jul 27, 2017 8:48 am
If you refer to this package, there is a lot of work to do to clean it up…

acronis
Thu Jul 27, 2017 9:02 am
What means this string ?

RF24 radio(PB0,PB1);

In the examples written by different pins .
What should I specify ?

RF24 radio(CE_PIN, CSN_PIN); ???

RF24 radio(PB6, PB7 );
So right ?


stevestrong
Thu Jul 27, 2017 9:50 am
[acronis – Thu Jul 27, 2017 9:02 am] –
RF24 radio(CE_PIN, CSN_PIN); ???
RF24 radio(PB6, PB7 );
So right ?

It seems so.

Btw, have you seen this lib? https://github.com/jaretburkett/RF24-STM


acronis
Sat Jul 29, 2017 1:47 pm
viewtopic.php?f=39&t=1526&start=20#p20500
RF24 radio(PB6, PB7 );

This library works on STM32F407VET6.
Thank you all.
the question is closed


RogerClark
Sat Jul 29, 2017 10:03 pm
Please update you initially post and add SOLVED to the title and preferably put the solution into the beginning of the first post

acronis
Sun Jul 30, 2017 2:04 am
Hello RogerClark.

It’s not my topic and not my first post,
I don’t know how to add a message.
Tell me what you need and how to do it.


RogerClark
Sun Jul 30, 2017 10:16 am
Ah. OK

You can’t do that.

I thought as you indicated it worked and you said “Thank you all. ” you must have started the tread

On the OP (and I ) can change the thread title and its best if the OP does that


Leave a Reply

Your email address will not be published. Required fields are marked *