Je pense que c'est un problème Hardware que je n'arrive donc pas à identifier.
J'ai repris mon fichier "référence" et j'ai commencer à le reconstruire.
Dans mon setup()je fais les truc Basic, sans faire I2C Scanner.
Quand mon code passe sur le RTC3231, le premier I2C, il plante comme décris plus haut.
Si j'upload ce code dans mon ancienne carte qui marche, CA PASSE. Donc dès qu'il voit le premier I2C, il plante.
//#define OLED
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Wire.begin();
delay(8000); // Wait for the terminal
Serial.println(F("\r\n******************************************"));
Serial.print(F("* ECO-SENSORS "));
Serial.print(VERSION);
Serial.println(F(" *"));
Serial.println(F("\r\n******************************************"));
// J'INITIE MA CARTE SD. CA PASSE!!
if(Si.begin()==0){ // Init SD
while(1){
Si.sprintln(F("Error: Si.begin()"),0);
delay(1000);
}
}
//First LCD, PCF, then the RTC, the SD and the log files must be initiated
Si.sprintln(F("\r\nSETUP"), 0);
Si.sprintln(F("==================="), 0);
// OLED EST DESACTIVE
#if defined(OLED)
Si.sprintln(F("\r\nStarting OLED"),0);
// by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)
//oled.begin(SSD1306_SWITCHCAPVCC, 0x3D); // initialize with the I2C addr 0x3D (for the 128x64)
//oled.begin();
oled.display();
#if defined(DEBUG)
Si.sprintln(F("Wait for Splash"),0);
#endif
delay(2000); // Give a delay to display the Splash
// Clear the buffer.
oled.clearDisplay(); // Clear buffer
oled.fillRect(0, 0, oled.width(), 10, INVERSE);
oled.display();
oled.setTextColor(BLACK);
oled.setCursor(1,1);
oled.print("Setup");
oled.display();
oled.setTextColor(WHITE);
oled.setCursor(0,16);
oled.display();
int o_y = 10;
Si.sprintln(F("[OK] OLED"),0);
o_y = oledCursorY(o_y);
oled.setCursor(0,o_y);
oled.print("[OK] OLED");
oled.display();
#else
Si.sprintln(F("[NA] OLED"),0);
#endif
#if defined(SENSOR_RTC_DS3231)
Si.sprintln(F("\r\n# Start DS3231"),0);
if (!Si.RtcBegin())
{
#if defined(OLED)
o_y = oledCursorY(o_y);
oled.setCursor(0,o_y);
oled.print("[KO] DS3231!");
oled.display();
#endif
Si.sprintln(F("[KO] DS3231"),0);
while (1)
{
#if defined(PCFlib)
expander.digitalWrite(wakeup_led, HIGH);
delay(100);
expander.digitalWrite(wakeup_led, LOW);
delay(100);
expander.digitalWrite(wattering_led, HIGH);
delay(100);
expander.digitalWrite(wattering_led, LOW);
delay(100);
#endif
}
}
Si.RtcLostPower();
Si.sprintln(F("[OK] DS3231"),0);
#if defined(OLED)
o_y = oledCursorY(o_y);
oled.setCursor(0,o_y);
oled.print("[OK] DS3231");
oled.display();
#endif
#endif
/*
* Get time
*/
#if defined(SENSOR_RTC_DS3231)
Si.sprintln(F("\r\n# Get time"),0);
Si.RtcGetTime(y,m,d,h,mn,s,lastTx,date_time);
#else
y = 1970;
m = 1;
d = 1;
h = 0;
mn = 0;
s = 1;
//date_time = "1970-01-01 00:00:01";
#endif
Serial.println(F("GOOOO"));
}
Voici ceque ca m'affiche dans mon terminal
Activation method ABP
SD card enable
LOGGER enable
PRINT enable
EEPROM enable
Begin SD
Listing files in root:
Current directory: /
0 2019-09-01 18:46:32 System Volume Information/
62 2000-01-01 01:00:00 clock.txt
0 2000-01-01 01:00:00 LOG/
88 2019-09-02 17:09:08 config.txt
235 2000-01-01 01:00:00 config_radio.txt
132 2000-01-01 01:00:00 config_sensors.txt
57 2019-09-02 16:59:14 config_irrigation.txt
235 2019-09-01 21:26:06 config_radio-otaa.txt
246 2019-09-02 16:53:02 config_radio-abp.txt
listing Files Done!
_isSdReady:1
SETUP
[NA] OLED
[OK] Wire
Start DS3231
On voit qu'il ne va pas plus loin que
Start DS3231
Juste après ceci, il commence a initier le RTC3231.
Ce qui a d'intéressant de voir, est que sur ma carte j'ai un switch pour allumer ou éteindre mon module. Forcément, ce swicth est ON. Qaund je le passe à OFF, il affiche ceci avant de s’éteindre
RTC lost power, lets set the time!
[OK] DS3231
Get time
C'est marrant, quand mon module est désalimenté, il affiche encore ceci!!!!!
J'ai pourtant vérifier mon schéma et je ne vois pas d'erreur.
Comment l'I2C peut être impacter de la sorte? Une idée?