diff --git a/openocd.cfg b/openocd.cfg index 88b2e9c..6afa9fb 100644 --- a/openocd.cfg +++ b/openocd.cfg @@ -1,5 +1,8 @@ # Sample OpenOCD configuration for the blue pill board +# Some microcontrollers have a different CPU ID; uncomment this if yours is one +set CPUTAPID 0x2ba01477 + # Depending on the hardware revision you got you'll have to pick ONE of these # interfaces. At any time only one interface should be commented out. diff --git a/src/main.rs b/src/main.rs index 01c6ecd..8220a15 100644 --- a/src/main.rs +++ b/src/main.rs @@ -118,6 +118,10 @@ fn main() -> ! { let scl = gpiob.pb10.into_alternate_open_drain(&mut gpiob.crh); let sda = gpiob.pb11.into_alternate_open_drain(&mut gpiob.crh); + // Very brief delay before starting up i2c; otherwise the startup process + // could hang. + delay.delay_us(10_u8); + // Configure the I2C peripheral itself let i2c = BlockingI2c::i2c2( dev_periph.I2C2, @@ -166,9 +170,6 @@ fn main() -> ! { // Turn the LED on via the OutputPin trait led.on().unwrap(); - // Very brief delay before the loop, just to show how - delay.delay_us(10_u8); - let mut button_last = false; // Microcontroller programs never exit main, so we must loop! loop {