0

I would like to increase UART speed. So, I followed this page. http://www.thedevilonholiday.co.uk/raspberry-pi-increase-uart-speed/

I added init_uart_clock=64000000 and rebooted pi. But, still I got error message when I tried to change UART baud rate more than 115200 baud.

stty: /dev/ttyAMA0: unable to perform all requested operations

Further, on this page https://github.com/raspberrypi/linux/issues/105, popcornmix commented on Sep 7, 2012 that kernel has to be rebuilt for higher UART clock.

Could somebody please explain if higher UART clock is not easily attainable in PI 2?

  • Perhaps 64 million is too high. I tried with 32 million and could set a baud of 2 million. It seemed to be transmitting at that rate (123 characters in 638 µs). This was on a B+. – joan Sep 9 '15 at 15:06
4

It works on a B+.

I added the following line to /boot/config.txt and rebooted.

init_uart_clock=64000000

I set the baud rate to (the maximum) 4000000 with

stty -F /dev/ttyAMA0 4000000

I then sent 262 "A"s to the port with

echo "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" >/dev/ttyAMA0

The measured transmission time varied between 640 to 680 µs.


EDITED TO ADD

I used my piscope to capture the start and end of the waveform. It won't capture any detail at those rates (default 5 µs sampling) but the overall edges are found reliably enough.

I repeated the above by sending 1000 "A"s. That is 10000 bits at the default 8N1. That should take 10000/4000000 seconds, or 2500 µs.

Overview of three busrst

Overview of three transmission bursts.

Detail of one burst

Detail of one burst showing a time between gold and blue cursors of 2640 µs (rather than the predicted 2500 µs).

  • Could you explain how you measured the transmission time? I am eager to know that. – Main Sep 10 '15 at 9:05
  • @Main I edited the post to add some detail. – joan Sep 10 '15 at 10:11
0

Did you enable the uart in the boot config file?

Step1:

        sudo nano /boot/config.txt

Step2: at these lines at the end of the file

        enable_uart=1            
        init_uart_clcok=64000000

Step3: (reboot to make the changes apply)

        sudo reboot 

Step4: check by setting the baud rate to 1500000

       sudo stty -F /dev/ttyAMA0 1500000

if it does not give an error, you are good to goo. Hope anyone find this helpful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.