zephyr: STM32 I2C DMA Incorrect DMA config

Describe the bug

Testing communication on I2C4 on a STM32H747i-Discovery board with DMA turned on results in an error message:

[00:00:43.223,000] <err> dma_stm32_bdma: source and dest unit size error, 0  
[00:00:43.223,000] <err> dmamux_stm32: cannot configure the dmamux.  
[00:00:43.223,000] <err> i2c_ll_stm32_v2: Problem setting up DMA: -22  
[00:00:43.223,000] <err> i2c_ll_stm32_v2: Problem setting up TX DMA   

Seems like the ‘source_data_size’ is not setup in configure_dma() in I2C driver introduced in https://github.com/zephyrproject-rtos/zephyr/pull/81814

To Reproduce

Use configuration:

CONFIG_I2C_STM32_V2_DMA=y
CONFIG_DMA_STM32_BDMA=y

And device tree overlay

&i2c4 {
	dmas = <&dmamux2 0 14 (STM32_DMA_PERIPH_TX | STM32_DMA_PRIORITY_HIGH)
		&dmamux2 1 13 (STM32_DMA_PERIPH_RX | STM32_DMA_PRIORITY_HIGH)>;
		dma-names = "tx", "rx";
};
&bdma1 {
	status = "okay";
};
&dma2 {
	status = "okay";
};
&dmamux2 {
	status = "okay";
};

Test communication on I2C4 (Touch controller on STM32H747i-Discovery) Expected behavior

No error message and communication working Impact

None Logs and console output

Environment (please complete the following information):

  • OS: (e.g. Linux, MacOS, Windows) Ubuntu 22
  • Toolchain (e.g Zephyr SDK, …) NA
  • Commit SHA or Version used 56f7dc4c2ea3390ef8efeed295334afc62ebbea9 Additional context

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (14 by maintainers)

Most upvoted comments

Unsure how I managed it but I was building a stale project. I’ve set up a clean project and I’ve made the changes to get it to build now. I’m looking to test with an h735 when I get the chance and I am hoping it is similar enough to your setup.

Changes have been pushed and the PR marked draft until I can test it

Yes i hopefully can try it out to night

I shall do some debugging later today with source_data_size and dest_data_size set to 1 and see what happens

@JarmouniA thanks for tagging me, I’ll take a look at this shortly.

@erian747 I don’t have the same nucleo board but I’ll see if I can set something up that’s similar enough here and go from there