Hi, i'm using the Wire scan example.
if my i2s peripheric is connected the code run well, but when i disconnect the peripheric, MCU freeze and restarted by IWDG
could someone help me?
there is an alternative library to use?
Without external pull-ups (like the ones likely in your device) I2C will stall because the lines won't raise up. Add fixed external pull-ups and you shouldn't see a problem.
Hi, i'm using the Wire scan example. if my i2s peripheric is connected the code run well, but when i disconnect the peripheric, MCU freeze and restarted by IWDG
could someone help me? there is an alternative library to use?
Here the code.. thks
`#include
include <libmaple/iwdg.h>
TwoWire WIRE2 (2,I2C_FAST_MODE);
define Wire WIRE2
define TXPIN PA8
int cycle;
void setup() { iwdg_init(IWDG_PRE_32, 8000); iwdg_feed();
pinMode(TXPIN, OUTPUT); digitalWrite(TXPIN,HIGH);
Serial1.begin(9600); Wire.begin(); Serial1.println("\nI2C Scanner"); }
void loop() { iwdg_feed(); byte error, address; int nDevices;
Serial1.print(cycle); Serial1.println(". Scan ***** ");
nDevices = 0; for(address = 1; address < 127; address++) {
} if (nDevices == 0) Serial1.println("No I2C devices found"); else Serial1.println("done");
delay(1000); // wait 5 seconds for next scan cycle++;
}`