montana
Posts: 4
Joined: Tue Sep 24, 2019 9:30 pm

What is fix for RPI 4 uart?

Tue Sep 24, 2019 9:33 pm

So, i've read topic https://www.raspberrypi.org/forums/view ... p?t=244991

And i believe "rpi-update" works. But we use custom kernels with custom dtb files. And after recompiling latest 4.19 kernel - uart does not work with the same symptoms.

Can anyone provide what exactly was fixed in dtb or in kernel source so i can apply this patch?

thanks

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2589
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: What is fix for RPI 4 uart?

Wed Sep 25, 2019 10:30 am

Apart from the interrupt specifier, there is no difference between the Device Tree UART0&1 declarations for Pi3 and Pi4. With current firmware the two should behave the same.

What is in your config.txt?

montana
Posts: 4
Joined: Tue Sep 24, 2019 9:30 pm

Re: What is fix for RPI 4 uart?

Wed Sep 25, 2019 3:43 pm

Code: Select all

dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
enable_uart=1
i am not actually sure how config.txt affects changes applied by rpi-update. Because after rpi-update serial port works as expected. When i copy my own kernel and dtb files to device - i have this bug with speed again.

"My own" - i mean built with original rpi sources without any modifications.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2589
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: What is fix for RPI 4 uart?

Wed Sep 25, 2019 3:55 pm

I wanted to see if your config.txt changed the clocks in any way, but it appears not to.

My guess would be that there's a difference in the clock driver that means it's using a maximum frequency rather than a minimum frequency (or vice versa).

Try this sequence of commands, reporting the output of the "vcgencmd"s and "sudo cat"s:

Code: Select all

$ vcgencmd measure_clock core
$ sudo cat /sys/kernel/debug/clk/vpu/clk_rate
$ while true; do true; done &
$ vcgencmd measure_clock core
$ sudo cat /sys/kernel/debug/clk/vpu/clk_rate
$ kill $!

montana
Posts: 4
Joined: Tue Sep 24, 2019 9:30 pm

Re: What is fix for RPI 4 uart?

Wed Sep 25, 2019 5:31 pm

Code: Select all

[email protected]:/home/pi# vcgencmd measure_clock core
frequency(1)=500000992
[email protected]:/home/pi# cat /sys/kernel/debug/clk/vpu/clk_rate
500000000
[email protected]:/home/pi# while true; do true; done &
[1] 2485
[email protected]:/home/pi# vcgencmd measure_clock core
frequency(1)=500000992
[email protected]:/home/pi# cat /sys/kernel/debug/clk/vpu/clk_rate
500000000
[email protected]:/home/pi# kill $!
i don't actually understand what i've just done, but if it helps i'll really appreciate you

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2589
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: What is fix for RPI 4 uart?

Wed Sep 25, 2019 8:07 pm

What you've done is confirmed that core clock (from which UART1/ttyS0 derives its clock) and the kernel's idea of the core clock always agree, which was one of the possible causes of baud rate errors. Having said that, are we sure that an incorrect baud rate is the cause of your trouble? Have you tried looping TX to RX to confirm that data is getting through at all?

montana
Posts: 4
Joined: Tue Sep 24, 2019 9:30 pm

Re: What is fix for RPI 4 uart?

Thu Sep 26, 2019 7:03 pm

i can see data if i double baudrate of serial port. That is a fix proposed in topic i mentioned in my question. But i can't use this "fix" for many reasons.
Also, "rpi-update" fixes this issue. But it replaces kernel and dtb files. And git repo does not contain fixed sources. So i can't build my own kernel with this fix present.

So, obviously, rpi team fixed something and didn't push it to repo. So i'm trying to figure out what exactly was fixed and/or when this fix will be published.

RaspberryShake
Posts: 3
Joined: Tue Jun 28, 2016 3:43 pm

Re: What is fix for RPI 4 uart?

Mon Feb 10, 2020 10:05 pm

Hi @PhilE - all of us at Raspberry Shake send our regards! We are quite eager to start supporting RPi4 for the Raspberry Shake but we are finding this is a blocker.

Thank you for your time and we look forward to continuing to support all RPi products.


Yours,

Branden Christensen
CEO, Raspberry Shake

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2589
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: What is fix for RPI 4 uart?

Mon Feb 10, 2020 10:11 pm

Please state clearly what you are doing, using which software, and what results you are seeing.

RaspberryShake
Posts: 3
Joined: Tue Jun 28, 2016 3:43 pm

Re: What is fix for RPI 4 uart wrong baud rate?

Mon Feb 10, 2020 10:31 pm

hi phil,

the history is this post:
https://www.raspberrypi.org/forums/view ... p?t=244991

where the initial release of the 4 had a bug with the baud rate of the UART, where a subsequent OS update corrected the error.

except that we need to compile the OS from source. and until now, the fix (that is available as a binary update to the OS) has not been pushed to the OS repo (that we are aware of). without the fix pushed to the actual source, we are unable to pull the source to make our own tweaks for our Shake purposes.

so the question is if someone there knows when the fix will be pushed to the source repo, if this hasn't actually happened yet.

thanks,

richard
software lead
raspberry shake

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2589
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: What is fix for RPI 4 uart?

Tue Feb 11, 2020 9:19 am

Apart from the firmware, all software is open source and public. Which software are you referring to?

I repeat:
Please state clearly what you are doing, using which software, and what results you are seeing.

Return to “Device Tree”