2020-08-24 10:35 AM
Hello,
I would like to use the UART7 with A7 on the STM32MP157C-DK2 with the openstlinux-20-02-19 ecosystem. Therefore i tried to include/enable the UART interface in the device tree but it is not working correctly.
I configured UART7 in the stm32mp157a-dk1.dts file by setting the status "okay":
&uart7 {
pinctrl-names = "default";
pinctrl-0 = <&uart7_pins_a>;
status = "okay";
};
and in the stm32mp157.c.dtsi file by setting the status "okay":
uart7: serial@40018000 {
compatible = "st,stm32h7-uart";
reg = <0x40018000 0x400>;
clocks = <&rcc UART7_K>;
resets = <&rcc UART7_R>;
status = "okay";
};
An alias was already given:
aliases {
serial0 = &uart4;
serial1 = &usart3;
serial2 = &uart7;
};
I ran bitbake again,flashed the new image to the board and ran the dmesg command.
The following output was generated:
root@stm32mp1-disco:~# dmesg | grep ttySTM*
[ 0.000000] Kernel command line: root=/dev/mmcblk0p6 rootwait rw console=ttySTM0,115200
[ 0.531634] 4000e000.serial: ttySTM3 at MMIO 0x4000e000 (irq = 24, base_baud = 4000000) is a stm32-usart
[ 0.531934] serial serial0: tty port ttySTM3 registered
[ 0.533538] 40010000.serial: ttySTM0 at MMIO 0x40010000 (irq = 25, base_baud = 4000000) is a stm32-usart
[ 1.476144] console [ttySTM0] enabled
[ 5.672859] systemd[1]: Unnecessary job for dev-ttySTM0.device was removed.
It seems that UART7 is not registered nor enabled.
Does Yocto compile a .dtb file or do I have to take additional steps?
I kindly ask you for support. Best wishes
Solved! Go to Solution.
2020-08-26 8:51 AM
Hello @PSchw.16
You can check for the dtb build result with the following command on the host PC, in the deploy image directory of the yocto build:
$ dtc -I dtb -O dts stm32mp157c-dk2.dtb
It will give you the dt values in human format.
You can then check for the status of the serial@40018000 node.
Following the result, it will be build issue, or dt apply issue at kernel boot.
Regards
2020-08-24 12:01 PM
Do you see any USART related error messages in dmesg?
Yocto should re-build the device tree. Here you find more about that: https://stackoverflow.com/questions/38917745/quick-rebuild-of-device-tree-only-with-yocto-bitbake
You should check the timestamps of relevant files to check if they were rebuild.
Your .dts source looks reasonable. Similar code works on my DK2 (using buildroot).
2020-08-25 12:20 AM
Dear @PSchw.16
Please have a look to the wiki page https://wiki.st.com/stm32mpu/wiki/Trace_and_debug_scenario_-_UART_issue to help for debugging.
Regards
2020-08-26 1:40 AM
Hello KnarfB,
thank you for your fast response.
I rebuilt the device tree and the process seemed to work properly now. The timestamps of the files are up to date.
I tried flashing the SDcard with "FlashLayout_sdcard_stm32mp157c-dk2-trusted.tsv" via STCubeProgrammer, but it seems to me that something went wrong:
After flashing the SDcard the .dtb-files on the board were not updated although the .dtb-files on the host PC are up to date.
-rw-r--r-- 1 root root 71751 Mar 9 2018 stm32mp157a-dk1.dtb
-rw-r--r-- 1 root root 73626 Mar 9 2018 stm32mp157c-dk2-a7-examples.dtb
-rw-r--r-- 1 root root 74162 Mar 9 2018 stm32mp157c-dk2-m4-examples.dtb
-rw-r--r-- 1 root root 73578 Mar 9 2018 stm32mp157c-dk2.dtb
So the mistake may be the way I flash my device.
I would be very thankful if you could provide the way you flashed/updated your device tree.
2020-08-26 8:02 AM
Hello JeanPhilippeR,
thank you for answering my question. I tried to follow the steps given in the article to check the UART probe and I got the following outputs:
root@stm32mp1-disco:~# cat /proc/device-tree/soc/serial\@40018000/status
disabled
root@stm32mp1-disco:~# dmesg | grep 40018000
root@stm32mp1-disco:~# ls -l /proc/device-tree/aliases/*
-r--r--r-- 1 root root 23 Aug 18 01:38 /proc/device-tree/aliases/ethernet0
-r--r--r-- 1 root root 8 Aug 18 01:38 /proc/device-tree/aliases/name
-r--r--r-- 1 root root 21 Aug 18 01:38 /proc/device-tree/aliases/serial0
-r--r--r-- 1 root root 21 Aug 18 01:38 /proc/device-tree/aliases/serial1
-r--r--r-- 1 root root 21 Aug 18 01:31 /proc/device-tree/aliases/serial2
-r--r--r-- 1 root root 21 Aug 18 01:38 /proc/device-tree/aliases/serial3
root@stm32mp1-disco:~# cat /proc/device-tree/aliases/serial2
/soc/serial@40018000
Serial2 is correctly associated with UART7 (@4001800) but the status of @4001800 is "disabled"...am I missing something to enable the UART7?
What surprises me is the fact that there is somehow a serial3 although I haven't defined this alias in the corresponding .dts file.
I hope you might have an idea what is going wrong and I am looking forward to your answer.
Regards
2020-08-26 8:51 AM
Hello @PSchw.16
You can check for the dtb build result with the following command on the host PC, in the deploy image directory of the yocto build:
$ dtc -I dtb -O dts stm32mp157c-dk2.dtb
It will give you the dt values in human format.
You can then check for the status of the serial@40018000 node.
Following the result, it will be build issue, or dt apply issue at kernel boot.
Regards
2020-08-26 11:12 AM
Hello @JeanPhilippeR ,
after running your recommended command I was able to identify the error as a build issue.
I converted the .dtb file into a text file with "$ dtc -I dtb -O dts -o <filename> and set the status of the UART7 from "disabled" to "okay".
Afterwards I converted my text file back into a .dtb file with "$ dtc -I dtc -O dtb -o <filename>" and replaced the incorrect .dtb files on my board.
Now the serial interface ttySTM2 exists and can be configured.
Thank you so much for your support.
Best wishes
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.