Open hoglet67 opened 6 years ago
Here is a test build that exhibits the issue: RGBtoHDMI_20180721_1d1ed94.zip
The sources for this are here: https://github.com/hoglet67/RGBtoHDMI/blob/issue_1022/src/rgb_to_hdmi.c
#include "rpi-aux.h"
#include "rpi-mailbox-interface.h"
#include "info.h"
#include "logging.h"
void kernel_main(unsigned int r0, unsigned int r1, unsigned int atags)
{
RPI_AuxMiniUartInit( 115200, 8 );
log_info("RGB to HDMI booted");
// Switch to new core clock speed
RPI_PropertyInit();
RPI_PropertyAddTag( TAG_SET_CLOCK_RATE, CORE_CLK_ID, 384123456, 1);
RPI_PropertyProcess();
dump_useful_info();
while(1);
}
The libraries this is using are derived from the Valvers Bare Metal programming tutorial: https://github.com/hoglet67/RGBtoHDMI/blob/issue_1022/src/rpi-mailbox-interface.c
At this point, the caches are disabled.
The last version of firmware this works with is git commit aa75533:
INFO: RGB to HDMI booted
INFO:
INFO:
INFO: ********** Raspberry Pi RGB to HDMI Convertor **********
INFO:
INFO:
INFO: FIRMWARE_VERSION : 5a9d7465
INFO:
INFO: BOARD_MODEL : 00000000
INFO:
INFO: BOARD_REVISION : 00900093
INFO:
INFO: BOARD_MAC_ADDRESS : 5feb27b8
INFO: BOARD_MAC_ADDRESS : 17d7951b
INFO:
INFO: BOARD_SERIAL : 525f1b95
INFO: BOARD_SERIAL : 00000000
INFO:
INFO: EMMC_FREQ : 250.000 MHz 250.000 MHz 250.000 MHz state=1
INFO: UART_FREQ : 48.000 MHz 1000.000 MHz 1000.000 MHz state=1
INFO: ARM_FREQ : 1000.000 MHz 1000.000 MHz 1000.000 MHz state=1
INFO: CORE_FREQ : 384.123 MHz 400.000 MHz 400.000 MHz state=1
INFO: V3D_FREQ : 300.000 MHz 300.000 MHz 300.000 MHz state=1
INFO: H264_FREQ : 300.000 MHz 300.000 MHz 300.000 MHz state=1
INFO: ISP_FREQ : 300.000 MHz 300.000 MHz 300.000 MHz state=1
INFO: SDRAM_FREQ : 450.000 MHz 450.000 MHz 450.000 MHz state=1
INFO: PIXEL_FREQ : 148.500 MHz -1894.967 MHz -1894.967 MHz state=1
INFO: PWM_FREQ : 0.000 MHz 500.000 MHz 500.000 MHz state=0
INFO: CORE TEMP : 40.62 °C
INFO: CORE VOLTAGE : 1.35 V
INFO: SDRAM_C VOLTAGE : 1.20 V
INFO: SDRAM_P VOLTAGE : 1.20 V
INFO: SDRAM_I VOLTAGE : 1.20 V
INFO: CMD_LINE : bcm2708_fb.fbwidth=1824 bcm2708_fb.fbheight=984 bcm2708_fb.fbdepth=16 bcm2708_fb.fbswap=1 dma.dmachans=0x7f35 bcm2708.boardrev=0x900093 bcm2708.serial=0x525f1b95 bcm2708.uart_clock=48000000 bcm2708.disk_led_gpio=47 smsc95xx.macaddr=B8:27:EB:5F:1B:95 vc_mem.mem_base=0x1fa00000 vc_mem.mem_size=0x20000000 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
Note the core clock is set to 384.123MHz.
The issue first occurs in the next firmware version - git commit 7fdcd00:
��̰~�
�l>�
�~
�0r&l�p~��>��5
INFO:
INFO:
INFO: ********** Raspberry Pi RGB to HDMI Convertor **********
INFO:
INFO:
INFO: FIRMWARE_VERSION : 5aa03908
INFO:
INFO: BOARD_MODEL : 00000000
INFO:
INFO: BOARD_REVISION : 00900093
INFO:
INFO: BOARD_MAC_ADDRESS : 5feb27b8
INFO: BOARD_MAC_ADDRESS : 17d7951b
INFO:
INFO: BOARD_SERIAL : 525f1b95
INFO: BOARD_SERIAL : 00000000
INFO:
INFO: EMMC_FREQ : 200.000 MHz 200.000 MHz 200.000 MHz state=1
INFO: UART_FREQ : 1000.000 MHz 1000.000 MHz 1000.000 MHz state=1
INFO: ARM_FREQ : 1000.000 MHz 1000.000 MHz 1000.000 MHz state=1
INFO: CORE_FREQ : 400.000 MHz 400.000 MHz 400.000 MHz state=1
INFO: V3D_FREQ : 300.000 MHz 300.000 MHz 300.000 MHz state=1
INFO: H264_FREQ : 300.000 MHz 300.000 MHz 300.000 MHz state=1
INFO: ISP_FREQ : 300.000 MHz 300.000 MHz 300.000 MHz state=1
INFO: SDRAM_FREQ : 450.000 MHz 450.000 MHz 450.000 MHz state=1
INFO: PIXEL_FREQ : -1894.967 MHz -1894.967 MHz -1894.967 MHz state=1
INFO: PWM_FREQ : 500.000 MHz 500.000 MHz 500.000 MHz state=0
INFO: CORE TEMP : 40.08 °C
INFO: CORE VOLTAGE : 1.35 V
INFO: SDRAM_C VOLTAGE : 1.20 V
INFO: SDRAM_P VOLTAGE : 1.20 V
INFO: SDRAM_I VOLTAGE : 1.20 V
INFO: CMD_LINE : bcm2708_fb.fbwidth=1824 bcm2708_fb.fbheight=984 bcm2708_fb.fbdepth=16 bcm2708_fb.fbswap=1 dma.dmachans=0x7f35 bcm2708.boardrev=0x900093 bcm2708.serial=0x525f1b95 bcm2708.uart_clock=48000000 bcm2708.disk_led_gpio=47 smsc95xx.macaddr=B8:27:EB:5F:1B:95 vc_mem.mem_base=0x1fa00000 vc_mem.mem_size=0x20000000 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
Note the core frequency is 400MHz, i.e. it's not changed.
Note also the initial log message is garbled, which may be unreleated.
Finally, with the current firmware git commit bffe7ee:
INFO: RGB to HDMI booted
INFO:
INFO:
INFO: ********** Raspberry Pi RGB to HDMI Convertor **********
INFO:
INFO:
INFO: FIRMWARE_VERSION : 5b4dee13
INFO:
INFO: BOARD_MODEL : 00000000
INFO:
INFO: BOARD_REVISION : 00900093
INFO:
INFO: BOARD_MAC_ADDRESS : 5feb27b8
INFO: BOARD_MAC_ADDRESS : 17d7951b
INFO:
INFO: BOARD_SERIAL : 525f1b95
INFO: BOARD_SERIAL : 00000000
INFO:
INFO: EMMC_FREQ : 200.000 MHz 200.000 MHz 200.000 MHz state=1
INFO: UART_FREQ : 48.000 MHz 1000.000 MHz 1000.000 MHz state=1
INFO: ARM_FREQ : 1000.000 MHz 1000.000 MHz 1000.000 MHz state=1
INFO: CORE_FREQ : 400.000 MHz 400.000 MHz 400.000 MHz state=1
INFO: V3D_FREQ : 300.000 MHz 300.000 MHz 300.000 MHz state=1
INFO: H264_FREQ : 300.000 MHz 300.000 MHz 300.000 MHz state=1
INFO: ISP_FREQ : 300.000 MHz 300.000 MHz 300.000 MHz state=1
INFO: SDRAM_FREQ : 450.000 MHz 450.000 MHz 450.000 MHz state=1
INFO: PIXEL_FREQ : 148.500 MHz -1894.967 MHz -1894.967 MHz state=1
INFO: PWM_FREQ : 0.000 MHz 500.000 MHz 500.000 MHz state=0
INFO: CORE TEMP : 40.08 °C
INFO: CORE VOLTAGE : 1.35 V
INFO: SDRAM_C VOLTAGE : 1.20 V
INFO: SDRAM_P VOLTAGE : 1.20 V
INFO: SDRAM_I VOLTAGE : 1.20 V
INFO: CMD_LINE : bcm2708_fb.fbwidth=1824 bcm2708_fb.fbheight=984 bcm2708_fb.fbdepth=16 bcm2708_fb.fbswap=1 dma.dmachans=0x7f35 bcm2708.boardrev=0x900093 bcm2708.serial=0x525f1b95 bcm2708.uart_clock=48000000 bcm2708.disk_led_gpio=47 smsc95xx.macaddr=B8:27:EB:5F:1B:95 vc_mem.mem_base=0x1fa00000 vc_mem.mem_size=0x20000000 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
The core frequency is still 400MHz, i.e. it's not changed.
But the initial log message is no longer garbled.
Please do let me know if you need any further information.
Dave
Dom suggested I created an issue for this. It was originally a forum post
First a little bit of background... I'm working on a project called RGBtoHDMI that uses a Pi Zero as a video format converter to convert RGB Video (from the Acorn BBC Micro) to HDMI:
The project is at a fairly advanced stage and about 10 working prototypes exist.
You can find more information here: https://github.com/hoglet67/RGBtoHDMI/wiki
This is a bare metal project, mostly C with a bit of assembler.
We need to generate a very accurate pixel sampling clock from the Pi that is at the same frequency as the BBC micro's video clock, and with minimal jitter. Actually, it's slightly more complicated than that, as the BBC Micro has 12MHz and 16MHz video modes, so we end up wanting a nominal 96MHz clock.
This clock needs to deal with any variations in the BBC micro's video clock. So if that is 700ppm faster, then we need a clock of 96.0672MHz. We calculate the required sampling clock by measuring the interval between two VSync pulses, and from this determine the clock error (in ppm) between the Beeb and the Pi.
We then use the mailbox interface to set the core core clocks to 384MHz +/- this error:
We then use the Core Clock (PLLC) as a clock source with one of the GPClocks, which gives us a pixel sampling clock of ~96MHz.
The code is in github here: https://github.com/hoglet67/RGBtoHDMI/blob/master/src/rgb_to_hdmi.c#L306
So finally to the point of this post....
It seems that the ability to change the Core clock dynamically in this manner stopped working with this (and all subsequent) version of firmware: 7fdcd00e
(The comment says "Rework the frequency/voltage scaling logic")
The issue is that clock remains unchanged, at it's original value of 400MHz (or whatever is set in config.txt)
Can anyone help me understand what's going on here and whether there is a workaround?
There is a binary release here, including the previous version of the firmware that works. Unfortunately, this isn't going to be much use for testing as it will hang before the clock setting stuff if it doesn't detect a valid video sync signal.
I'll try to work up a small example that exhibits the problem....