Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Boardcore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
Skyward Boardcore
Commits
b9e06b5c
Commit
b9e06b5c
authored
2 years ago
by
Emilio Corigliano
Committed by
Alberto Nidasio
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[I2C] Implemented correction factor also for stm32f756 to generate correct timings
parent
9d47c10e
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!134
Add support for stm32f756 nucleo
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/shared/drivers/i2c/I2CDriver-f7.cpp
+12
-1
12 additions, 1 deletion
src/shared/drivers/i2c/I2CDriver-f7.cpp
with
12 additions
and
1 deletion
src/shared/drivers/i2c/I2CDriver-f7.cpp
+
12
−
1
View file @
b9e06b5c
...
@@ -74,6 +74,17 @@ I2CTimings calculateTimings(uint32_t f, uint32_t fi2c)
...
@@ -74,6 +74,17 @@ I2CTimings calculateTimings(uint32_t f, uint32_t fi2c)
// for SCLDEL and SDADEL
// for SCLDEL and SDADEL
uint32_t
temp_presc
=
f
/
(
64
*
fi2c
);
uint32_t
temp_presc
=
f
/
(
64
*
fi2c
);
#if defined(_BOARD_STM32F756ZG_NUCLEO)
const
uint16_t
correction
=
10
;
#elif defined(_BOARD_STM32F767ZI_COMPUTE_UNIT) || \
defined(_BOARD_STM32F767ZI_NUCLEO)
const
uint16_t
correction
=
7
;
#else
const
uint16_t
correction
=
0
;
#warning \
"I2C Timings not corrected, actual frequency could be lower than nominal"
#endif
// presc is 4 bit long, so avoiding overflow
// presc is 4 bit long, so avoiding overflow
if
(
temp_presc
>=
16
)
if
(
temp_presc
>=
16
)
{
{
...
@@ -93,7 +104,7 @@ I2CTimings calculateTimings(uint32_t f, uint32_t fi2c)
...
@@ -93,7 +104,7 @@ I2CTimings calculateTimings(uint32_t f, uint32_t fi2c)
// distributing the correction on SCLL and SCLH
// distributing the correction on SCLL and SCLH
i2cTimings
.
sclh
=
i2cTimings
.
scll
=
i2cTimings
.
sclh
=
i2cTimings
.
scll
=
(
f
/
(
fi2c
*
2
*
(
i2cTimings
.
presc
+
1
))
-
1
)
-
(
f
/
(
fi2c
*
2
*
(
i2cTimings
.
presc
+
1
))
-
1
)
-
(
7
/
(
i2cTimings
.
presc
+
1
));
(
correction
/
(
i2cTimings
.
presc
+
1
));
// SCLDEL >= (t_r + t_su) / ((PRESC+1)*t_i2c) - 1 ; approximated without
// SCLDEL >= (t_r + t_su) / ((PRESC+1)*t_i2c) - 1 ; approximated without
// subtracting 1. scldly and sdadly are calculated using values taken from
// subtracting 1. scldly and sdadly are calculated using values taken from
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment