Skip to content

High speed UART configuration not working? #105

Closed

Description

@Stonie

Hello,

I am trying to use configuration options in config.txt to enable high speed UART.
(as listed here: http://elinux.org/RPi_config.txt)

My /boot/config.txt

init_uart_baud=1000000
init_uart_clock=16000000

With these settings I am hoping to achieve 1Mbps Uart? but I cant seem to get this working?

Note I have disabled the serial console in boot.txt and /etc/inittab

Testing with stty, yields the following (is there a better way?)

root@raspberrypi:~# stty -F /dev/ttyAMA0 115200
root@raspberrypi:~# stty -F /dev/ttyAMA0 1000000
stty: /dev/ttyAMA0: unable to perform all requested operations

Am I missing something? Do I need to recompile the kernel?

System spec:

Base image is the current Raspbian (2012-08-16-wheezy-raspbian)

# uname -a
Linux raspberrypi 3.2.27+ #102 PREEMPT Sat Sep 1 01:00:50 BST 2012 armv6l GNU/Linux

root@raspberrypi:~# /opt/vc/bin/vcgencmd version
Aug 25 2012 01:12:00 
Copyright (c) 2012 Broadcom
version 333349 (release)

System fully upgraded today using apt-get update and dist-upgrade.

Thanks in advance.
Stonie.

Activity

  1. Stonie commented on Sep 6, 2012

    @Stonie
    Author

    I just noticed this closed issue: #78

    Given the above issue is "closed" what is the "init_uart_baud" setting for? ... "bug" or "feature"? ;)

  2. Stonie commented on Sep 6, 2012

    @Stonie
    Author

    Hi, I would really appreciate some advice... I am using a serial touch screen and 115200K is too slow... I don't really want end users to have to recompile the kernel for higher UART speeds...

    Please advise on what is the best course of action. (happy to do the work and provide a patch if that is what is needed?)

    Regards,
    Stonie.

  3. popcornmix commented on Sep 7, 2012

    @popcornmix
    Collaborator

    init_uart_baud just sets the baud rate through GPU before ARM code starts running. This is useful for bare metal/debug from very early on in linux. Once linux has booted then the UART will have been reconfigured and init_uart_baud will have been overwritten.

    Currently you have to change
    #define UART0_CLOCK 3000000
    (to match init_uart_clock=) in arch/arm/mach-bcm2708/include/mach/platform.h
    and rebuild kernel if you want a higher UART clock.

    As a hack you can just increase init_uart_clock without telling linux. That means if init_uart_clock=6000000, and linux thinks it is 3000000, and you ask linux for 115200, you will actually get 230400 baud.

    I did try reading the value from GPU (using mailbox interface), but the uart clock is given to kernel before the mailbox driver is initialised so it didn't prove simple.

  4. Stonie commented on Sep 9, 2012

    @Stonie
    Author

    Thanks for the update.

    I had spotted the value in platform.h but was hoping I had missed something, alas no.

    I should be able to get away with fudging it for now, but clearly this is not a good long term solution?
    How do you plan on implementing "init_uart_baud" from config?

    Cheers,
    Stonie.

  5. popcornmix commented on Sep 9, 2012

    @popcornmix
    Collaborator

    init_uart_baud is implemented from config.txt. if you have bare metal OS, or use Linux before it has initialised the uart itself, you can write to the UART and it will output at the expected baud rate.

  6. Stonie commented on Sep 9, 2012

    @Stonie
    Author

    Yeah I greped the entire source tree looking for the use of config.txt... this where I am confused...

    What code consumes/owns config.txt?

    Can config.txt's values be set in arch_decomp_setup(void) in arch/arm/mach-bcm2708/include/mach/uncompress.h ?

  7. popcornmix commented on Sep 9, 2012

    @popcornmix
    Collaborator
  8. Stonie commented on Sep 9, 2012

    @Stonie
    Author

    OK it is clear to me now that config.txt belongs to the GPU boot sequence...

    You mention above that "uart clock is given to kernel" if that’s the case why is it not "given" the value specified in config.txt? or is it? and then consequently overwritten by the value in platform.h?

  9. popcornmix commented on Sep 9, 2012

    @popcornmix
    Collaborator

    bcm2708_init tells the kernel what the UART clock rate is. This is before mailbox driver is initialised so I can't ask the GPU what the actual UART frequency is at this point.
    I need someone who knows the kernel init code better than me to say where this should be done.

  10. Stonie commented on Sep 9, 2012

    @Stonie
    Author

    Ok, thanks for the update.

  11. Stonie commented on Aug 22, 2013

    @Stonie
    Author

    @ghollingworth why is this marked as closed? I don't see a resolution? commit? or otherwise?

  12. ghollingworth commented on Aug 22, 2013

    @ghollingworth

    No problem if you're still working on it, just going through tidying up issues that are dead

  13. Stonie commented on Aug 22, 2013

    @Stonie
    Author

    "Dead" --> pardon? If it's not fixed it's not fixed. So why on earth would you close it without a resolution?

    ** I spent days digging this one out **

    I suspect that the stalling on the fix exists perhaps because GPU code is closed? and therefore not well understood?, Maybe It needs to wait till someone with the knowledge comes along... or Broardcom, actually embraces Open Source for the RPI and opens the GPU code... Or I could be completely wrong, either way its still an "Issue" until its fixed.

    So please don't sweep this one under the carpet just yet.

  14. 2 remaining items

  15. ghollingworth commented on Aug 22, 2013

    @ghollingworth

    Sorry pressed wrong button!!!

  16. mrshifo commented on Feb 24, 2014

    @mrshifo

    Please,
    i am a beginner with linux and rpi, can you help me step by step for set high speed baud rate ?

    mrshifo at libero.it

    uname -a
    Linux raspberry 3.6.11+ #538 PREEMPT Fri Aug 30 20:42:08 BST 2013 armv6l GNU/Linux

  17. Ruffio commented on Jul 28, 2016

    @Ruffio

    @Stonie has this issue been resolved? If yes, then please close this issue.

  18. Ruffio commented on Aug 29, 2016

    @Ruffio

    @popcornmix please consider closing this issue, as there haven't been any real activity since 2014 and I pinged for response a month ago...

  19. popcornmix commented on Aug 29, 2016

    @popcornmix
    Collaborator

    We have increased the UART clock source which allows higher baud rates. See:
    #1601
    raspberrypi/firmware#643

  20. added a commit that references this issue on Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions