Problemi con RF-NANo

giorno a tutti,
ultimamente ho provato a utilizzare dei RF-NANO, che sono dei Arduino Nano con integrato un ricetrasmettitore RF24.
Purtroppo sinora non sono riuscito a usarli in quanto non riesco a visualizzare nulla sul serial monitor dell'IDE, ottengo solo una serie di quadratini e X,
ho provato ad usare sia l'ide 1.8.19 che la nuova 2.0 ottenendo sempre lo stesso risultato.
Qualcuno ha avuto lo stesso problema? Se si come avete fatto per risolverlo?
Grazie anticipatamente del vostro aiuto.

Mai intesa ... però, cercando con Google, ad esempio, viene fuori QUESTO tutorial ... non so se può servire ... :roll_eyes:

Guglielmo

grazie gpb01,
purtroppo non sono gli esempi di utilizzo che mi mancano, io non riesco a visualizzare nulla sul serial monitor se no una serie di geroglifici.

Sicuro di aver impostato la velocità del monitor seriale pari a quella che è nei programmi di esempio che stai usando?

Guglielmo

Si il baud rate nell'esempio era impostato a 115200 e io ho impostato il serial monitor alla stessa velocità

Allora non ho altre idee ... stai provando gli esempi a corredo di quanto va installato per quella scheda?

Guglielmo

Al momento non riesco a capire cosa manca, proverò a reinstallare la libreria.
Per il momento grazie lo stesso

Chiedo ancora scusa ma non sono riuscito a risolvere il problema.
ho acquistato altri rfnano da un altro fornitore, ho provato a disinstallare e reinstallare la ide ma sempre con qualunque sketch ottengo sempre simboli strani sul monitor seriale, cosa che non avviene con tutti gli altri arduino con cui ho provato.
Qualcuno può aiutarmi a risolvere il mio problema?

Grazie per l'aiuto

... di solito questo è sintomo di differenza di velocità tra quella selezionata sul monitor seriale e quella che viene scelta nella Serial.begin() dell'applicazione :roll_eyes:

Prova a verificare ...

Guglielmo

Adesso la vera domanda, per lo OP e:

Ma riesci a programmarlo ?

Cosa ottieni come esito della programmazione?

Perché se si programma la seriale va...

E la cpu anche

... altro dubbio ... ma quando hai questi simboli strani? Quando colleghi la scheda? Quando carichi il programma? Terminato il caricamento? Quando il programma va in esecuzione?

Guglielmo

grazie per le vostre risposte.
Riesco sempre a programmare le board con esito positivo.
Sono sicuro che la velocità del monitor seriale è corretta, con le altre board non ho problemi.
solo con le rfnano, quando durante l'esecuzione del programma dovrei avere degli output tramite seriale ottengo i simboli strani.
ripeto solo con le rfnano, con tutte le altre (ho provato con uno, mega, nano) tutto risulta regolare

A questo punto metti qui il codice che usi (racchiuso nei tag CODE come da REGOLAMENTO) così gli diamo un'occhiata ...

Guglielmo

1 Like

Metti anche un programma di quelli che vanno con un'altra scheda

1 Like
type or paste code here/*
 * 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"

// instantiate an object for the nRF24L01 transceiver
RF24 radio(7, 8);  // using pin 7 for the CE pin, and pin 8 for the 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(115200);
  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_LOW);  // RF24_PA_MAX is default.

  // 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 into the TX pipe
  radio.openWritingPipe(address[radioNumber]);  // always uses pipe 0

  // 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 role
  if (role) {
    radio.stopListening();  // put radio in TX mode
  } else {
    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 recieved 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

E' solamente ino sketch di esempio della libreria RF24

facendola girare su un normale nano o uno ottengo le risposte congrue con il rfnano solo i geroglifici

Link alla libreria che hai usato (per nRF24 ce ne sono varie) e nome dell'esempio che hai copiato.

Intanto togli quella #include "printf.h" che tanto non la usi.

Ah, metti anche un link al RF-Nano che hai realmente acquistato ... :wink:

Guglielmo

il link al RF-nano è Chunyang Integrated Circuit IC RF-Nano scheda integrata circuito integrato NRF24L01 modulo wireless Micro USB Nano presidente : Amazon.it: Informatica,

Il Link alla libreria è RF24 - Librerie Arduino (arduinolibraries.info)

L'esempio e il GettingStarted.ino

Grazie ancoea per il tempo che mi dedichi

Ma, quando parli delle altre che vanno, colleghi anche un modulino esterno nRF24 o le usi così come sono, senza nulla?

E se con la RF-Nano carichi un semplice programma che stampa solo un qualche cosa sulla seriale (senza quindi andare a parlare con il modulo nFR24) cosa ottieni?

Guglielmo

Entrambe le soluzioni.
Addirittura se carico sul rf-nano lo sketch di base 'HELLO WORLD' ottengo sempre i simboli strani

Mi vengono in mente due sole possibilità ...
... driver della seriale installato sul PC errato (... ma non capisco come) o schede RF-Nano difettate e non funzionanti.

Quello, a tutti gli effetti, è un clone di Arduino Nano, ovvero una cosa basata su ATmega328P, connesso alla porta seriale con un chip della serie CH34x (che richiede appunto specifico driver) ... se funziona un Arduino UNO, deve andare anche quello :roll_eyes:

Guglielmo