Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu/stm32: allow arbitrary I2C clocks #20169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maribu
Copy link
Member

@maribu maribu commented Dec 12, 2023

Contribution description

This allows arbitrary I2C clock frequencies for MCUs using the i2c_2.c I2C implementation.

Testing procedure

I2C should still work and still have the correct clock frequency.

Issues/PRs references

None

@maribu maribu added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet labels Dec 12, 2023
@github-actions github-actions bot added Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: cpu Area: CPU/MCU ports labels Dec 12, 2023
typedef enum {
#if defined(CPU_FAM_STM32F1) || defined(CPU_FAM_STM32F2) || \
defined(CPU_FAM_STM32F4) || defined(CPU_FAM_STM32L1) || \
defined(CPU_FAM_STM32MP1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not familiar with this header. There seemed to be a distinction between the STM families that has been completely removed. How does this work now? Got the distinction just dropped? Was it not need in the first place?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The one implementation (i2c_1.c) already supported arbitrary I2C speeds, the other (i2c_2.c) did not. This adds support for arbitrary I2C speeds for the other (i2c_2.c) as well. Hence, both enum values are just for backward compatibility / portability now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No :-/ i2c_1.c doesn't allow arbitrary clock speeds. I need to revert that.

@maribu maribu force-pushed the cpu/stm32/periph_i2c/clock_speed branch 2 times, most recently from d0c2bb5 to 54a822e Compare March 18, 2024 14:19
@maribu
Copy link
Member Author

maribu commented Mar 18, 2024

This needed a rebase to resolve merge conflicts. I guess I'd rather test the I2C peripheral again on a board of each flavor to avoid any regressions.

@maribu maribu force-pushed the cpu/stm32/periph_i2c/clock_speed branch 4 times, most recently from 8a19639 to 70bb72a Compare March 18, 2024 16:46
@maribu
Copy link
Member Author

maribu commented Mar 18, 2024

nucleo-f446re: All OK
make BOARD=nucleo-f446re flash test-with-config 
Building application "tests_selftest_shield" for "nucleo-f446re" with CPU "stm32".

"make" -C /home/maribu/Repos/software/RIOT/master/pkg/cmsis/ 
"make" -C /home/maribu/Repos/software/RIOT/master/boards/common/init
"make" -C /home/maribu/Repos/software/RIOT/master/boards/nucleo-f446re
"make" -C /home/maribu/Repos/software/RIOT/master/boards/common/nucleo
"make" -C /home/maribu/Repos/software/RIOT/master/core
"make" -C /home/maribu/Repos/software/RIOT/master/core/lib
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/cortexm_common
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/cortexm_common/periph
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/periph
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/stmclk
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/vectors
"make" -C /home/maribu/Repos/software/RIOT/master/drivers
"make" -C /home/maribu/Repos/software/RIOT/master/drivers/pcf857x
"make" -C /home/maribu/Repos/software/RIOT/master/drivers/periph_common
"make" -C /home/maribu/Repos/software/RIOT/master/sys
"make" -C /home/maribu/Repos/software/RIOT/master/sys/auto_init
"make" -C /home/maribu/Repos/software/RIOT/master/sys/div
"make" -C /home/maribu/Repos/software/RIOT/master/sys/isrpipe
"make" -C /home/maribu/Repos/software/RIOT/master/sys/libc
"make" -C /home/maribu/Repos/software/RIOT/master/sys/malloc_thread_safe
"make" -C /home/maribu/Repos/software/RIOT/master/sys/newlib_syscalls_default
"make" -C /home/maribu/Repos/software/RIOT/master/sys/pm_layered
"make" -C /home/maribu/Repos/software/RIOT/master/sys/preprocessor
"make" -C /home/maribu/Repos/software/RIOT/master/sys/stdio
"make" -C /home/maribu/Repos/software/RIOT/master/sys/stdio_uart
"make" -C /home/maribu/Repos/software/RIOT/master/sys/test_utils/interactive_sync
"make" -C /home/maribu/Repos/software/RIOT/master/sys/test_utils/print_stack_usage
"make" -C /home/maribu/Repos/software/RIOT/master/sys/tiny_strerror
"make" -C /home/maribu/Repos/software/RIOT/master/sys/tsrb
   text	  data	   bss	   dec	   hex	filename
  19580	   128	  2780	 22488	  57d8	/home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/nucleo-f446re/tests_selftest_shield.elf
/home/maribu/Repos/software/RIOT/master/dist/tools/openocd/openocd.sh flash /home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/nucleo-f446re/tests_selftest_shield.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0+dev-snapshot (2024-01-17-08:38)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'adapter serial' not 'hla_serial'
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : clock speed 2000 kHz
Info : STLINK V2J40M27 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.254318
Info : [stm32f4x.cpu] Cortex-M4 r0p1 processor detected
Info : [stm32f4x.cpu] target has 6 breakpoints, 4 watchpoints
Info : [stm32f4x.cpu] Examination succeed
Info : starting gdb server for stm32f4x.cpu on 0
Info : Listening on port 44431 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f4x.cpu       hla_target little stm32f4x.cpu       unknown
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
[stm32f4x.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08001750 msp: 0x20000200
Info : device id = 0x10006421
Info : flash size = 512 KiB
auto erase enabled
wrote 32768 bytes from file /home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/nucleo-f446re/tests_selftest_shield.elf in 1.126048s (28.418 KiB/s)
verified 19708 bytes in 0.228899s (84.081 KiB/s)
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
shutdown command invoked
Done flashing
r
/home/maribu/Repos/software/RIOT/master/dist/tools/pyterm/pyterm -p "/dev/ttyACM1" -b "115200" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Connect to serial port /dev/ttyACM1
Welcome to pyterm!
Type '/exit' to exit.
�s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
READY
s
START
main(): This is RIOT! (Version: 2024.04-devel-390-gae3c35-cpu/stm32/periph_i2c/clock_speed)
self-testing peripheral drivers
===============================
Starting test for GPIO at tests/periph/selftest_shield/main.c:346
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:368
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:398
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:428
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:454
(skipped)
Starting test for GPIO-IRQ at tests/periph/selftest_shield/main.c:501
[OK]
Starting test for GPIO-IRQ at tests/periph/selftest_shield/main.c:564
[OK]
Starting test for GPIO-IRQ at tests/periph/selftest_shield/main.c:627
[OK]
Starting test for I2C at tests/periph/selftest_shield/main.c:701
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for ADC at tests/periph/selftest_shield/main.c:1027
[OK]


ALL TESTS SUCCEEDED
nucleo-f303re: I2C OK (but ADC broken, pre-existing & unrelated)
make BOARD=nucleo-f303re flash test-with-config                  
Building application "tests_selftest_shield" for "nucleo-f303re" with CPU "stm32".

"make" -C /home/maribu/Repos/software/RIOT/master/pkg/cmsis/ 
"make" -C /home/maribu/Repos/software/RIOT/master/boards/common/init
"make" -C /home/maribu/Repos/software/RIOT/master/boards/nucleo-f303re
"make" -C /home/maribu/Repos/software/RIOT/master/boards/common/nucleo
"make" -C /home/maribu/Repos/software/RIOT/master/core
"make" -C /home/maribu/Repos/software/RIOT/master/core/lib
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/cortexm_common
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/cortexm_common/periph
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/periph
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/stmclk
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/vectors
"make" -C /home/maribu/Repos/software/RIOT/master/drivers
"make" -C /home/maribu/Repos/software/RIOT/master/drivers/pcf857x
"make" -C /home/maribu/Repos/software/RIOT/master/drivers/periph_common
"make" -C /home/maribu/Repos/software/RIOT/master/sys
"make" -C /home/maribu/Repos/software/RIOT/master/sys/auto_init
"make" -C /home/maribu/Repos/software/RIOT/master/sys/div
"make" -C /home/maribu/Repos/software/RIOT/master/sys/frac
"make" -C /home/maribu/Repos/software/RIOT/master/sys/isrpipe
"make" -C /home/maribu/Repos/software/RIOT/master/sys/libc
"make" -C /home/maribu/Repos/software/RIOT/master/sys/malloc_thread_safe
"make" -C /home/maribu/Repos/software/RIOT/master/sys/newlib_syscalls_default
"make" -C /home/maribu/Repos/software/RIOT/master/sys/pm_layered
"make" -C /home/maribu/Repos/software/RIOT/master/sys/preprocessor
"make" -C /home/maribu/Repos/software/RIOT/master/sys/stdio
"make" -C /home/maribu/Repos/software/RIOT/master/sys/stdio_uart
"make" -C /home/maribu/Repos/software/RIOT/master/sys/test_utils/interactive_sync
"make" -C /home/maribu/Repos/software/RIOT/master/sys/test_utils/print_stack_usage
"make" -C /home/maribu/Repos/software/RIOT/master/sys/tiny_strerror
"make" -C /home/maribu/Repos/software/RIOT/master/sys/tsrb
"make" -C /home/maribu/Repos/software/RIOT/master/sys/ztimer
   text	  data	   bss	   dec	   hex	filename
  20996	   168	  2884	 24048	  5df0	/home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/nucleo-f303re/tests_selftest_shield.elf
/home/maribu/Repos/software/RIOT/master/dist/tools/openocd/openocd.sh flash /home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/nucleo-f303re/tests_selftest_shield.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0+dev-snapshot (2024-01-17-08:38)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'adapter serial' not 'hla_serial'
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : clock speed 1000 kHz
Info : STLINK V2J40M27 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.270573
Info : [stm32f3x.cpu] Cortex-M4 r0p1 processor detected
Info : [stm32f3x.cpu] target has 6 breakpoints, 4 watchpoints
Info : [stm32f3x.cpu] Examination succeed
Info : starting gdb server for stm32f3x.cpu on 0
Info : Listening on port 36921 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f3x.cpu       hla_target little stm32f3x.cpu       unknown
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
[stm32f3x.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080017b0 msp: 0x20000200
Info : device id = 0x10036446
Info : flash size = 512 KiB
Warn : Adding extra erase range, 0x080052ac .. 0x080057ff
auto erase enabled
wrote 21164 bytes from file /home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/nucleo-f303re/tests_selftest_shield.elf in 1.200352s (17.218 KiB/s)
verified 21164 bytes in 0.395465s (52.262 KiB/s)
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
shutdown command invoked
Done flashing
r
/home/maribu/Repos/software/RIOT/master/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
!1)�1)䷚х��test, r to print it is ready
Help: Press s to start test, r to print it is ready
READY
s
START
main(): This is RIOT! (Version: 2024.04-devel-390-gae3c35-cpu/stm32/periph_i2c/clock_speed)
self-testing peripheral drivers
===============================
Starting test for GPIO at tests/periph/selftest_shield/main.c:346
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:368
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:398
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:428
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:454
(skipped)
Starting test for GPIO-IRQ at tests/periph/selftest_shield/main.c:501
[OK]
Starting test for GPIO-IRQ at tests/periph/selftest_shield/main.c:564
[OK]
Starting test for GPIO-IRQ at tests/periph/selftest_shield/main.c:627
[OK]
Starting test for I2C at tests/periph/selftest_shield/main.c:701
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for ADC at tests/periph/selftest_shield/main.c:1027
FAILURE in tests/periph/selftest_shield/main.c:1042
410 <= 389 <= 614: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
474 <= 441 <= 678: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
538 <= 492 <= 742: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
602 <= 547 <= 806: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
666 <= 598 <= 870: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
730 <= 652 <= 934: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
794 <= 711 <= 998: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
858 <= 772 <= 1023: FAILED
[FAILED]


SOME TESTS FAILED
nucleo-l073rz: I2C OK (but ADC broken, preexisting and unrelated)
make BOARD=nucleo-l073rz flash test-with-config
Building application "tests_selftest_shield" for "nucleo-l073rz" with CPU "stm32".

"make" -C /home/maribu/Repos/software/RIOT/master/pkg/cmsis/ 
"make" -C /home/maribu/Repos/software/RIOT/master/boards/common/init
"make" -C /home/maribu/Repos/software/RIOT/master/boards/nucleo-l073rz
"make" -C /home/maribu/Repos/software/RIOT/master/boards/common/nucleo
"make" -C /home/maribu/Repos/software/RIOT/master/core
"make" -C /home/maribu/Repos/software/RIOT/master/core/lib
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/cortexm_common
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/cortexm_common/periph
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/periph
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/stmclk
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/vectors
"make" -C /home/maribu/Repos/software/RIOT/master/drivers
"make" -C /home/maribu/Repos/software/RIOT/master/drivers/pcf857x
"make" -C /home/maribu/Repos/software/RIOT/master/drivers/periph_common
"make" -C /home/maribu/Repos/software/RIOT/master/sys
"make" -C /home/maribu/Repos/software/RIOT/master/sys/auto_init
"make" -C /home/maribu/Repos/software/RIOT/master/sys/div
"make" -C /home/maribu/Repos/software/RIOT/master/sys/isrpipe
"make" -C /home/maribu/Repos/software/RIOT/master/sys/libc
"make" -C /home/maribu/Repos/software/RIOT/master/sys/malloc_thread_safe
"make" -C /home/maribu/Repos/software/RIOT/master/sys/newlib_syscalls_default
"make" -C /home/maribu/Repos/software/RIOT/master/sys/pm_layered
"make" -C /home/maribu/Repos/software/RIOT/master/sys/preprocessor
"make" -C /home/maribu/Repos/software/RIOT/master/sys/stdio
"make" -C /home/maribu/Repos/software/RIOT/master/sys/stdio_uart
"make" -C /home/maribu/Repos/software/RIOT/master/sys/test_utils/interactive_sync
"make" -C /home/maribu/Repos/software/RIOT/master/sys/test_utils/print_stack_usage
"make" -C /home/maribu/Repos/software/RIOT/master/sys/tiny_strerror
"make" -C /home/maribu/Repos/software/RIOT/master/sys/tsrb
   text	  data	   bss	   dec	   hex	filename
  18736	   124	  2752	 21612	  546c	/home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/nucleo-l073rz/tests_selftest_shield.elf
/home/maribu/Repos/software/RIOT/master/dist/tools/openocd/openocd.sh flash /home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/nucleo-l073rz/tests_selftest_shield.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0+dev-snapshot (2024-01-17-08:38)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'adapter serial' not 'hla_serial'
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : clock speed 300 kHz
Info : STLINK V2J33M25 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.263559
Info : [stm32l0.cpu] Cortex-M0+ r0p1 processor detected
Info : [stm32l0.cpu] target has 4 breakpoints, 2 watchpoints
Info : [stm32l0.cpu] Examination succeed
Info : starting gdb server for stm32l0.cpu on 0
Info : Listening on port 45045 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32l0.cpu        hla_target little stm32l0.cpu        unknown
Info : Unable to match requested speed 300 kHz, using 240 kHz
Info : Unable to match requested speed 300 kHz, using 240 kHz
[stm32l0.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0xf1000000 pc: 0x080016a8 msp: 0x20000200
Info : Device: STM32L0xx (Cat.5)
Info : STM32L flash has dual banks. Bank (0) size is 96kb, base address is 0x8000000
auto erase enabled
wrote 20480 bytes from file /home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/nucleo-l073rz/tests_selftest_shield.elf in 4.700909s (4.254 KiB/s)
verified 18860 bytes in 0.828857s (22.221 KiB/s)
Info : Unable to match requested speed 300 kHz, using 240 kHz
Info : Unable to match requested speed 300 kHz, using 240 kHz
shutdown command invoked
Done flashing
r
/home/maribu/Repos/software/RIOT/master/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
READY
s
START
main(): This is RIOT! (Version: 2024.04-devel-390-g5d54c-cpu/stm32/periph_i2c/clock_speed)
self-testing peripheral drivers
===============================
Starting test for GPIO at tests/periph/selftest_shield/main.c:346
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:368
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:398
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:428
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:454
(skipped)
Starting test for GPIO-IRQ at tests/periph/selftest_shield/main.c:501
[OK]
Starting test for GPIO-IRQ at tests/periph/selftest_shield/main.c:564
[OK]
Starting test for GPIO-IRQ at tests/periph/selftest_shield/main.c:627
[OK]
Starting test for I2C at tests/periph/selftest_shield/main.c:701
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for ADC at tests/periph/selftest_shield/main.c:1027
FAILURE in tests/periph/selftest_shield/main.c:1042
0 <= 213 <= 166: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
26 <= 426 <= 230: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
90 <= 676 <= 294: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
154 <= 864 <= 358: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
218 <= 1110 <= 422: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
282 <= 1368 <= 486: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
346 <= 1644 <= 550: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
410 <= 1793 <= 614: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
474 <= 2042 <= 678: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
538 <= 2300 <= 742: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
602 <= 2584 <= 806: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
666 <= 2849 <= 870: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
730 <= 3127 <= 934: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
794 <= 3425 <= 998: FAILED
FAILURE in tests/periph/selftest_shield/main.c:1042
858 <= 3738 <= 1023: FAILED
[FAILED]


SOME TESTS FAILED
nucleo-l152re: hardfalting in test, also in master
make BOARD=nucleo-l152re test-with-config      
r
/home/maribu/Repos/software/RIOT/master/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.

Context before hardfault:
r
nucleo-f072rb: All OK
make BOARD=nucleo-f072rb flash test-with-config
Building application "tests_selftest_shield" for "nucleo-f072rb" with CPU "stm32".

"make" -C /home/maribu/Repos/software/RIOT/master/pkg/cmsis/ 
"make" -C /home/maribu/Repos/software/RIOT/master/boards/common/init
"make" -C /home/maribu/Repos/software/RIOT/master/boards/nucleo-f072rb
"make" -C /home/maribu/Repos/software/RIOT/master/boards/common/nucleo
"make" -C /home/maribu/Repos/software/RIOT/master/core
"make" -C /home/maribu/Repos/software/RIOT/master/core/lib
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/cortexm_common
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/cortexm_common/periph
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/periph
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/stmclk
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/vectors
"make" -C /home/maribu/Repos/software/RIOT/master/drivers
"make" -C /home/maribu/Repos/software/RIOT/master/drivers/pcf857x
"make" -C /home/maribu/Repos/software/RIOT/master/drivers/periph_common
"make" -C /home/maribu/Repos/software/RIOT/master/sys
"make" -C /home/maribu/Repos/software/RIOT/master/sys/auto_init
"make" -C /home/maribu/Repos/software/RIOT/master/sys/div
"make" -C /home/maribu/Repos/software/RIOT/master/sys/isrpipe
"make" -C /home/maribu/Repos/software/RIOT/master/sys/libc
"make" -C /home/maribu/Repos/software/RIOT/master/sys/malloc_thread_safe
"make" -C /home/maribu/Repos/software/RIOT/master/sys/newlib_syscalls_default
"make" -C /home/maribu/Repos/software/RIOT/master/sys/pm_layered
"make" -C /home/maribu/Repos/software/RIOT/master/sys/preprocessor
"make" -C /home/maribu/Repos/software/RIOT/master/sys/stdio
"make" -C /home/maribu/Repos/software/RIOT/master/sys/stdio_uart
"make" -C /home/maribu/Repos/software/RIOT/master/sys/test_utils/interactive_sync
"make" -C /home/maribu/Repos/software/RIOT/master/sys/test_utils/print_stack_usage
"make" -C /home/maribu/Repos/software/RIOT/master/sys/tiny_strerror
"make" -C /home/maribu/Repos/software/RIOT/master/sys/tsrb
   text	  data	   bss	   dec	   hex	filename
  18424	   124	  2768	 21316	  5344	/home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/nucleo-f072rb/tests_selftest_shield.elf
/home/maribu/Repos/software/RIOT/master/dist/tools/openocd/openocd.sh flash /home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/nucleo-f072rb/tests_selftest_shield.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0+dev-snapshot (2024-01-17-08:38)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'adapter serial' not 'hla_serial'
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : clock speed 1000 kHz
Info : STLINK V2J29M18 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.257819
Info : [stm32f0x.cpu] Cortex-M0 r0p0 processor detected
Info : [stm32f0x.cpu] target has 4 breakpoints, 2 watchpoints
Info : [stm32f0x.cpu] Examination succeed
Info : starting gdb server for stm32f0x.cpu on 0
Info : Listening on port 41393 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f0x.cpu       hla_target little stm32f0x.cpu       unknown
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
[stm32f0x.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0xc1000000 pc: 0x080016a0 msp: 0x20000200
Info : device id = 0x20016448
Info : flash size = 128 KiB
Warn : Adding extra erase range, 0x08004874 .. 0x08004fff
auto erase enabled
wrote 18548 bytes from file /home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/nucleo-f072rb/tests_selftest_shield.elf in 0.851435s (21.274 KiB/s)
verified 18548 bytes in 0.255563s (70.876 KiB/s)
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
shutdown command invoked
Done flashing
r
/home/maribu/Repos/software/RIOT/master/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
EADY
r
READY
s
START
main(): This is RIOT! (Version: 2024.04-devel-390-g8a196-cpu/stm32/periph_i2c/clock_speed)
self-testing peripheral drivers
===============================
Starting test for GPIO at tests/periph/selftest_shield/main.c:346
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:368
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:398
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:428
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:454
(skipped)
Starting test for GPIO-IRQ at tests/periph/selftest_shield/main.c:501
[OK]
Starting test for GPIO-IRQ at tests/periph/selftest_shield/main.c:564
[OK]
Starting test for GPIO-IRQ at tests/periph/selftest_shield/main.c:627
[OK]
Starting test for I2C at tests/periph/selftest_shield/main.c:701
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for ADC at tests/periph/selftest_shield/main.c:1027
[OK]


ALL TESTS SUCCEEDED
nucleo-f103rb: All OK
make BOARD=nucleo-f103rb flash test-with-config
Building application "tests_selftest_shield" for "nucleo-f103rb" with CPU "stm32".

"make" -C /home/maribu/Repos/software/RIOT/master/pkg/cmsis/ 
"make" -C /home/maribu/Repos/software/RIOT/master/boards/common/init
"make" -C /home/maribu/Repos/software/RIOT/master/boards/nucleo-f103rb
"make" -C /home/maribu/Repos/software/RIOT/master/boards/common/nucleo
"make" -C /home/maribu/Repos/software/RIOT/master/core
"make" -C /home/maribu/Repos/software/RIOT/master/core/lib
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/cortexm_common
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/cortexm_common/periph
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/periph
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/stmclk
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/vectors
"make" -C /home/maribu/Repos/software/RIOT/master/drivers
"make" -C /home/maribu/Repos/software/RIOT/master/drivers/pcf857x
"make" -C /home/maribu/Repos/software/RIOT/master/drivers/periph_common
"make" -C /home/maribu/Repos/software/RIOT/master/sys
"make" -C /home/maribu/Repos/software/RIOT/master/sys/auto_init
"make" -C /home/maribu/Repos/software/RIOT/master/sys/div
"make" -C /home/maribu/Repos/software/RIOT/master/sys/isrpipe
"make" -C /home/maribu/Repos/software/RIOT/master/sys/libc
"make" -C /home/maribu/Repos/software/RIOT/master/sys/malloc_thread_safe
"make" -C /home/maribu/Repos/software/RIOT/master/sys/newlib_syscalls_default
"make" -C /home/maribu/Repos/software/RIOT/master/sys/pm_layered
"make" -C /home/maribu/Repos/software/RIOT/master/sys/preprocessor
"make" -C /home/maribu/Repos/software/RIOT/master/sys/stdio
"make" -C /home/maribu/Repos/software/RIOT/master/sys/stdio_uart
"make" -C /home/maribu/Repos/software/RIOT/master/sys/test_utils/interactive_sync
"make" -C /home/maribu/Repos/software/RIOT/master/sys/test_utils/print_stack_usage
"make" -C /home/maribu/Repos/software/RIOT/master/sys/tiny_strerror
"make" -C /home/maribu/Repos/software/RIOT/master/sys/tsrb
   text	  data	   bss	   dec	   hex	filename
  18048	   124	  2772	 20944	  51d0	/home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/nucleo-f103rb/tests_selftest_shield.elf
/home/maribu/Repos/software/RIOT/master/dist/tools/openocd/openocd.sh flash /home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/nucleo-f103rb/tests_selftest_shield.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0+dev-snapshot (2024-01-17-08:38)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'adapter serial' not 'hla_serial'
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : clock speed 1000 kHz
Info : STLINK V2J29M18 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.247800
Info : [stm32f1x.cpu] Cortex-M3 r1p1 processor detected
Info : [stm32f1x.cpu] target has 6 breakpoints, 4 watchpoints
Info : [stm32f1x.cpu] Examination succeed
Info : starting gdb server for stm32f1x.cpu on 0
Info : Listening on port 35319 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f1x.cpu       hla_target little stm32f1x.cpu       unknown
[stm32f1x.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080014e0 msp: 0x20000200
Info : device id = 0x20036410
Info : flash size = 128 KiB
Warn : Adding extra erase range, 0x080046fc .. 0x080047ff
auto erase enabled
wrote 18172 bytes from file /home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/nucleo-f103rb/tests_selftest_shield.elf in 1.047988s (16.933 KiB/s)
verified 18172 bytes in 0.294181s (60.324 KiB/s)
shutdown command invoked
Done flashing
r
/home/maribu/Repos/software/RIOT/master/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
�est, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
READY
s
START
main(): This is RIOT! (Version: 2024.04-devel-390-g8a196-cpu/stm32/periph_i2c/clock_speed)
self-testing peripheral drivers
===============================
Starting test for GPIO at tests/periph/selftest_shield/main.c:346
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:368
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:398
[OK]
Starting test for GPIO at tests/periph/selftest_shield/main.c:428
(skipped)
Starting test for GPIO at tests/periph/selftest_shield/main.c:454
(skipped)
Starting test for GPIO-IRQ at tests/periph/selftest_shield/main.c:501
[OK]
Starting test for GPIO-IRQ at tests/periph/selftest_shield/main.c:564
[OK]
Starting test for GPIO-IRQ at tests/periph/selftest_shield/main.c:627
[OK]
Starting test for I2C at tests/periph/selftest_shield/main.c:701
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]
Starting test for SPI at tests/periph/selftest_shield/main.c:829
[OK]


ALL TESTS SUCCEEDED

@maribu maribu force-pushed the cpu/stm32/periph_i2c/clock_speed branch from 70bb72a to e79755b Compare March 18, 2024 16:59
@maribu maribu requested a review from benpicco March 18, 2024 18:16
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 20, 2024
@benpicco
Copy link
Contributor

So we can drop the WIP tag?

@riot-ci
Copy link

riot-ci commented Mar 20, 2024

Murdock results

✔️ PASSED

2da7b12 cpu/stm32: allow arbitrary I2C clocks for i2c_2.c

Success Failures Total Runtime
10044 0 10045 13m:17s

Artifacts

@maribu maribu force-pushed the cpu/stm32/periph_i2c/clock_speed branch from e79755b to 25c08a0 Compare March 20, 2024 19:49
@maribu maribu removed the State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet label Mar 20, 2024
This adds support for using arbitrary I2C clock speeds for the I2C
peripheral implemented in i2c_2.c.

Co-authored-by: benpicco <[email protected]>
@maribu maribu force-pushed the cpu/stm32/periph_i2c/clock_speed branch from 2925b79 to 2da7b12 Compare April 15, 2024 19:24
@benpicco benpicco requested a review from MrKevinWeiss April 15, 2024 19:43
@benpicco benpicco enabled auto-merge April 15, 2024 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants