Jump to content

Recommended Posts

Posted

Hi all..

 

I can't solve one issue with nanopiair h3. 

 

I was tried to set the speed of ttyS1 using

 

  stty -F /dev/ttyS1 230400 min 0 time 5 -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke -opost -onlcr

 

that works no err messages..but my data at port is like garbage... 

 

I see this err under dmesg 

 

 21 03:10:02 2017] sw_uart_check_baudset()429 - uart1, select set 1, baud 230400, uartclk 24000000 beyond rance[30000000, 120000000]

 

on the other hand when I check the status of uart 

 

root@FriendlyARM:/boot# cat /sys/class/tty/ttyS1/device/status 
uartclk = 24000000 
The Uart controller register[base: 0xf1c28400]: 
[RTX] 0x00 = 0x00000000, [iER] 0x04 = 0x00000000, [FCR] 0x08 = 0x00000000 
[LCR] 0x0c = 0x00000000, [MCR] 0x10 = 0x00000000, [LSR] 0x14 = 0x00000000 
[MSR] 0x18 = 0x00000000, [sCH] 0x1c = 0x00000000, [uSR] 0x7c = 0x00000000 
[TFL] 0x80 = 0x00000000, [RFL] 0x84 = 0x00000000, [HALT] 0xa4 = 0x00000000 
root@FriendlyARM:/boot# 
 
So..there's any way to change uarclk from   24000000 to 30000000? 
 
How can we solve the sw_uart_check_baudset()429 - uart1, select set 1, baud 230400, uartclk 24000000 beyond rance[30000000, 120000000] message?
 
Thanks a lot for your help
Posted

Thanks a lot for your help..

 

yes..it's a bummer I think it's not possible to change apb clock from 24Mhz to 48Mhz due to hardware limitations..or maybe I'm wrong.

 

In a common raspberry pi the uart clock is better I think..I was tried to change the speed and it works with no issues at 230400 baud rate. 

 

 

Thanks again

Posted

It is possible, but for that you have to hack the kernel a bit... If you also use I2C and don't do this clock change right, you can disrupt communication on it.

Posted

Sorry, no. I was never curious enough to try to change the parent clock and now I lost interest in 3.4 kernel. Maybe you can achieve something by changing drivers/clk/sunxi/clk-sun8iw7.c

Posted

Not sure. As I said already, I wanted just understand the procedure, not change it. I remember that there was already a discussion about this on linux-sunxi google group, but I don't remember the conclusion. On the other hand, clock drivers on mainline kernel still evolve. It might even work automatically with upcoming 4.13, but please don't rely on that.

Posted

I'm trying to use baud rate 460800bps on Orange Pi Zero.

Baud rate 115200bps is working well, but above baud rate has problems, data corrupted.

 

I found the reason that UART clock is not enough.

https://forum.armbian.com/index.php?/topic/3508-higher-uart-baud-rates-h3-nanopi-neo-air/

 

Default uart clock is 24MHz. So I want to increase the uart clock.

 

My OPI kernel version is v4.11.3.

 

Current clock source seems to come from ccu.

serial@01c28400 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x1c28400 0x400>;
                        interrupts = <0x0 0x1 0x4>;
                        reg-shift = <0x2>;
                        reg-io-width = <0x4>;
                        clocks = <0x2 0x3f>;
                        resets = <0x2 0x32>;
                        dmas = <0x12 0x7 0x12 0x7>;
                        dma-names = "rx", "tx";
                        status = "okay";
                        pinctrl-names = "default";
                        pinctrl-0 = <0x17>;
                        linux,phandle = <0x49>;
                        phandle = <0x49>;
                };

On clocks, 0x2 looks like phandle. I don't know what is clock specifier 0x3f. Is it just sequence number?

 

Now current clock source is like below.

clock@01c20000 {
                        reg = <0x1c20000 0x400>;
                        clocks = <0x3 0x5>;
                        clock-names = "hosc", "losc";
                        #clock-cells = <0x1>;
                        #reset-cells = <0x1>;
                        assigned-clocks = <0x2 0xd 0x2 0x65>;
                        assigned-clock-rates = <0x23c34600 0x11e1a300>;
                        compatible = "allwinner,sun8i-h3-ccu";
                        linux,phandle = <0x2>;
                        phandle = <0x2>;
                };



clocks {
                #address-cells = <0x1>;
                #size-cells = <0x1>;
                ranges;

                osc24M_clk {
                        #clock-cells = <0x0>;
                        compatible = "fixed-clock";
                        clock-frequency = <0x16e3600>;
                        clock-output-names = "osc24M";
                        linux,phandle = <0x3>;
                        phandle = <0x3>;
                };

                osc32k_clk {
                        #clock-cells = <0x0>;
                        compatible = "fixed-clock";
                        clock-frequency = <0x8000>;
                        clock-output-names = "osc32k";
                        linux,phandle = <0x5>;
                        phandle = <0x5>;
                };

I think I have to declare new clock under clocks node.

How can I declare apb2 or pll6 30MHz for uart?

 

Please help me.

Thank you very much.

Posted

I tried to make apb2 clock to 30MHz like below.

 

                apb2_clk {
                        compatible = "fixed-factor-clock";
                        #clock-cells = <0x0>;
                        clock-div = <0x8>;
                        clock-mult = <0xA>;
                        clocks = <0x3>;
                        clock-output-names = "apb2";
                        linux,phandle = <0x71>;
                        phandle = <0x71>;
                };

But it didn't work and OPI doesn't boot.

Posted

I tried another.

I declared new clock like below, and set serial clock to this.

                osc30M_clk {
                        #clock-cells = <0x0>;
                        compatible = "fixed-factor-clock";
                        clock-div = <0x8>; /* 24M/8 = 3M */
                        clock-mult = <0xa>; /* 3M * 10 = 30M */
                        clocks = <0x3>;
                        clock-output-names = "osc30M";
                        linux,phandle = <0x71>;
                        phandle = <0x71>;
                };

                serial@01c28400 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x1c28400 0x400>;
                        interrupts = <0x0 0x1 0x4>;
                        reg-shift = <0x2>;
                        reg-io-width = <0x4>;
                        clocks = <0x71>;//<0x2 0x3f>;
                        resets = <0x2 0x32>;
                        dmas = <0x12 0x7 0x12 0x7>;
                        dma-names = "rx", "tx";
                        status = "okay";
                        pinctrl-names = "default";
                        pinctrl-0 = <0x17>;
                        linux,phandle = <0x49>;
                        phandle = <0x49>;
                };

 

Now the command "cat /sys/class/tty/ttyS1/uartclk" says 30MHz. But UART does not work.

Could you give me any hint?

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines