Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions targets/TARGET_STM/TARGET_STM32L4/i2c_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#define MBED_I2C_DEVICE_H

#include "cmsis.h"
#include "mbed_error.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -82,6 +83,23 @@ static inline uint32_t get_i2c_timing(int hz)
default:
break;
}
} else if (SystemCoreClock == 120000000) {
// Common settings: I2C clock = 120 MHz, Analog filter = ON, Digital filter coefficient = 0
switch (hz) {
case 100000:
tim = 0x107075B0; // Standard mode with Rise Time = 400ns and Fall Time = 100ns
break;
case 400000:
tim = 0x00501E6C; // Fast mode with Rise Time = 250ns and Fall Time = 100ns
break;
case 1000000:
tim = 0x00200A26; // Fast mode Plus with Rise Time = 60ns and Fall Time = 100ns
break;
default:
break;
}
} else {
error("get_i2c_timing error\n");
}
return tim;
}
Expand Down