User avatar
Gavinmc42
Posts: 3742
Joined: Wed Aug 28, 2013 3:31 am

Re: Raspberry Pi 4

Fri Jun 28, 2019 6:24 am

The Pi4 A72's are about 3 times more powerful than the Pi3 A53?
It does not feel 3 times hotter, but it is more uncomfortable to stick your finger on it.

If you were doing serious number crunching on it for along time and did not live in the Arctic then a small heatsink would help.
As I want to use mine as a Desktop compiler box, fan and heatsink will be added.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

LdB
Posts: 1239
Joined: Wed Dec 07, 2016 2:29 pm

Re: Raspberry Pi 4

Fri Jun 28, 2019 6:41 am

It's only a problem if it starts throttling the CPU's or it takes the skin off your finger :-)

pik33
Posts: 182
Joined: Thu Sep 10, 2015 4:26 pm

Re: Raspberry Pi 4

Fri Jun 28, 2019 6:47 am

lpoulain wrote:
Fri Jun 28, 2019 2:25 am
I heard that the Pi 4 generates much more heat than the Pi 3. I am curious to hear what people who have used both are saying.
I use the same case with a small fan for RPi3 and RPi4. In normal using (Raspbian, Chromium) the RPi4 is hotter when idle (RPi3 ~45C, RPi4 ~52C and cooler when "normally" (browsing, editing, movie replaying) used (RPi3 up to 70C, RPi4 up to 62C)

User avatar
Gavinmc42
Posts: 3742
Joined: Wed Aug 28, 2013 3:31 am

Re: Raspberry Pi 4

Fri Jun 28, 2019 7:31 am

So probably the Pi4 will be cooler as the Pi3 has to work harder doing that browser stuff?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

jahboater
Posts: 4688
Joined: Wed Feb 04, 2015 6:38 pm

Re: Raspberry Pi 4

Fri Jun 28, 2019 8:47 am

lpoulain wrote:
Fri Jun 28, 2019 2:25 am
I heard that the Pi 4 generates much more heat than the Pi 3. I am curious to hear what people who have used both are saying.
As explained in another thread, it has ethernet and other things included in the SoC which makes it run hotter despite being 28nm instead of 40nm.

The Pi4 does idle at a high temp 45-50C in my case. It starts throttling at 80C. My experience is that heavy workloads get the temp into the 70's but will not cause it to throttle. A NEON based stress test will make it throttle after a few minutes, but that's totally artificial. That is out of a case in free air. Inside a small case with no ventilation it appears from reports here to run very hot even at idle (I have no intention of trying that).

IMHO the Pi4 is actually more stable temperature wise than the Pi3 was, even the Pi3B+.

jahboater
Posts: 4688
Joined: Wed Feb 04, 2015 6:38 pm

Re: Raspberry Pi 4

Fri Jun 28, 2019 8:49 am

pik33 wrote:
Fri Jun 28, 2019 6:47 am
I use the same case with a small fan for RPi3 and RPi4. In normal using (Raspbian, Chromium) the RPi4 is hotter when idle (RPi3 ~45C, RPi4 ~52C and cooler when "normally" (browsing, editing, movie replaying) used (RPi3 up to 70C, RPi4 up to 62C)
That agrees with my observations.
It may be that the Pi4 can complete tasks in half the time so things don't get so hot.

Tunppi
Posts: 20
Joined: Mon Feb 24, 2014 2:08 pm

Re: Raspberry Pi 4

Fri Jun 28, 2019 1:06 pm

Hello, can you use the Raspberry Pi official 7" screen on Raspberry Pi 4?
or do you need new drivers? and such?
thank you.

Tunppi

lpoulain
Posts: 24
Joined: Mon May 20, 2019 12:35 am

Re: Raspberry Pi 4

Fri Jun 28, 2019 1:20 pm

Gavinmc42 wrote:
Fri Jun 28, 2019 7:31 am
So probably the Pi4 will be cooler as the Pi3 has to work harder doing that browser stuff?
Actually it's the other way around. The reason why the Cortex A72 (used in the RPi 4) is more performant than the Cortex A53 (used in the RPi 3) is because it is using out-of-order processing and branch prediction. These help alleviate the fact that modern processors can easily spend most of their cycles waiting for data from RAM. As a result, the A72 both gets more done on average than the A53 and uses more transistors trying to optimize the processing of the instructions - which means higher power consumption.

Both boards are doing the exact same work when "doing that browser stuff". Except the RPi 4 does it faster so "sweats" more.

jahboater
Posts: 4688
Joined: Wed Feb 04, 2015 6:38 pm

Re: Raspberry Pi 4

Fri Jun 28, 2019 5:24 pm

lpoulain wrote:
Fri Jun 28, 2019 1:20 pm
Both boards are doing the exact same work when "doing that browser stuff". Except the RPi 4 does it faster so "sweats" more.
But the Pi4 gets it done in less time?

lpoulain
Posts: 24
Joined: Mon May 20, 2019 12:35 am

Re: Raspberry Pi 4

Fri Jun 28, 2019 5:28 pm

jahboater wrote:
Fri Jun 28, 2019 5:24 pm
But the Pi4 gets it done in less time?
Correct, because it's working more intelligently and thus not waiting as much for data from RAM.

Think of two cooks in a kitchen following the exact same recipe:
  • Cook #1 follows the recipe by the letter. If the recipe says to cook something in the oven for 30 minutes, he waits until the cooking is done before proceeding further. This is pretty much what the Cortex A53 (RPi 3) is doing
  • Cook #2 is trying to parallelize things in order to minimize downtime. Instead of preparing the ingredients, he first focuses on the steps to start the cooking in the oven as early as possible, and then performs the other steps once the meal is in the oven (like preparing the sauce). This is what the Cortex A72 (RPi 4) is doing.
Cook #2 will be done first, but will also have spent the most energy because 1) he/she had much less rest than cook #1 and 2) had to do a lot of thinking to optimize steps and keep track of how the various tasks.

User avatar
Cacodemon
Posts: 21
Joined: Mon Jul 09, 2018 4:32 pm

Re: Raspberry Pi 4

Fri Jun 28, 2019 6:33 pm

Hmmm... I wonder if you can use old Pi Power HAT with the Pi4 and how much difference using it would make compared to heatsinks? Has anyone tried yet how much you can "stress" the new Pi4 before its performance drops or it starts getting overheated?

jahboater
Posts: 4688
Joined: Wed Feb 04, 2015 6:38 pm

Re: Raspberry Pi 4

Fri Jun 28, 2019 6:47 pm

lpoulain wrote:
Fri Jun 28, 2019 5:28 pm
Cook #2 will be done first, but will also have spent the most energy because 1) he/she had much less rest than cook #1 and 2) had to do a lot of thinking to optimize steps and keep track of how the various tasks.
That's a great description of OOO CPU operation.
What I meant was more simple. If CPU X produces 5 watts of heat and runs a task in 10 minutes (say) and CPU Y produces 10 watts of heat and runs the same task in 5 minutes. Same heat output in joules.
I guess thermal inertia will affect the real rise in temps for the different CPUs (important for the 3B+ and the Pi4).
Just waffling, sorry ....

lpoulain
Posts: 24
Joined: Mon May 20, 2019 12:35 am

Re: Raspberry Pi 4

Fri Jun 28, 2019 7:02 pm

jahboater wrote:
Fri Jun 28, 2019 6:47 pm
That's a great description of OOO CPU operation.
What I meant was more simple. If CPU X produces 5 watts of heat and runs a task in 10 minutes (say) and CPU Y produces 10 watts of heat and runs the same task in 5 minutes. Same heat output in joules.
I guess thermal inertia will affect the real rise in temps for the different CPUs (important for the 3B+ and the Pi4).
Just waffling, sorry ....
Nothing to be sorry about.

I would expect CPU Y to generate more heat overall considering that the out-of-order execution and branch prediction do consume extra energy. In your example it would generate, say, 12 watts for 5 minutes.

User avatar
Gavinmc42
Posts: 3742
Joined: Wed Aug 28, 2013 3:31 am

Re: Raspberry Pi 4

Sun Jul 14, 2019 6:12 am

Is it the VC6 booting first on the Pi4?
Does the Boot EEPROM use ARM or VC6 code?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

timg236
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 198
Joined: Thu Jun 21, 2018 4:30 pm

Re: Raspberry Pi 4

Sun Jul 14, 2019 11:06 am

Gavinmc42 wrote:
Sun Jul 14, 2019 6:12 am
Is it the VC6 booting first on the Pi4?
Does the Boot EEPROM use ARM or VC6 code?
The VPU is the boot processor on Pi4. The ROM runs recovery.bin from the sd-card, if it exists for EEPROM repair, otherwise, it loads the EEPROM image.

The ARM is initialised by start.elf and you can supply your own ARM stubs etc, for hand-crafted VPU code you just need to create this as a start.elf / start4.elf instead of bootcode.bin. The SDRAM and PLLs will be initialised to something sensible, although the exact frequencies may change. I recommend using the same load-address as start.elf.

N.B. There's no guarantee that the EEPROM will remain the same size on future board revisions (it could get smaller) and the bootloader will likely grow to fill the available space as additional bootmodes are added etc. Although, there's some ideas to allow user modifiable general purpose settings in embedded settings text file.

petzval
Posts: 11
Joined: Sat Aug 10, 2013 12:15 pm

Re: Raspberry Pi 4

Sun Jul 14, 2019 11:14 am

The GIC distributor registers, apparently at 0x40041000, are available via mmap at 0xFF841000. The code in the 12th July post of the following thread uses the GICD_CTLR register bit 0 to disable all interrupts.

https://www.raspberrypi.org/forums/view ... 29&t=52393

sean.lawless
Posts: 6
Joined: Thu Jun 06, 2019 6:07 pm

Re: Raspberry Pi 4

Wed Jul 17, 2019 11:26 pm

For boot kernel execution, the RPi 4 will execute the new file kernel7l.img (lpae is enabled on RPi 4). If this file is not present on the boot partition Raspbian will not boot. For bare metal compiling with arm-none-eabi-gcc compiler, a kernel7.img file is not compatible; the Raspbian kernel7.img is likewise incompatible. Can RPi 4 be forced to execute kernel7.img with config or cmdline options? Or does anyone know what needs to change during an arm-none-eabi build (gcc and or ld options?) to create an lpae enabled binary kernel7l.img file?

rst
Posts: 409
Joined: Sat Apr 20, 2013 6:42 pm
Location: Germany

Re: Raspberry Pi 4

Thu Jul 18, 2019 5:31 am

sean.lawless wrote:
Wed Jul 17, 2019 11:26 pm
For boot kernel execution, the RPi 4 will execute the new file kernel7l.img (lpae is enabled on RPi 4). If this file is not present on the boot partition Raspbian will not boot. For bare metal compiling with arm-none-eabi-gcc compiler, a kernel7.img file is not compatible; the Raspbian kernel7.img is likewise incompatible. Can RPi 4 be forced to execute kernel7.img with config or cmdline options? Or does anyone know what needs to change during an arm-none-eabi build (gcc and or ld options?) to create an lpae enabled binary kernel7l.img file?
The kernel7l.img file does not really need to be LPAE enabled for bare-metal operation. You can take a normal non-LPAE-kernel image and rename it to kernel7l.img. LPAE only means, that the kernel can access memory locations above the 32-bit 4GB boundary. On the RPi 4 this is only needed for accessing the USB xHCI device. LPAE is a MMU thing and cannot be enabled in the compiler/linker.

sean.lawless
Posts: 6
Joined: Thu Jun 06, 2019 6:07 pm

Re: Raspberry Pi 4

Fri Jul 19, 2019 7:20 am

rst wrote:
Thu Jul 18, 2019 5:31 am
The kernel7l.img file does not really need to be LPAE enabled for bare-metal operation. You can take a normal non-LPAE-kernel image and rename it to kernel7l.img. LPAE only means, that the kernel can access memory locations above the 32-bit 4GB boundary. On the RPi 4 this is only needed for accessing the USB xHCI device. LPAE is a MMU thing and cannot be enabled in the compiler/linker.
Thanks for the clarity. Do you know if LPAE/MMU is required for xHCI, or needed for performance? Is activity LED still at GPIO 29 (as with RPi 3 B+)? Has anyone been able to verify if 0x7E000000 is a valid peripheral base (without first enabling MMU)?

rst
Posts: 409
Joined: Sat Apr 20, 2013 6:42 pm
Location: Germany

Re: Raspberry Pi 4

Fri Jul 19, 2019 8:12 am

sean.lawless wrote:
Fri Jul 19, 2019 7:20 am
Thanks for the clarity. Do you know if LPAE/MMU is required for xHCI, or needed for performance? Is activity LED still at GPIO 29 (as with RPi 3 B+)? Has anyone been able to verify if 0x7E000000 is a valid peripheral base (without first enabling MMU)?
You are welcome. LPAE/MMU is needed for xHCI in any case in AArch32, because access to 0x600000000 (above 4 GB boundary) is needed. The Act LED is at GPIO42 on RPi 4. The base address of most peripherals, known from the BCM2835, is at 0xFE000000 on ARM side now.

sean.lawless
Posts: 6
Joined: Thu Jun 06, 2019 6:07 pm

Re: Raspberry Pi 4

Fri Jul 19, 2019 10:12 pm

rst wrote:
Fri Jul 19, 2019 8:12 am
You are welcome. LPAE/MMU is needed for xHCI in any case in AArch32, because access to 0x600000000 (above 4 GB boundary) is needed. The Act LED is at GPIO42 on RPi 4. The base address of most peripherals, known from the BCM2835, is at 0xFE000000 on ARM side now.
Thanks again, this is excellent information. I have much of my bare metal applications now working for the RPi4 with the above information. LED, UART, and video screen. I had to add 'enable_uart=1' to the config.txt on the boot folder to get UART0 (ie. /dev/serial0) to work, similar to RPi 3B+. Also similar to the RPi 3B+, the UART0 clock is 48 MHz so the baud divisor needs to reflect this. Remaining issues are USB and JTAG. For JTAG, even with 'enable_jtag_gpio=1' in config.txt the JTAG chain interrogation is all 1's (GPIOs 22-26 configured for Alt 4, ie. JTAG), although I am using the RPi 3B+ openocd configuration file, which may need changes? Also, is USB host controller different from RPi 3B+ (Synopsis DesignWare Host Controller)? Or is USB power interface different? I power USB as in RPi 3B+ but root port is unresponsive. Or is this just because the USB peripheral base moved to 0x600000000 and I need to enable MMU first?

rst
Posts: 409
Joined: Sat Apr 20, 2013 6:42 pm
Location: Germany

Re: Raspberry Pi 4

Sat Jul 20, 2019 7:58 am

sean.lawless wrote:
Fri Jul 19, 2019 10:12 pm
I had to add 'enable_uart=1' to the config.txt on the boot folder to get UART0 (ie. /dev/serial0) to work, similar to RPi 3B+.
This probably sets the alternate functions for GPIO14/15. I'm doing this in my bare metal code, without config.txt.
For JTAG, even with 'enable_jtag_gpio=1' in config.txt the JTAG chain interrogation is all 1's (GPIOs 22-26 configured for Alt 4, ie. JTAG), although I am using the RPi 3B+ openocd configuration file, which may need changes?
Unfortunately I cannot talk about JTAG. I do not use it.
Also, is USB host controller different from RPi 3B+ (Synopsis DesignWare Host Controller)? Or is USB power interface different? I power USB as in RPi 3B+ but root port is unresponsive. Or is this just because the USB peripheral base moved to 0x600000000 and I need to enable MMU first?
There is a totally new USB host controller (xHCI) in the RPi 4, which is connected to the four Type-A USB sockets. It is connected via a PCI-e lane and needs a new driver and MMU/LPAE support (in AArch32).

The DW USB OTG host controller still exists, but is connected to the Type-C power socket and can AFAIK only be used for USB device operation, not as a host controller.

MikeDB
Posts: 81
Joined: Sun Oct 12, 2014 8:27 am

Re: Raspberry Pi 4

Thu Jul 25, 2019 11:33 pm

I found that with the official black heatsink then the temperature was running in the 70 to 80 deg range. But I found that screwing a small quiet £1 40mm 5V fan to the top of the heatsink using M3 screws in between the heatsink fins held the fan tight and reduced temperature to 35 deg C even when running flat out.

LdB
Posts: 1239
Joined: Wed Dec 07, 2016 2:29 pm

Re: Raspberry Pi 4

Thu Aug 01, 2019 3:38 pm

No-one has mentioned it so I will but there is a bug with 64bit on the Pi4 or they have added a new name that isn't yet documented.

Just putting the file kernel8.img on the SD card is not enough to get you into 64bit mode you need to add this line to the config.txt

Code: Select all

arm_control=0x200
It will then load kernel8.img properly

MODS realistically there needs to be a new name for the file anyhow perhaps kernel9.img?

The reason being is we need to be able to distinguish AARCH64 bit code destined for the cortexa53 Pi3 versus cortexa72 code destined for Pi4 ... just pointing out the bleeding obvious. You are going to get that request for 64bit linux as they try to use the cortexa72 properly anyhow :-)

I have already done it several times putting kernel8.img files setup for the GIC etc on the Pi4 crash and burn when I put it in a pi3 by accident. If you are trying to create a repo you can't have a 64 bit kernel for the Pi4 and Pi3 in the same directory because they share the same name and you certainly can't have them both as auto kicks on the boot disk of an SD card.

rst
Posts: 409
Joined: Sat Apr 20, 2013 6:42 pm
Location: Germany

Re: Raspberry Pi 4

Thu Aug 01, 2019 4:46 pm

LdB wrote:
Thu Aug 01, 2019 3:38 pm
No-one has mentioned it so I will but there is a bug with 64bit on the Pi4 or they have added a new name that isn't yet documented.

Just putting the file kernel8.img on the SD card is not enough to get you into 64bit mode you need to add this line to the config.txt

Code: Select all

arm_control=0x200
It will then load kernel8.img properly
This has already been mentioned here (see: Firmware) and there is a better solution, but to use the deprecated "arm_control=0x200" config setting. It is also suggested in the linked article.

I'm using the following config.txt file for AArch64:

Code: Select all

arm_64bit=1

[pi4]
kernel=kernel8-rpi4.img
With this you can have two different kernel images on the SD card:

* kernel8.img for RPi 3
* kernel8-rpi4.img for RPi 4

Return to “Bare metal, Assembly language”