RTEMS | stm32f4/i2c: Implement fast mode up to 400kHz in set_bitrate (!1203)

Mohamed Ayman (@mohamedayman23) gitlab at rtems.org
Mon Apr 13 08:43:42 UTC 2026



Mohamed Ayman created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1203

Project:Branches: mohamedayman23/rtems:fix-stm32f4-FIXME-issue-i2c to rtems/rtos/rtems:main
Author:   Mohamed Ayman



stm32f4/i2c: Implement fast mode up to 400kHz in set_bitrate

Previously, any bitrate above 100kHz returned RTEMS_NOT_IMPLEMENTED. Add fast mode support (DUTY=0, Tlow/Thigh=2) with correct CCR formula (PCLK / (3 \* br)) and rise time calculation (TRISE = FPCLK \* 300ns + 1), using a uint64_t cast to avoid 32-bit overflow.

![Screenshot from 2026-04-13 10-37-36.png](/uploads/92e8ff124a370c63e99be0f6b4750e61/Screenshot_from_2026-04-13_10-37-36.png){width=469 height=600}

![Screenshot from 2026-04-13 10-42-53.png](/uploads/73656c80ace0afdf1e6bcfc5c8892a23/Screenshot_from_2026-04-13_10-42-53.png){width=900 height=531}

AI Usage: Yes

AI Prompt: tell me the way should i think if i need to implement fast mode with avoiding the overflow corner cases.

AI Model: claude sonnet 4.6

How AI used: for explanation and avoid the corner cases.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1203
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260413/010d048b/attachment-0001.htm>


More information about the bugs mailing list