Arduino_core_stm32: [F4] I2C broken since last STM32F4 HAL update

Created on 28 Feb 2019  路  9Comments  路  Source: stm32duino/Arduino_Core_STM32

_[Edit: transferred from stm32duino/STM32RTC]_

Hello,
I recently seen the board library was updated some days ago and the HAL feature was newly implemented.
I thought that with the new master branch board platform the new library will work, so with my Nucleo-F411RE I tried to operate the new library.

It worked without I2C. I use D14/D15(I2C1) and if I connect any I2C device, then the MCU goes to forever sleep(all codes are stopped).

This code shows:

#include <Wire.h>
#include <STM32RTC.h>
STM32RTC& rtc = STM32RTC::getInstance();

void setup() {
  // put your setup code here, to run once:
  rtc.setClockSource(STM32RTC::LSE_CLOCK);
  rtc.begin(false); // initialize RTC 24H format

  if (!rtc.isTimeSet()) {
    rtc.setTime(0, 0, 0);
    rtc.setDate(1, 1, 19); // fallback
  }
  pinMode(LED_BUILTIN, OUTPUT);

  Wire.begin();

  Wire.beginTransmission(0x50);
  Wire.write(0);
  Wire.endTransmission();
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(500);
  digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
}

0x50 means the EEPROM device and I just wrote a waste data to the line, so there must be no problem.
However If I use this code with any I2C device connected, F411RE just halts and not respond for anything(interrupts are all stopped too).

Couldn't be the new library used yet? Or is this a bug?

Thank you.

Bug

Most helpful comment

Issue found and fixed.

All 9 comments

Additionally confirmed that the source caused halt only with Wire library, without STM32RTC and all related codes. It's so confusing. Initially I thought the RTC library has an issue with the master branch board platform but it seems that the core has another problem.

Hi @charlie1024
Thanks for report.
Could you give me more detail about your setup.
Which core version (master repo? official 1.5.0?..) STM32RTC version (I guess this is the master)? Board exact reference (MBxxxxx)? Arduino IDE version?

Hello,
I have MB1136-C-04(It has a 32.768kHz crystal).
Used core was directly got from the master branch. Official 1.5.0 seems doesn't support the new library so It will be out of the problem. STM32RTC version is from the master branch as well.
Finally, I'm using Arduino 1.8.8, which is the latest and before changing the core, the Arduino didn't make any problems.

Ok thanks. I will test on my side when possible.

@charlie1024,
I confirm this is a bug in the core since the last HAL update for F4.

I tried to implement new RTC feature with [RTC] Avoid reset time after low power mode #442 and that did work in 1.5.0 release platform. I hope the bug could be resolved. Thank you for assistance.

Of course this will be resolved ;)
Moreover there is a workaround to not block user who want use the master.

Issue found and fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidanger picture davidanger  路  7Comments

kwastek picture kwastek  路  4Comments

johncblacker picture johncblacker  路  5Comments

Adminius picture Adminius  路  6Comments

Jorgen-VikingGod picture Jorgen-VikingGod  路  8Comments