WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [SOLVED] TC Max Serial Port Baudrate  (Read 30487 times)

Offline aj

  • Newbie
  • *
  • Posts: 34
Re: TC Max Serial Port Baudrate
« Reply #30 on: May 31, 2013, 11:35:02 AM »
Hi aj
I was able to compile the source. Make sure you have compiletc.tcz and linux-headers-3.0.21-tinycore.tcz installed.
Comment out or remove this line from the source:
Code: [Select]
#include <linux/config.h>Create a file called  Makefile  in the same directory as the source containing:
Code: [Select]
obj-m += w83627hf-fast-serial.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
Execute  make  from the command line and it should build.

Hi Rich,

I have installed compiletc.tcz but don't have linux-headers-3.0.21-tinycore.tcz.
I will install linux-headers-3.0.21-tinycore.tcz and compile the module.
I hope this works!!

Thanks very much for the support :)

Offline aj

  • Newbie
  • *
  • Posts: 34
Re: TC Max Serial Port Baudrate
« Reply #31 on: May 31, 2013, 11:58:16 AM »
Hi aj
I was able to compile the source. Make sure you have compiletc.tcz and linux-headers-3.0.21-tinycore.tcz installed.
Comment out or remove this line from the source:
Code: [Select]
#include <linux/config.h>Create a file called  Makefile  in the same directory as the source containing:
Code: [Select]
obj-m += w83627hf-fast-serial.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
Execute  make  from the command line and it should build.

Hi Rich,

You are The Man!!!!!
Now I can configure the max baud rate and it works at 921k.

Thanks very much for the support :)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11560
Re: TC Max Serial Port Baudrate
« Reply #32 on: May 31, 2013, 12:11:34 PM »
Hi aj
You are welcome, glad to hear it worked. Please go to your original post, click on  Modify, and add  [SOLVED] to the
subject line.

Offline aj

  • Newbie
  • *
  • Posts: 34
Re: [SOLVED] TC Max Serial Port Baudrate
« Reply #33 on: June 05, 2013, 11:49:12 AM »
Hi,

I have compiled the fast serial diver for W83627HF. Now I can set serial port ttyS0 at 921k and it works. When I try do the same for ttyS1 I can't obtain the same results.
I want to know if the driver just configure one serial port?

Thanks

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11560
Re: [SOLVED] TC Max Serial Port Baudrate
« Reply #34 on: June 05, 2013, 11:56:06 AM »
Hi aj
I see some code that seems to indicate it supports both UARTs. After you try to set ttyS1 execute:
Code: [Select]
dmesg | tailand see if the driver logged any messages.

Offline aj

  • Newbie
  • *
  • Posts: 34
Re: [SOLVED] TC Max Serial Port Baudrate
« Reply #35 on: June 05, 2013, 12:03:55 PM »
Hi aj
I see some code that seems to indicate it supports both UARTs. After you try to set ttyS1 execute:
Code: [Select]
dmesg | tailand see if the driver logged any messages.

Hi Rich

dmesg | tail :
------------------------------------------------------
UART 0 clock speed: 0x0
UART 0 clock speed: 0x2
Entering bdlab mode to change the UART speed
Baudrate divisor low register: 0x60
Baudrate divisor: 0x6000
Baudrate divisor low register: 0x1
Baudrate divisor: 0x100
Leaving bdlab mode
setserial sets custom speed on ttyS0. This is deprecated.
setserial sets custom speed on ttyS1. This is deprecated.
------------------------------------------------------

Thanks

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11560
Re: [SOLVED] TC Max Serial Port Baudrate
« Reply #36 on: June 05, 2013, 12:09:46 PM »
Hi aj
Can I ask you to try that again with:
Code: [Select]
dmesg | tail -n 20

Offline aj

  • Newbie
  • *
  • Posts: 34
Re: [SOLVED] TC Max Serial Port Baudrate
« Reply #37 on: June 05, 2013, 12:27:19 PM »
Hi aj
Can I ask you to try that again with:
Code: [Select]
dmesg | tail -n 20

Hi Rich,

-----------------------------------------------------------------------------------------------------
ACPI: resource (null) [io  0x0480-0x04bf] conflicts with ACPI region GPIO [io 0x480-0x4bf]
ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
lpc_sch: probe of 0000:00:1f.0 failed with error -16
ACPI: Deprecated procfs I/F for AC is loaded, please retry with CONFIG_ACPI_PROCFS_POWER cleared
ACPI: AC Adapter [ADP1] (on-line)
input: PC Speaker as /devices/platform/pcspkr/input/input3
Adding 126656k swap on /dev/zram0.  Priority:-1 extents:1 across:126656k SS
squashfs: version 4.0 (2009/01/31) Phillip Lougher
EXT4-fs (sda1): warning: maximal mount count reached, running e2fsck is recommended
EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
W83627HF fast serial port driver 0.1 loaded
Uart port address seems to be: 0x2f8
UART 0 clock speed: 0x0
UART 0 clock speed: 0x2
Entering bdlab mode to change the UART speed
Baudrate divisor low register: 0x60
Baudrate divisor: 0x6000
Baudrate divisor low register: 0x1
Baudrate divisor: 0x100
Leaving bdlab mode
setserial sets custom speed on ttyS1. This is deprecated.
-----------------------------------------------------------------------------------------------------

Thanks

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11560
Re: [SOLVED] TC Max Serial Port Baudrate
« Reply #38 on: June 06, 2013, 08:19:53 AM »
Hi aj
As a quick test, open the source file, go to the  w83627_set_serial  routine, and change:
Code: [Select]
w83627_set_uart_clock(WDT_CLOCK_2400000,0);
clock = w83627_get_uart_clock(WDT_UART0); /* UART 0 clock speed */
printk(KERN_INFO "UART 0 clock speed: 0x%x\n", clock);
To:
Code: [Select]
w83627_set_uart_clock(WDT_CLOCK_2400000,0);
clock = w83627_get_uart_clock(WDT_UART0); /* UART 0 clock speed */
printk(KERN_INFO "UART 0 clock speed: 0x%x\n", clock);
w83627_set_uart_clock(WDT_CLOCK_2400000,1);
Recompile the driver and see if ttyS1 can now be programmed to run at the higher speed.
Sorry for the delay. I'm still trying to get a grip on how this driver is supposed to work.

Offline aj

  • Newbie
  • *
  • Posts: 34
Re: [SOLVED] TC Max Serial Port Baudrate
« Reply #39 on: June 06, 2013, 04:53:11 PM »
Hi aj
As a quick test, open the source file, go to the  w83627_set_serial  routine, and change:
Code: [Select]
w83627_set_uart_clock(WDT_CLOCK_2400000,0);
clock = w83627_get_uart_clock(WDT_UART0); /* UART 0 clock speed */
printk(KERN_INFO "UART 0 clock speed: 0x%x\n", clock);
To:
Code: [Select]
w83627_set_uart_clock(WDT_CLOCK_2400000,0);
clock = w83627_get_uart_clock(WDT_UART0); /* UART 0 clock speed */
printk(KERN_INFO "UART 0 clock speed: 0x%x\n", clock);
w83627_set_uart_clock(WDT_CLOCK_2400000,1);
Recompile the driver and see if ttyS1 can now be programmed to run at the higher speed.
Sorry for the delay. I'm still trying to get a grip on how this driver is supposed to work.

Hi Rich,

I will try this alteration. You don't have to be sorry because you are helping me a lot :)
I contacted Tony Lindgren (driver's developer) and he suggested this:
-------------------------------------------------------------------------------
This is a bug:
/*
* Reads the UART clock source speed
*/
 static int w83627_get_uart_clock(int uartno)
{
...
return (clock & 0x2); // bug here – must 3 in order to mask 2 bits
}

same thing with set clock
maybe try fixing the above in the patch?
-----------------------------------------------------------------------------

Thanks for the support

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11560
Re: [SOLVED] TC Max Serial Port Baudrate
« Reply #40 on: June 06, 2013, 05:29:14 PM »
Hi aj
I spotted those bugs however the result of get clock is only used to print a kernel message and in set clock it is oring the
number 3 in so those two bits are set anyway. In fact, if you look at set clock you'll see the speed parameter is not even
used to set the speed, it's hard coded:
Code: [Select]
clock |= WDT_CLOCK_1476000;and WDT_CLOCK_1476000 is defined as 3.

Offline aj

  • Newbie
  • *
  • Posts: 34
Re: [SOLVED] TC Max Serial Port Baudrate
« Reply #41 on: June 06, 2013, 06:18:17 PM »
Hi aj
I spotted those bugs however the result of get clock is only used to print a kernel message and in set clock it is oring the
number 3 in so those two bits are set anyway. In fact, if you look at set clock you'll see the speed parameter is not even
used to set the speed, it's hard coded:
Code: [Select]
clock |= WDT_CLOCK_1476000;and WDT_CLOCK_1476000 is defined as 3.

Hi Rich,
What you are saying make sense and I will try your suggestion.
Thanks again for the support

Offline aj

  • Newbie
  • *
  • Posts: 34
Re: [SOLVED] TC Max Serial Port Baudrate
« Reply #42 on: June 08, 2013, 01:00:28 PM »
Hi aj
As a quick test, open the source file, go to the  w83627_set_serial  routine, and change:
Code: [Select]
w83627_set_uart_clock(WDT_CLOCK_2400000,0);
clock = w83627_get_uart_clock(WDT_UART0); /* UART 0 clock speed */
printk(KERN_INFO "UART 0 clock speed: 0x%x\n", clock);
To:
Code: [Select]
w83627_set_uart_clock(WDT_CLOCK_2400000,0);
clock = w83627_get_uart_clock(WDT_UART0); /* UART 0 clock speed */
printk(KERN_INFO "UART 0 clock speed: 0x%x\n", clock);
w83627_set_uart_clock(WDT_CLOCK_2400000,1);
Recompile the driver and see if ttyS1 can now be programmed to run at the higher speed.
Sorry for the delay. I'm still trying to get a grip on how this driver is supposed to work.

Hi Rich
I made the alteration that you suggested and it resulted. Now I can configure the second serial port.
I am grateful for your support

Thanks again :)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11560
Re: [SOLVED] TC Max Serial Port Baudrate
« Reply #43 on: June 08, 2013, 10:42:31 PM »
Hi aj
Good to hear. I figured that would kick up the speed of the second UART. For what it's worth, after loading, all this module
does is program a couple of registers. After that, it just sits in memory occupying space. After modprobing the module
you should be able to unload it again. At this point, both UARTs are running at 8x their normal speed. You could skip
using setserial and use stty to select 155200 and you will have 8 x 115200=921600. All the baud rates stty supports
will be 8x higher.


Offline aj

  • Newbie
  • *
  • Posts: 34
Re: [SOLVED] TC Max Serial Port Baudrate
« Reply #44 on: June 09, 2013, 04:00:38 PM »
Hi aj
Good to hear. I figured that would kick up the speed of the second UART. For what it's worth, after loading, all this module
does is program a couple of registers. After that, it just sits in memory occupying space. After modprobing the module
you should be able to unload it again. At this point, both UARTs are running at 8x their normal speed. You could skip
using setserial and use stty to select 155200 and you will have 8 x 115200=921600. All the baud rates stty supports
will be 8x higher.

Hi Rich,
I'm loading the module at OS startup.
Then I use setserial to configure the max baud rate but I appreciate your advice.

Thanks again :)