2021-01-18 04:45 AM
Hello,
I'm trying to connect some sensors to the I2C1 connectors of the STM32MP157A-DK1 and read datas from a linux application (Cortex A7). It doesn't works...
But I successfully read data from the I2C5 connectors from the Cortex M4 processor.
I used the following configuration from STM32CubeMX for I2C1:
But when i run
#i2cdetect -y 0
#i2cdetect -y 1
#i2cdetect -y 2
I don't see any of my devices:
Here is the DeviceTree file (located in "\CA7\DeviceTree\Monitoring\kernel\stm32mp157a-monitoring-mx.dts")
&i2c1{
pinctrl-names = "default", "sleep";
pinctrl-0 = <&i2c1_pins_mx>;
pinctrl-1 = <&i2c1_sleep_pins_mx>;
status = "okay";
/* USER CODE BEGIN i2c1 */
i2c-scl-rising-time-ns = <100>;
i2c-scl-falling-time-ns = <7>;
/delete-property/ dmas;
/delete-property/ dma-names;
hdmi-transmitter@39{
compatible = "sil,sii9022";
reg = <0x39>;
iovcc-supply = <&v3v3_hdmi>;
cvcc12-supply = <&v1v2_hdmi>;
reset-gpios = <&gpioa 10 GPIO_ACTIVE_LOW>;
interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
interrupt-parent = <&gpiog>;
#sound-dai-cells = <0>;
status = "okay";
ports{
#address-cells = <1>;
#size-cells = <0>;
port@0{
reg = <0>;
sii9022_in:endpoint{
remote-endpoint = <<dc_ep0_out>;
};
};
port@3{
reg = <3>;
sii9022_tx_endpoint:endpoint{
remote-endpoint = <&i2s2_endpoint>;
};
};
};
};
cs42l51:cs42l51@4a{
compatible = "cirrus,cs42l51";
reg = <0x4a>;
#sound-dai-cells = <0>;
VL-supply = <&v3v3>;
VD-supply = <&v1v8_audio>;
VA-supply = <&v1v8_audio>;
VAHP-supply = <&v1v8_audio>;
reset-gpios = <&gpiog 9 GPIO_ACTIVE_LOW>;
clocks = <&sai2a>;
clock-names = "MCLK";
status = "okay";
cs42l51_port:port{
#address-cells = <1>;
#size-cells = <0>;
cs42l51_tx_endpoint:endpoint@0{
reg = <0>;
remote-endpoint = <&sai2a_endpoint>;
frame-master;
bitclock-master;
};
cs42l51_rx_endpoint:endpoint@1{
reg = <1>;
remote-endpoint = <&sai2b_endpoint>;
frame-master;
bitclock-master;
};
};
};
/* USER CODE END i2c1 */
};
What is wrong with my configuration?
I read that I2C1 is used by HDMI and some other devices on the DK1 board, does that mean i can't use it?
Can i use I2C5 from the Cortex M4 and the Cortex A7 at the same time?
2021-01-26 12:09 AM
Ok i just found that the Device Tree for Cortex A7 generated from STM32CubeMX is not automatically uploaded to the STM board when i run the M4 project.
The solution was to follow this tutorial to setup an OpenSTLinux project then run A7 project or manually copy generated .dtb to "/boot/stm32mp157a-dk1.dtb" (set correct card name)
I didn't see any documentation about this process? Something like : "How to use device tree generated by STMCubeMX"
Ok now i can read my I2C bus... But... I can't run the M4 project anymore from STMCubeIDE :sad_but_relieved_face:
I have the following logs when GDB is trying to attach:
Info : New GDB Connection: 2, Target STM32MP157AACx.cm4, state: reset
Warn : negative reply, retrying
Warn : negative reply, retrying
Warn : target STM32MP157AACx.cm4 is not halted (add breakpoint)
Error: can't add breakpoint: target running
Info : dropped 'gdb' connection
shutdown command invoked
Info : dropped 'gdb' connection
And nothing in "/sys/class/remoteproc/"
Any idea ?