Skip to content

Serial Port - try to set speed to 230400, sets to 9600 #78

Closed

Description

@salsanci

Programming serial port, speeds of 57600, 115200 working ok, tried to set to 230400, found the actual serial port speed was 9600.

Verified issue by using minicom, exactly same results.

Activity

  1. popcornmix commented on Aug 20, 2012

    @popcornmix
    Collaborator

    I think this is just the limit of the clock frequency used and the dividers available.

    You can add a config.txt pararmeter
    init_uart_clock=6000000
    to double the UART clock (which will have side effect of doubling baud rate)
    You will need to rebuild kernel to make the baud rates have the correct values.

  2. florian-z commented on Jul 29, 2016

    @florian-z

    @popcornmix Where or What in the kernel do I have to change? I can recompiile the kernel, but I do not find the right place for my new init_uart_clock value.

    I suppose UART0_CLOCK in arch/arm/mach-bcm2709/include/mach/platform.h the right place?
    Use bcm2709 for RPi2 & RPi3. Use bcm2708 for other.

  3. popcornmix commented on Jul 30, 2016

    @popcornmix
    Collaborator

    Do you need the uart frequency to be changed during kernel boot, or after?
    What baud rate do you want?

  4. florian-z commented on Aug 1, 2016

    @florian-z

    I need it after kernel boot. I am currently checking if 1Mbaud is enough. Maybe 2Mbaud.
    It is working now with 1Mbaud (not yet tested with 2Mbaud).

    My procedure:

    • set init_uart_clock to 64MHz init_uart_clock=64000000 in config.txt
    • reboot and check, if the uart clock has changed to specified value. vcgencmd measure_clock uart
    • if not you may need to update pi firmware. Google rpi-update
    • set UART0_CLOCK in arch/arm/mach-bcm2709/include/mach/platform.h (use bcm2709 for RPi2 & RPi3. Use bcm2708 for other). Then recompile the kernel on the Pi using this howto https://www.raspberrypi.org/documentation/linux/kernel/building.md
      Takes roughly 3h on RPi2 with -j4 (use four threads)

    Did I forget to mention anything?

  5. popcornmix commented on Aug 1, 2016

    @popcornmix
    Collaborator

    If you want to use a standard baud rate then recompiling the kernel shouldn't be necessary.
    Some info here:
    http://raspberrypi.stackexchange.com/questions/1094/how-can-i-set-the-uart-speed

  6. florian-z commented on Aug 2, 2016

    @florian-z

    Excuse me, but I am not understanding what the discussion (your link) is good for? The discussion contains links that support my experience, i.e. say that kernel recompile is needed for BAUD > 230400.

    Different topic: I noticed that the mini-uart on RPi3 is capable of more than 230400 by default.

    I still think kernel recompiling is necessary to use high bautrates with /dev/ttyAMA0 on RPi2 (I started with ... from https://www.raspberrypi.org/downloads/raspbian/. But it would be awesome if you could show I am wrong.

    RASPBIAN JESSIE LITE
    Minimal image based on Debian Jessie
    Version:May 2016
    Release date:2016-05-27
    Kernel version:4.4
    
  7. popcornmix commented on Aug 2, 2016

    @popcornmix
    Collaborator

    Can you have a read of this: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=113753&start=125#p801441
    which may be a way of doing what you want without rebuilding kernel.

  8. florian-z commented on Aug 4, 2016

    @florian-z

    My problem is now fixed, without a custom kernel.
    I tried it again with a fresh SD Card (fresh raspbian minimal image from May 2016). This time I only needed to set init_uart_clock in config.txt. This is confusing me, since it did not work with the default kernel before. I have to admit, that the RPi2 used, had a fresh SD card with May 2016 image, but the Pi itself was in an unopened box from 2014 (thus with firmware from 2014).

    How can I check the version of the firmware & *.dtb ? Or should I just go for 'rpi-update' on every Pi, after the apt-get update & upgrade ? I am slightly confused right now.

    I need to setup a couple of RPi2 in the future and it bugs me, that I cannot clearly tell, which step made it possible so that I just have to add the 'init_uart_clock' attribute. Sadly I do not have another one here for testing it right now. I am ordering another one right now, to test it.

    Thank you for your GREAT support.

  9. JamesH65 commented on Aug 4, 2016

    @JamesH65
    Contributor

    Note that the Pi itself does not have 'firmware', it's all on the SD card.
    So getting one out of a old box is irrelevant, everything is on the SD
    card.

    On 4 August 2016 at 13:54, florian-z notifications@github.com wrote:

    My problem is now fixed, without a custom kernel.
    I tried it again with a fresh SD Card (fresh raspbian minimal image from
    May 2016). This time I only needed to set init_uart_clock in config.txt.
    This is confusing me, since it did not work with the default kernel before.
    I have to admit, that the RPi2 used, had a fresh SD card with May 2016
    image, but the Pi itself was in an unopened box from 2014 (thus with
    firmware from 2014).

    How can I check the version of the firmware & *.dtb ? Or should I just go
    for 'rpi-update' on every Pi, after the apt-get update & upgrade ?
    How are those *.dtb files updated, that are mentioned in your last link?

    I need to setup a couple of RPi2 in the future and it bugs me, that I
    cannot clearly tell, which step
    made it possible so that I just have to
    add the 'init_uart_clock' attribute. Sadly I do not have another one here
    for testing it right now. I am ordering another one right now, to test it.

    —
    You are receiving this because you are subscribed to this thread.
    Reply to this email directly, view it on GitHub
    #78 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe-auth/ADqrHXkeg6wTl3oZL-YiPM3ZacYOXvzbks5qceD-gaJpZM4AGiWd
    .

  10. 12 remaining items

  11. 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