Alright, so thanks to Nick (thank you!) I have now narrowed down my problem a little.
as a background, here is the C code that is causing the issue (i marked the error-origin in fat characters):
#define LIS3DHH_SPI_CFG(inst) \
(&(struct lis3dhh_spi_cfg){ \
.spi_conf = { \
.frequency = \
DT_INST_PROP(inst, clock_frequency), \
.operation = (SPI_WORD_SET(8) | \
SPI_OP_MODE_MASTER | \
SPI_MODE_CPOL | \
SPI_MODE_CPHA), \
.slave = DT_INST_REG_ADDR(inst), \
.cs = LIS3DHH_SPI_CS_PTR(inst), \
}, \
.cs_gpios_label = LIS3DHH_SPI_CS_LABEL(inst), \
})
So the problem is the devicetree that i am trying to use. Nick suggested i move the "spi-max-frequency" from the lis3dhh device to the spi2 node (like the spi yaml file suggests -> dts/bindings/spi/spi-device.yaml). So something like this:
&spi2 {
pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>;/*PIN34,PIN35,PIN36*/
cs-gpios = <&gpioc 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;/* PC6, Acc_CS */
status = "okay";
spi-max-frequency = <10000000>; /*max. 10MHz*/
lis3dhh: lis3dhh@11 {
compatible = "st,lis3dhh","st,spi_lis3dhh";
reg = <0x11>;
label = "LIS3DHH";
int1-gpios = <&gpioc 7 GPIO_ACTIVE_HIGH>; /*PC7*/
int2-gpios = <&gpioc 8 GPIO_ACTIVE_HIGH>; /*PC8 */
};
};
However, this lead me to realize that my devicetree does not access the normal spi-device.yaml but rather the st,stm32-spi.yaml which is accessing st,stm32-spi-common.yaml .
Now this file is not actually demanding a "spi-max-frequency" value at all. Though spi-controller.yaml it is possible to assign it a clock-frequency though.
So what I have tried now is adding that clock-frequency in both my code and in the devicetree. Now when i try that, i get the following error (i tried both options of adding it under the lis3dhh device and the spi node):
/home/markus/driver_test_lis3dhh/my-workspace/iots-fiso-id-p2-zephyr/build/zephyr/include/generated/devicetree_unfixed.h:24461:36: error: 'DT_N_S_soc_S_spi_40003800_S_lis3dhh_11_P_clock_frequency' undeclared here (not in a function); did you mean 'DT_N_S_soc_S_spi_40003800_S_lis3dhh_11_P_compatible'?
24461 | #define DT_N_INST_0_st_lis3dhh DT_N_S_soc_S_spi_40003800_S_lis3dhh_11
I also tried editing st,stm32-spi-common.yaml to include an spi-max-frequency value.
Here I get the following error:
/home/markus/driver_test_lis3dhh/my-workspace/iots-fiso-id-p2-zephyr/build/zephyr/include/generated/devicetree_unfixed.h:24461:36: error: 'DT_N_S_soc_S_spi_40003800_S_lis3dhh_11_P_spi_max_frequency' undeclared here (not in a function); did you mean 'DT_N_S_soc_S_spi_40003800_P_spi_max_frequency'?
24461 | #define DT_N_INST_0_st_lis3dhh DT_N_S_soc_S_spi_40003800_S_lis3dhh_11
So I guess there is an issue with me trying to access the wrong level of the devicetree? If I understand the error correctly, it is telling me that I am trying to access spi-max-frequency on the lis3dhh device (which i also gave that attribute by the way) but that does not exist and I should rather address the spi node's spi-max-frequency.
Now I don't really understand how I change this. Either accessing the node's spi-max-frequency or how to tell the devicetree to use the lis3dhh's spi-max-frequency attribute.
Again, I am very thankful for any advice.
Cheers,
Markus