Salve a tutti. Mi sono deciso a scrivere poiché sono parecchi giorni che sbatto la testa per risolvere questo rompicapo. Ho acquistato dalla Cina 4 Si4703 Breakout board (2 con PCB rosso e 2 con PCB viola). Le 2 schedine rosse montano il chip con la versione firmware 16 mentre le viola hanno la versione 19. Utilizzo un ESP32 WROOM con il quale gestisco una scheda. Ho utilizzato differenti librerie, ma il risultato è sempre il medesimo: Riesco a pilotare le schede con la firmware version 16, anche se il suono che ricevo è molto gracchiante. Non c'è verso di pilotare le schedine con la ver. 19 a bordo, anche se riesco a leggere i registri. Lo sketch che ho utilizzato per tutte le schede è questo...
#include <SI470X.h>
#define RESET_PIN 25 // On Arduino Atmega328 based board, this pin is labeled as A0 (14 means digital pin instead analog)
#define SDA_PIN 21 //
// I2C bus pin on ESP32
#define ESP32_I2C_SDA 21
#define ESP32_I2C_SCL 22
#define MAX_DELAY_RDS 40 // 40ms - polling method
long rds_elapsed = millis();
SI470X rx;
void showHelp()
{
Serial.println("Type U to increase and D to decrease the frequency");
Serial.println("Type S or s to seek station Up or Down");
Serial.println("Type + or - to volume Up or Down");
Serial.println("Type 0 to show current status");
Serial.println("Type ? to this help.");
Serial.println("==================================================");
delay(1000);
}
// Show current frequency
void showStatus()
{
char aux[80];
sprintf(aux,"\nYou are tuned on %u MHz | RSSI: %3.3u dbUv | Vol: %2.2u | %s ",rx.getFrequency(), rx.getRssi(), rx.getVolume(), (rx.isStereo()) ? "Yes" : "No" );
Serial.print(aux);
}
void setup()
{
Serial.begin(115200);
while (!Serial) ;
// The line below may be necessary to setup I2C pins on ESP32
Wire.begin(ESP32_I2C_SDA, ESP32_I2C_SCL);
rx.setup(RESET_PIN, ESP32_I2C_SDA);
rx.setVolume(6);
delay(500);
// Select a station with RDS service in your place
Serial.print("\nEstacao 106.5MHz");
rx.setFrequency(10650); // It is the frequency you want to select in MHz multiplied by 100.
// Enables SDR
rx.setRds(true);
rx.setRdsMode(0);
rx.setSeekThreshold(30); // Sets RSSI Seek Threshold (0 to 127)
showHelp();
showStatus();
}
void loop()
{
if (Serial.available() > 0)
{
char key = Serial.read();
switch (key)
{
case '+':
rx.setVolumeUp();
break;
case '-':
rx.setVolumeDown();
break;
case 'U':
case 'u':
rx.setFrequencyUp();
break;
case 'D':
case 'd':
rx.setFrequencyDown();
break;
case 'S':
rx.seek(SI470X_SEEK_WRAP, SI470X_SEEK_UP);
break;
case 's':
rx.seek(SI470X_SEEK_WRAP, SI470X_SEEK_DOWN);
break;
case '0':
showStatus();
break;
case '?':
showHelp();
break;
default:
break;
}
delay(200);
showStatus();
}
delay(5);
}
Qualcuno si è trovato con il medesimo problema o può aiutarmi a risolverlo. Grazie mille.