Bonjour, J'ai démarré il y à 3 mois avec un kit UNO R4 Wifi.. donc encore très débutant. J'ai tout de même établi une communication Wifi avec une autre UNO R4 placé en extérieur collectant des infos diverses températures, humidité avec des sondes PT1000.. et divers calculs dont éclairement de la lune via un calcul de jours Julien. ça reste de la bidouille.
Là je cale complétement sur l'établissement d'une liaison entre ma 1ere UNO R4 Wifi et une Nano 33 IoT via 2 modules (tout neufs) NRF L01+ avec antenne.
Depuis 3 jours je lis des tutos et des forums pour comprendre d'où vient le Pb
Le monitoring me sort invariablement "Transmission failed or timed out".
J'utilise le programme "Getting Started" de la library RF24. sans modif or CE et CSN que j'ai essayé aussi en 9 et 10.
J'ai vérifié et re-re-re vérifié mon câblage, l'état des connections, les déclarations en essayant CE et CSN sur 7 et 8 et sur 9 et 10.
Si je permute les 2 modules NRF24> idem.
La Nano n'imprime pas les détails "radio.printDetails();" je suppose que la NANO ne gère pas "printf"..
J'ai mis des capa de 10microF sur les alim (3.3v indépendantes des cartes UNO et NANO).
J'essayé d'autres programmes de base pour voir si j'avais une différence > idem.
J'ai mesuré le niveau de bruit sur les alim avec un oscillo (+/-50mV) et idem en coupant ma box et les Bluetooth.
J'inverse les fonctions émission et réception d'un NRF à l'autre > idem
Je cale, je ne sais plus quoi faire sauf de commander 2 nouveaux NRF24, ce qui me semble prématuré.
Sur la UNO "printf " affiche pour l'un ou l'autre des 2 NRF24 que je lui connecte :
RF24/examples/GettingStarted
Which radio is this? Enter '0' or '1'. Defaults to '0'
radioNumber = 0
*** PRESS 'T' to begin transmitting to the other node...
Tout conseil ou recommandation bienvenus, je sais que le sujet n'est pas nouveau, mais tout ce que j'ai lu et mis en application jusqu'à présent ne m'a pas sorti du problème.
Merci d'avance.
Pas vraiment une réponse, mais le code doit être mis entre balise spécifique.
tu peux de référé au post épinglé en début de la section française qui indique les bonnes pratiques pour poster.
Bonjour, merci pour votre réponse. Je vous mets le code d'ici peu.
Je viens de retester mes masses : RAS.
je vais avant de refaire d'autres test revérifier les tensions.
Je vais aussi lancé un programme "chanel scanner" mentionné sur un autre forum.
Plus d'infos sous peu.
merci encore.
voici le code que j'utilise, il provient directement, c'est l'exemple "GettingStarted" de la library "RF24", non modifié (sauf peut être le niveau de puissance passé à LOW ? plus sur!).
J'étais ravi d'avoir trouvé la pin 10 douteuse sur laquelle j'avais CSN sur la UNO. Avec les programmes "Chanel Scanner" le fait de l'avoir déplacée en pin7 et du coup CSN en 8 montrait des résultats stables et très différents. J'ai donc uploadé les programmes Getting Started de la library RF24 sur les 2 cartes... et malheureusement j'ai les mêmes résultats "Transmission failed or timed out"..
Voici le programme en question :
/*
* See documentation at https://nRF24.github.io/RF24
* See License information at root directory of this library
* Author: Brendan Doherty (2bndy5)
*/
/**
* A simple example of sending data from 1 nRF24L01 transceiver to another.
*
* This example was written to be used on 2 devices acting as "nodes".
* Use the Serial Monitor to change each node's behavior.
*/
#include <SPI.h>
#include "printf.h"
#include "RF24.h"
#define CE_PIN 7
#define CSN_PIN 8
// instantiate an object for the nRF24L01 transceiver
RF24 radio(CE_PIN, CSN_PIN);
// Let these addresses be used for the pair
uint8_t address[][6] = { "1Node", "2Node" };
// It is very helpful to think of an address as a path instead of as
// an identifying device destination
// to use different addresses on a pair of radios, we need a variable to
// uniquely identify which address this radio will use to transmit
bool radioNumber = 1; // 0 uses address[0] to transmit, 1 uses address[1] to transmit
// Used to control whether this node is sending or receiving
bool role = false; // true = TX role, false = RX role
// For this example, we'll be using a payload containing
// a single float number that will be incremented
// on every successful transmission
float payload = 0.0;
void setup() {
Serial.begin(9600);
while (!Serial) {
// some boards need to wait to ensure access to serial over USB
}
// initialize the transceiver on the SPI bus
if (!radio.begin()) {
Serial.println(F("radio hardware is not responding!!"));
while (1) {} // hold in infinite loop
}
// print example's introductory prompt
Serial.println(F("RF24/examples/GettingStarted"));
// To set the radioNumber via the Serial monitor on startup
Serial.println(F("Which radio is this? Enter '0' or '1'. Defaults to '0'"));
while (!Serial.available()) {
// wait for user input
}
char input = Serial.parseInt();
radioNumber = input == 1;
Serial.print(F("radioNumber = "));
Serial.println((int)radioNumber);
// role variable is hardcoded to RX behavior, inform the user of this
Serial.println(F("*** PRESS 'T' to begin transmitting to the other node"));
// Set the PA Level low to try preventing power supply related problems
// because these examples are likely run with nodes in close proximity to
// each other.
radio.setPALevel(RF24_PA_MIN); // RF24_PA_MAX is default.
radio.setDataRate(RF24_250KBPS);
// save on transmission time by setting the radio to only transmit the
// number of bytes we need to transmit a float
radio.setPayloadSize(sizeof(payload)); // float datatype occupies 4 bytes
// set the TX address of the RX node for use on the TX pipe (pipe 0)1
radio.stopListening(address[radioNumber]); // put radio in TX mode
// set the RX address of the TX node into a RX pipe
radio.openReadingPipe(1, address[!radioNumber]); // using pipe 1
// additional setup specific to the node's RX role
if (!role) {
radio.startListening(); // put radio in RX mode
}
// For debugging info
printf_begin(); // needed only once for printing details
radio.printDetails(); // (smaller) function that prints raw register values
radio.printPrettyDetails(); // (larger) function that prints human readable data
} // setup
void loop() {
if (role) {
// This device is a TX node
unsigned long start_timer = micros(); // start the timer
bool report = radio.write(&payload, sizeof(float)); // transmit & save the report
unsigned long end_timer = micros(); // end the timer
if (report) {
Serial.print(F("Transmission successful! ")); // payload was delivered
Serial.print(F("Time to transmit = "));
Serial.print(end_timer - start_timer); // print the timer result
Serial.print(F(" us. Sent: "));
Serial.println(payload); // print payload sent
payload += 0.01; // increment float payload
} else {
Serial.println(F("Transmission failed or timed out")); // payload was not delivered
}
// to make this example readable in the serial monitor
delay(1000); // slow transmissions down by 1 second
} else {
// This device is a RX node
uint8_t pipe;
if (radio.available(&pipe)) { // is there a payload? get the pipe number that received it
uint8_t bytes = radio.getPayloadSize(); // get the size of the payload
radio.read(&payload, bytes); // fetch payload from FIFO
Serial.print(F("Received "));
Serial.print(bytes); // print the size of the payload
Serial.print(F(" bytes on pipe "));
Serial.print(pipe); // print the pipe number
Serial.print(F(": "));
Serial.println(payload); // print the payload's value
}
} // role
if (Serial.available()) {
// change the role via the serial monitor
char c = toupper(Serial.read());
if (c == 'T' && !role) {
// Become the TX node
role = true;
Serial.println(F("*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK"));
radio.stopListening();
} else if (c == 'R' && role) {
// Become the RX node
role = false;
Serial.println(F("*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK"));
radio.startListening();
}
}
} // loop
Re bonjour, j'ai fait pas mal de test, il s'avère (après que j'ai éliminé le doute sur le contact de CSN) que le programme ChannelScanner montre que mes 2 cartes fonctionnent bien en émission et en réception bien que pour une raison bizarre le programme getting started de la library RF24 ne fonctionne pas chez moi ou que je ne sache pas m'en servir (!!?).
Vu de la UNO, la NANO émet sur le cal 10.
Stopping Carrier Out
-1---11F-FFFF------11------1---------------------1------------1-------1------------1----
Vu de la NANO, la UNO émet sur le canal 20
Stopping Carrier Out
------1----------F-FFFF-------------------------1-2------32323322222------------------------------
-----111---------F-FFFF----1--------------------11-------44643222222--------------1-------------------------------------------
Le programme d'origine émet sur le canal 40, dans ce cas à partir de 38 j'ai F-FFFF---
A voir avec d'autres tests, mais à l'instant j'ai l'impression que mes cartes fonctionnent et que mon hardware est correct.
Quel est votre avis ?
Merci
Voici code "ChannelScanner" qui tourne sur ma NANO et sur ma UNO.
"g" ou "e" pour les mettre en émission ou en réception mode scan.
J'ai établi le canal 10 en émission (radio.startConstCarrier(RF24_PA_LOW, 10);
/*
* Copyright (C) 2011 J. Coliz <maniacbug@ymail.com>
* Updated 2020 TMRh20
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*/
/**
* Channel scanner and Continuous Carrier Wave Output
*
* Example to detect interference on the various channels available.
* This is a good diagnostic tool to check whether you're picking a
* good channel for your application.
*
* Run this sketch on two devices. On one device, start CCW output by sending a 'g'
* character over Serial. The other device scanning should detect the output of the sending
* device on the given channel. Adjust channel and output power of CCW below.
*
* Inspired by cpixip.
* See http://arduino.cc/forum/index.php/topic,54795.0.html
*/
#include "RF24.h"
#include "printf.h"
//
// Hardware configuration
//
// Set up nRF24L01 radio on SPI bus plus pins 7 & 8
RF24 radio(7, 8);
//
// Channel info
//
const uint8_t num_channels = 126;
uint8_t values[num_channels];
//
// Setup
//
void setup(void) {
//
// Print preamble
//
Serial.begin(9600);
printf_begin();
Serial.println(F("\n\rRF24/examples/scanner/"));
//
// Setup and configure rf radio
//
radio.begin();
radio.setAutoAck(false);
// Get into standby mode
radio.startListening();
radio.stopListening();
radio.printDetails();
//delay(1000);
// Print out header, high then low digit
int i = 0;
while (i < num_channels) {
Serial.print(i >> 4, HEX);
++i;
}
Serial.println();
i = 0;
while (i < num_channels) {
Serial.print(i & 0xf, HEX);
++i;
}
Serial.println();
//delay(1000);
}
//
// Loop
//
const int num_reps = 100;
bool constCarrierMode = 0;
void loop(void) {
/****************************************/
// Send g over Serial to begin CCW output
// Configure the channel and power level below
if (Serial.available()) {
char c = Serial.read();
if (c == 'g') {
constCarrierMode = 1;
radio.stopListening();
delay(2);
Serial.println("Starting Carrier Out");
radio.startConstCarrier(RF24_PA_LOW, 10);// émission sur canal 10
} else if (c == 'e') {
constCarrierMode = 0;
radio.stopConstCarrier();
Serial.println("Stopping Carrier Out");
}
}
/****************************************/
if (constCarrierMode == 0) {
// Clear measurement values
memset(values, 0, sizeof(values));
// Scan all channels num_reps times
int rep_counter = num_reps;
while (rep_counter--) {
int i = num_channels;
while (i--) {
// Select this channel
radio.setChannel(i);
// Listen for a little
radio.startListening();
delayMicroseconds(128);
radio.stopListening();
// Did we get a carrier?
if (radio.testCarrier()) {
++values[i];
}
}
}
// Print out channel measurements, clamped to a single hex digit
int i = 0;
while (i < num_channels) {
if (values[i])
Serial.print(min(0xf, values[i]), HEX);
else
Serial.print(F("-"));
++i;
}
Serial.println();
} //If constCarrierMode == 0
}
Bonsoir j'ai laissé passer un peu de temps.
Ce soir je viens d'aboutir à faire causer mes 2 NRF24, entre temps j'ai remplacer ma carte Nano 33 par une autre Nano (plus causante en matière de diagnostique, du coup j'ai pu mettre en évidence un fil (CSN je crois) coupé dans sa gaine thermo rétractable - je fabrique mes jumpers - galère à trouver, la carte Nano n'est pas en cause, mais est limitée en matière de diagnostic (printF non pris en charge).
Donc le croquis NRF24GetStarted de la library NRF24 fonctionne tout à fait bien sur mes 2 montages dans un sens ou dans l'autre.
Bonne soirée.