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

about kernel location #9

Open
kikiyami opened this issue Oct 30, 2020 · 7 comments
Open

about kernel location #9

kikiyami opened this issue Oct 30, 2020 · 7 comments

Comments

@kikiyami
Copy link

Hi,
Would someone tell me where's location of kernel source
I try to write a sample code to send data pass through RS232
but seems the board doesn't work
Then I check the servel imx6sl.dtsi files. It seems the uart3 disable by default.
If I want to enable UART3 which file of location I can edit?
P.S. ls /dev folder shows the ttymxc0~ttymxc2 is exist.

@ray-chang
Copy link
Contributor

Hello, @kikiyami

The kernel source location in the yocto environment:
tmp/work-shared/<MACHINE>/kernel-source
"MACHINE" is the target of build. It usually corresponds to the name of SOM or SBC.

The UART3 is the name of the hardware, and the corresponding name of the software should be ttymxc2.
The UART3(ttymxc2) is enabled according to your description.

BR,

Ray

@kikiyami
Copy link
Author

kikiyami commented Nov 3, 2020

Hi Ray,
you means edit tmp/work-shared//kernel-source/arch/arm/boot/dts/imx6sl.dtsi
and execute bitbake fsl-image-qt5-validation-imx again?

@ray-chang
Copy link
Contributor

Hi @kikiyami

You must first use the demo image to confirm the device tree that your board uses.
Go to the u-boot and check "fdt_file" or "fdtfile" environment variable. If your board has to use uEnv.txt also needs to be checked. Or viewed by the boot log.
Getting the corresponding file name is the device tree you want.

You can refer to the section of our official website device tree:
https://www.technexion.com/support/knowledgebase/technexion-bsp-guide-for-kernel-4-1-15/#post-1550-__RefHeading___Toc22214_686501162

Modifying the kernel can use "devtool" on yocto.
The compiled kernel can use the following command:
bitbake -fc compile linux-tn-imx

For more operational details. please refer to the yocto manual.

@kikiyami
Copy link
Author

kikiyami commented Nov 6, 2020

I bought this product.
https://www.wandboard.org/products/wandboard/WB-IMX6S-BW/

And Try to modified kernel.
the dmesg shows ttystatus as below,
[ 0.000000] Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk2p2 rootwait rw video=mxcfb0:dev=hdmi,1280x720M@60,if=RGB24 fbmem=28M
[ 0.586660] 2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 28, base_baud = 5000000) is a IMX
[ 1.326246] console [ttymxc0] enabled
[ 1.327265] 21e8000.serial: ttymxc1 at MMIO 0x21e8000 (irq = 76, base_baud = 5000000) is a IMX
[ 1.327897] 21ec000.serial: ttymxc2 at MMIO 0x21ec000 (irq = 77, base_baud = 5000000) is a IMX

I'm not soure enable ttymxc2 sucessful.

@richard-hu
Copy link
Contributor

richard-hu commented Nov 10, 2020

@kikiyami

I check the HW schematic. UART3(ttymxc2) is occupied by Bluetooth.
There is no additional UART available on the wandboard baseboard.

One way is to disable debug console(UART1) and use it as RS232, another way is to buy EDM-Fairy baseboard.
https://shop.technexion.com/system-on-modules/edm/edm-evk/edm1-fairy-imx6dl-system.html

Wandboard kernel is maintained by linux mainline upstream now.
According to @ray-chang 's suggestion:

Modifying the kernel can use "devtool" on yocto.
The compiled kernel can use the following command:
(change the bitbake target as linux-wandboard)
bitbake linux-wandboard -c compile -f

BR,

Richard

@kikiyami
Copy link
Author

kikiyami commented Dec 5, 2020

@richard-hu
I guess I can disable debug mode by boot loader but where I can setup UART1 to RS232?

Thank you

@richard-hu
Copy link
Contributor

@kikiyami

I guess I can disable debug mode by boot loader

u-boot provides a way to disable console.
Please refer to u-boot document README.silent.

The concept is to disable console in bootloader(SPL and u-boot) and set console device as null in kernel.
(This is automatically done by U-Boot when silent mode is required (see CONFIG_SILENT_CONSOLE and CONFIG_SILENT_U_BOOT_ONLY): silent=1 in used U-Boot environment. )
We have disabled console on other i.mx6 platform, maybe it's helpful for you:
TechNexion/u-boot-edm@4dda78f

where I can setup UART1 to RS232

I check the device tree for wandboard.
UART1 already configured properly.

arch/arm/boot/dts/imx6qdl-wandboard.dtsi
`
pinctrl_uart1: uart1grp {
fsl,pins = <
MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA 0x1b0b1
MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA 0x1b0b1
>;
};

&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart1>;
status = "okay";
};
`
The difference between UART and RS232 is the voltage level.
https://electronics.stackexchange.com/questions/274287/what-is-the-difference-between-rs-232-and-ttl-uart

There is a RS232 transceiver chip - ADM3202ARUZ on wandboard baseboard.
This chip would converts TTL signal to RS232 signal level.
In software's point of view, there is no difference for TTL or RS232 signal.

One thing you should care about is to check if the /dev/ttymxc0(uart1) is occupied by system service.
For example:
If you use Yocto with systemD, there is a console service called [email protected].
You can stop it as follows:
# systemctl disable [email protected]

If you use Yocto with systemV, debug console port is assign in /etc/init.d/rc_mxc.S
`
#!/bin/bash

if grep -sq ttymxc0 /proc/cmdline; then
/sbin/getty -L ttymxc0 115200 vt100
elif grep -sq ttymxc1 /proc/cmdline; then
/sbin/getty -L ttymxc1 115200 vt100
elif grep -sq ttymxc2 /proc/cmdline; then
/sbin/getty -L ttymxc2 115200 vt100
elif grep -sq ttymxc3 /proc/cmdline; then
/sbin/getty -L ttymxc3 115200 vt100
elif grep -sq ttyUSB0 /proc/cmdline; then
/sbin/getty -L ttyUSB0 115200 vt100
else
sleep 100000
fi
`

BR,

Richard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants