Connecting cc1101 to arduino

I'm almost 4 months block on my cc1101 project, beacuse I can't make work it. I bought a breadboard and a 545043 YwRobot, that a technician told me that can work for my situation. I used ChatGPT for the project, beacuse I'm not expert with c++ and with Electronic arguments, I program only for passion.
So the main problem is: the module doesn't response, prints out 0x0 as this sketch (made from chatgpt):


#define NSS 10  // Pin di selezione del modulo (Chip Select)
#define GDO0 2  // Pin di GDO0 (input per segnali di interruzione)

void setup() {
  Serial.begin(9600);  // Inizializza la comunicazione seriale
  Serial.println("Inizializzazione CC1101");

  // Inizializza SPI
  SPI.begin();
  pinMode(NSS, OUTPUT);
  pinMode(GDO0, INPUT);  // Impostiamo GDO0 come ingresso
  digitalWrite(NSS, HIGH);  // Deseleziona il modulo

  // Aggiungiamo un ritardo prima della lettura del registro
  delay(500);

  // Eseguiamo un test di lettura dal registro di versione del CC1101
  byte version = readCC1101Register(0x30);  // 0x30 è il registro di versione del CC1101

  Serial.print("Valore del registro di versione: 0x");
  Serial.println(version, HEX);  // Mostriamo il valore del registro nel Monitor Serial
  delay(1000);  // Attendere un attimo
}

void loop() {
  // Nulla da fare nel loop
}

// Funzione per leggere un registro del modulo CC1101
byte readCC1101Register(byte reg) {
  digitalWrite(NSS, LOW);  // Selezioniamo il modulo (attiviamo CS)

  // Invia il comando di lettura del registro
  SPI.transfer(0x80 | reg);  // 0x80 indica una lettura (bit alto)
  byte result = SPI.transfer(0x00);  // Invia un byte qualsiasi per ricevere il valore

  digitalWrite(NSS, HIGH);  // Deselezioniamo il modulo (disattiviamo CS)

  return result;  // Restituisce il valore letto dal registro
}

Can someone explain me what I'm doing wrong?

How about using some library that has been verified to work?

You don't mention what Arduino board you have and what CC1101 you use.

chatGPT does not understand programming electronics. It is only a statistics computer. It samples code... even code that does not work... to make a guess.

I see you started to use a <CODE> block. Be sure to have the beginning and ending ``` on their own line... try to fix your post.

Which module?

Sadly, neither is chatGPT.

In response to the input you give it, it outputs some sort of average of the code on the web that seems relevant, without understanding any the details.

1 Like

Thanks for trying to use code tags in your first post; it did not quite work out. I've fixed it for you.

The three back ticks (```) need to be on their own line!

Sorry if I was vague. I have Arduino UNO and CC1101 433. 2.0

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.