Dmitriy Posted October 6, 2016 Posted October 6, 2016 Hello to all! I have banana pi m2+ with Allwinner H3. OS: ARMBIAN Debian GNU/Linux 8 (jessie) 3.4.112-sun8i I program linux kernel driver. And I am can't run R_UART. I write to register any value, and read value alway zero. It seems that APB0 bus is not cloked. Or device R_UART reset asserted. What I do wrong? Sincerely, Dmitriy.
jernej Posted October 6, 2016 Posted October 6, 2016 What are you trying to do? R_UART is only meant to be used by ARISC coprocessor. You can first enable R_UART in script.bin, then connect it to PC and while booting or suspend/resume procedure you can observe output from ARISC. It will be mostly about current RAM settings, etc. Basically, it is just for debugging.
Dmitriy Posted October 6, 2016 Author Posted October 6, 2016 R_UART is only meant to be used by ARISC coprocessor. Basically, it is just for debugging. Why do you think so? R_UART connected to pins PL2 and PL 3. It has address 0X01F0 2800 and interrupt vector. And from datasheet: There are 5 UART controllers. All UART controllers can be configured as Serial IrDA. UART0, UART1, UART2, UART3,R_UART? Where do you find this information?
jernej Posted October 6, 2016 Posted October 6, 2016 Well, for one, I already connected R_UART port for debugging sleep/resume and I received output. Secondly, all things in script.bin which starts with "s_" are meant for ARISC. Check those comments here: https://github.com/igorpecovnik/lib/blob/master/config/fex/bananapim2plus.fex#L1187Why they are here named "s_" instead of "r_" I don't know, but if you check pins, it's the same. Third, I checked kernel source code, s_uart is referenced in arisc.c as ARISC resource: https://github.com/igorpecovnik/linux/blob/sun8i/drivers/arisc/arisc.c#L483 And while it is true that s_uart port is referenced in sunxi-uart.c: https://github.com/igorpecovnik/linux/blob/sun8i/drivers/tty/serial/sunxi-uart.c#L787 It is dependent on SUNXI_S_UART macro, which is defined here: https://github.com/igorpecovnik/linux/blob/sun8i/drivers/tty/serial/sunxi-uart.h#L202 but only for sun8iw5 platform. H3 is sun8iw7. Hope this answers all your questions.
Dmitriy Posted October 7, 2016 Author Posted October 7, 2016 Thank you for detailed answer. Do I right understand, what in banana pi m2+ not possible to use R_UART for general purposes such as UART1-UART3? Maybe is possible change some config for it? Or any other solution?
jernej Posted October 7, 2016 Posted October 7, 2016 Currently it is not possible to use it on any H3 board with BSP kernel or mainline (vanilla). Maybe it would work if you modify kernel, but AFAIK noone has done this. Why do you need exactly this port so badly? Aren't others enough?
Dmitriy Posted October 7, 2016 Author Posted October 7, 2016 Yes, I need for 4 UARTs in my development. The one UART using for BT. Thereby, I need for this R_UART.
jernej Posted October 7, 2016 Posted October 7, 2016 Well, it will be hard as you are on your own. I would consider either using USB to UART or cutting BT uart traces and soldering wires to it.
Dmitriy Posted October 7, 2016 Author Posted October 7, 2016 BT I need also in my development.Using of external USB to UART bridge is impossible due to other reasons.
jernej Posted October 7, 2016 Posted October 7, 2016 Then AFAIK the only option you have is to modify the kernel to support R_UART as a serial port.
martinayotte Posted October 7, 2016 Posted October 7, 2016 You can use some I2C to UART chips such SC16IS740 (or dual UARTs SC16IS752), but Linux kernel drivers are not aware of them, you would need to deal with your own self-written driver. EDIT : I was wrong, Linux Kernel has a driver with SERIAL_SC16IS7XX_I2C kernel config.
Dmitriy Posted October 10, 2016 Author Posted October 10, 2016 martinayotte, thank you for advice. jernej I have resolved my problem. I chenged [s_uart0]s_uart_used = 0s_uart_tx = port:PL02<2><default><default><default>s_uart_rx = port:PL03<2><default><default><default> to s_uart_used =1 and re-compile kernel. After it, the registers R_UART write correct. And I am using R_UART as general UART. Thank you for hint.
Recommended Posts