Last edited one week ago

How to use the DSI video mode pattern generator for signal quality measurements

Applicable for STM32MP15x lines, STM32MP23x lines, STM32MP25x lines

A MIPI® DSI panel displaying vertical color bars thanks to the DSI video mode pattern generator (VMPG) on a STM32MP157f-DK2 board

1. Article purpose[edit | edit source]

This article provides the basic information needed to enable DSI video mode pattern generator (VMPG) for MIPI® DSI signal quality measurements like:

  • Colorimetry: thanks to vertical or horizontal color bars
  • Data transmission conformance testing: thanks to a Bit Error Rate (BER)[1] pattern

2. Introduction[edit | edit source]

The DSI video mode pattern generator (VMPG) allows the transmission of horizontal/vertical color bars and D-PHY BER testing patterns.

The DSI VMPG is programmed and enabled using the DSI Host video mode configuration register DSI_VMCR (address 0x38):

  • Bit 24 PGO: Pattern generator orientation
    • 0: Vertical color bars
    • 1: Horizontal color bars
  • Bit 20 PGM: Pattern generator mode
    • 0: Color bars (horizontal or vertical)
    • 1: BER pattern (vertical only)
  • Bit 16 PGE: Pattern generator enable
    • 0: Pattern generator is disabled
    • 1: Pattern generator is enabled

Refer to the STM32 MPU reference manuals for the complete DSI video mode pattern generator feature and register descriptions.

To sum up:

  1. Power up the board and be sure the DSI is running.
  2. According to the signal quality measurements, choose between vertical color bars (default), horizontal color bars and the BER pattern.
  3. Prepare the test equipments accordingly.
  4. Read the DSI Host video mode configuration register DSI_VMCR (address 0x38) to get its default running values.
  5. Enable the desired pattern by writing in DSI_VMCR the default running values read previously with the VMPG 3 bits DSI_VMCR.PGO, DSI_VMCR.PGM & DSI_VMCR.PGE.
  6. Use the measurement equipments.
Info white.png Information
If Debugfs is available in the software, it is convenient to use vpg, vpg_ber_pattern, vpg_horizontal files instead of using DSI register reads and writes:
ls /sys/kernel/debug/5a000000.dsi
vpg  vpg_ber_pattern  vpg_horizontal

Read Getting started (Debugfs case) chapter for more details.

3. Installing Devmem or GDB on the target board to read/write registers[edit | edit source]

The simplest ways for enabling the DSI VMPG are:

  • using the command line devmem2 tool: please refer to How to read or write peripheral registers article for its installation and usage.
  • using the debug and trace gdb tool: please refer to GDB article for its installation and usage.

4. Getting started (register access case)[edit | edit source]

Once both the board under test and the measurement equipments are ready, follow the below procedure based on the devmem2 tool (Note: a similar procedure can be done with gdb tool too):

1. Identify the DSI internal peripheral memory address

  • On STM32MP15x lines More info.png: DSI address is 0x5a000000
  • On STM32MP23x lines More info.png and STM32MP25x lines More info.png: DSI address is 0x48000000

Refer to the STM32 MPU reference manuals for details.

It is possible to use the running board device tree too, like in the below example:

ls -R /proc/device-tree/ | grep dsi # STM32MP15 case
...
dsi@5a000000
/proc/device-tree/soc/dsi@5a000000:
...
ls -R /proc/device-tree/ | grep dsi # STM32MP23/25 case
...
dsi@48000000
/proc/device-tree/soc@0/bus@42080000/dsi@48000000:
Info white.png Information
Next steps use the DSI address 0x5a000000 as example (STM32MP15x lines More info.png case).

2. Boot the board and read the VMPG related register running values

devmem2 0x5a000038 # Read DSI_VMCR running value (here 0x0000BF02)
/dev/mem opened.
Memory mapped at address 0xb6fd6000.
Read at address  0x5A000038 (0xb6fd6038): 0x0000BF02

3. Enable the desired test pattern

devmem2 0x5a000038 w 0x0001BF02 # Enable VMPG with vertical color bars by default (DSI_VMCR.PGE=0x1)
/dev/mem opened.
Memory mapped at address 0xb6fc8000.
Read at address  0x5A000038 (0xb6fc8038): 0x0000BF02
Write at address 0x5A000038 (0xb6fc8038): 0x0001BF02, readback 0x0001BF02
devmem2 0x5a000038 w 0x0101BF02 # Switch to horizontal color bars (DSI_VMCR.PGO=0x1)
/dev/mem opened.
Memory mapped at address 0xb6fbc000.
Read at address  0x5A000038 (0xb6fbc038): 0x0001BF02
Write at address 0x5A000038 (0xb6fbc038): 0x0101BF02, readback 0x0101BF02
devmem2 0x5a000038 w 0x0011BF02 # Switch to the BER pattern (DSI_VMCR.PGM=0x1)
/dev/mem opened.
Memory mapped at address 0xb6f63000.
Read at address  0x5A000038 (0xb6f63038): 0x0101BF02
Write at address 0x5A000038 (0xb6f63038): 0x0011BF02, readback 0x0011BF02
devmem2 0x5a000038 w 0x0000BF02 # Disable VMPG (DSI_VMCR.PGE=0x0)
/dev/mem opened.
Memory mapped at address 0xb6eeb000.
Read at address  0x5A000038 (0xb6eeb038): 0x0011BF02
Write at address 0x5A000038 (0xb6eeb038): 0x0000BF02, readback 0x0000BF02

4. Perform the signal quality test with the measurement equipment



Info white.png Information
Before making any measurements, it may be useful to test the procedure on a real MIPI® DSI panel, keeping in mind that enabling VMPG will cause the screen to display test patterns instead of its application content.

In the below photos, the STM32MP157x-DKx board is used, the application is by default in landscape mode but the panel is natively portrait:

5. Getting started (Debugfs case)[edit | edit source]

If Debugfs is available in the software, it is convenient to use vpg, vpg_ber_pattern, vpg_horizontal files instead of using DSI register reads and writes.

5.1. On STM32MP15x lines More info.png[edit | edit source]

Next commands use the DSI address 5a000000:

ls /sys/kernel/debug/5a000000.dsi
vpg  vpg_ber_pattern  vpg_horizontal 

echo 1 > /sys/kernel/debug/5a000000.dsi/vpg             # Enable VMPG with vertical color bars by default
echo 1 > /sys/kernel/debug/5a000000.dsi/vpg_horizontal  # Switch to horizontal color bars
echo 1 > /sys/kernel/debug/5a000000.dsi/vpg_ber_pattern # Switch to the BER pattern
echo 0 > /sys/kernel/debug/5a000000.dsi/vpg             # Disable VMPG

5.2. On STM32MP23x lines More info.png and STM32MP25x lines More info.png[edit | edit source]

Next commands use the DSI address 48000000:

ls /sys/kernel/debug/48000000.dsi
vpg  vpg_ber_pattern  vpg_horizontal 

echo 1 > /sys/kernel/debug/48000000.dsi/vpg             # Enable VMPG with vertical color bars by default
echo 1 > /sys/kernel/debug/48000000.dsi/vpg_horizontal  # Switch to horizontal color bars
echo 1 > /sys/kernel/debug/48000000.dsi/vpg_ber_pattern # Switch to the BER pattern
echo 0 > /sys/kernel/debug/48000000.dsi/vpg             # Disable VMPG

6. Alternatives[edit | edit source]

Instead of the OpenSTLinux distribution, it is also possible to use:

7. References[edit | edit source]