Difference between revisions of "CM-X300: U-Boot: Custom Features"

From Compulab Mediawiki
Jump to: navigation, search
(Flashing the Splash screen image into the NAND flash)
(LCD and Splash screen)
 
Line 4: Line 4:
 
The support covers Toppoly TDO35S LCD supplied with the evaluation kit, standard VGA screens and custom LCD panels.<br>
 
The support covers Toppoly TDO35S LCD supplied with the evaluation kit, standard VGA screens and custom LCD panels.<br>
 
The following setup is required in order to enable splash screen display:
 
The following setup is required in order to enable splash screen display:
* Connect an LCD or a VGA display to the SB-X300, as described in [http://www.compulab.co.il/x300/download/x300-sb-man.pdf SB-X300 reference manual]
+
* Connect an LCD or a VGA display to the SB-X300 as described in SB-X300 reference manual found on [http://compulab.co.il/products/computer-on-modules/cm-x300/#devres CompuLab website]
 
* [[CM-X300:_U-Boot:_Custom_Features#Display_parameters_setup|Setup display parameters]]
 
* [[CM-X300:_U-Boot:_Custom_Features#Display_parameters_setup|Setup display parameters]]
 
* [[CM-X300:_U-Boot:_Custom_Features#Splash_screen_image|Store a splash screen image into the CM-X300 NAND flash]]
 
* [[CM-X300:_U-Boot:_Custom_Features#Splash_screen_image|Store a splash screen image into the CM-X300 NAND flash]]

Latest revision as of 10:17, 4 April 2013

LCD and Splash screen

CM-X300 U-Boot features LCD and splash screen support starting from version 2009.03-cm-x300-4.
The support covers Toppoly TDO35S LCD supplied with the evaluation kit, standard VGA screens and custom LCD panels.
The following setup is required in order to enable splash screen display:

Display parameters setup

In order to configure the U-Boot display sub-system, display parameters should be passed to the PXA3xx frame buffer driver.
CM-X300 U-Boot provides predefined parameter sets for the TDO35S LCD and standard VGA displays. Other displays require custom parameters to be set according to the display data-sheet.
U-Boot display sub-system configuration is controlled with two U-Boot environment variables: the displaytype variable and the optional user defined variable for custom display settings.

Setting the "displaytype" variable

The displaytype variable can be assigned with one of the following values:

  • toppoly - U-Boot will use the predefined parameter set for the TDO35S LCD.
  • vga - U-Boot will use the predefined parameter set for standard VGA display.
  • none - U-Boot will disable the display sub-system. This is also the default behavior when the displaytype variable value is not set.
  • <varname> - U-Boot will search for the "varname" environment variable. The "varname" value will be used to setup the display parameters.
Admolition note.png If displaytype is set to toppoly, vga or none U-Boot will automatically perform the required display setup.

Custom LCD parameter setup

Throughout this section the optional user defined variable will be called customlcd.
The customlcd variable is a string of parameters, describing the LCD characteristics.
The syntax of customlcd variable is a comma separated list of <key>:<value> pairs and <value> singles. For example:

<key1>:<value1>,<key2>:<value2>,<value3>,<key4>:<value4>

The order of the parameters in the string is not important.

Admolition note.png The syntax of the string is similar to the Linux kernel command line video parameter, with pxafb value (can be found at: http://kernel.org/doc/Documentation/fb/pxafb.txt). Linux users can append (with little changes) the customlcd variable to the Linux kernel command line, so the kernel will take care of the LCD setup on boot.
Parameters description
mode:XRESxYRES[-BPP] The display resolution in pixels: XRES - width, YRES - height. BPP - bit depth (optional).
pixclock:PIXCLOCK Pixel clock in picoseconds.
left:LEFT Left display margin (Horizontal Back Porch)
right:RIGHT Right display margin (Horizontal Front Porch)
upper:UPPER Upper display margin (Vertical Back Porch)
lower:LOWER Lower display margin (Vertical Front Porch)
hsynclen:HSYNC Horizontal sync time (Horizontal Sync Pulse Width)
vsynclen:VSYNC Vertical sync time (Vertical Sync Pulse Width)
active Active (TFT) display
passive Passive (STN) display
hsync:HSYNC Horizontal sync polarity. 0 => active low, 1 => active high
vsync:VSYNC Vertical sync polarity. 0 => active low, 1 => active high
dpc:DPC Double pixel clock. 1=>true, 0=>false
outputen:POLARITY Output enable polarity. 0 => active low, 1 => active high
pixclockpol:POLARITY Pixel clock polarity. 0 => falling edge, 1 => rising edge

All the above values should be taken or derived from the LCD datasheet.
For example, in order to setup the parameters for standard VGA 640x480 in customlcd variable, use the following commands:

> setenv customlcd "mode:640x480-8,pixclock:39722,left:100,right:18,upper:15,lower:40,hsynclen:40,vsynclen:20,active,hsync:1,vsync:1,outputen:1"
> setenv displaytype "customlcd"
> saveenv
Admolition important.png TDO35S LCD requires special wakeup sequence, therefore displaytype variable must be set to toppoly for proper TDO35S LCD operation.

Splash screen image

CM-X300 U-Boot supports uncompressed 8-bit BMP splash screen images. The example of such an image for TDO35S LCD, can be downloaded from here. The splash screen image should be stored in the CM-X300 NAND flash at offset 0xC0000 and its maximal size should not exceed 768KB (0xC0000). U-Boot will automatically relocate the splash screen image from NAND flash into the PXA3xx CPU frame buffer.

Flashing the Splash screen image into the NAND flash

To store the splash screen image into the NAND flash use the following command sequence:

  • Download the image to the CM-X300 RAM:
> tftp 80a00000 <bmp img name>
  • Or read the image from MMC/SD card:
> mmc init
> fatload mmc 1 80a00000 <bmp img name>
  • Or read the image from USB:
> usb start
> fatload usb 0 80a00000 <bmp img name>
  • Erase the NAND flash at offset 0xC0000:
> nand erase c0000 c0000
  • Write the splash screen image into the NAND flash:
> nand write 80a00000 c0000 c0000

The splash screen is in the NAND flash.

Setting up the environment

In order to display the splash screen image that resides in the NAND flash, the splashimage environment variable must be set. The splashimage variable should contain the base address for splash screen shadow in RAM. Our recommended value is: 0x83e00000. This value ensures that the splash screen shadow does not overlap other vital locations in RAM (like U-Boot shadow) and is safe to use.

Admolition warning.png The splash screen shadow address range should not overlap other vital RAM locations in use. In particular, if the splash screen overlaps U-Boot code segment, the CM-X300 module may become disabled!

To set the splashimage variable use the following command:

> setenv splashimage 83e00000
> saveenv

Frame Buffer

The frame buffer location in system RAM is hard-coded into the CM-X300 U-Boot. The base address of the frame buffer is written to fbaddr environment variable. Writing any data to the address range from fbaddr to fbaddr + 1MB will corrupt the splash screen image.
After the operating system initializes its own frame buffer, the value of fbaddr variable is meaningless.

CPU Frequency setting

U-Boot for CM-X300 supports setting the CPU operating frequency and System Bus clock frequency at boot time.
During the boot process, U-Boot checks the cpufreq environment variable and sets the CPU and System Bus clock frequencies according to the operating points table. The supported CPU frequencies are: 104, 208, 416 and 624 MHz. If U-Boot detects an invalid cpufreq value, the closest lower valid value is used. The default value for CPU frequency is 416MHz.
After the new CPU operating frequency value is stored in cpufreq environment variable, the system must be reset for the change to take effect.
For example, to set the CPU frequency to 624MHz, use the following commands:

> setenv cpufreq 624
> saveenv
> reset

Operating Points Table

CPU Clock Frequency System Bus Clock Frequency Option
104MHz 104MHz +
208MHz 104MHz +
416MHz 156MHz C624
624MHz 208MHz C624


Silent Operation

CM-X300 U-Boot utilizes the STUART serial port for console input/output. This port can also be used for communications with an external device. In such applications U-Boot console output may cause undefined behavior of the external device.
Silent operation is designed to suppress the U-Boot console output and let custom application take control of the STUART serial port.

Enabling Silent Operation

Use the following commands to enable silent operation:

> setenv silent 1
> saveenv

After system reset, U-Boot console output will be suppressed and U-Boot start up messages will not be displayed.
In this mode U-Boot is still listening for data coming through the STUART serial port. Input received on the STUART port during boot will abort the bootcmd command execution and interrupt the boot process. In order to prevent boot interruption, the bootdelay environment variable must be set to "0". U-Boot will discard any data from the STUART serial port and continue the boot process.
Use the following commands to set the bootdelay variable:

> setenv bootdelay 0
> saveenv

Disabling Silent Operation

In order to disable silent operation and enable the U-Boot console, CTRL-C key sequence must be sent over the STUART serial port during the early stages of the U-Boot boot process. This will interrupt the automatic boot process, the silent operation mode and enable the U-Boot console.
In order to disable the silent operation permanently, the silent environment variable must be cleared:

> setenv silent
> saveenv

GPIO settings

CM-X300 U-Boot supports GPIO control during early stages of the boot process. This feature is only recommended for applications that require the gpio signal(s) to be set very early in the boot process and cannot utilize the operating system gpio control API's.
The feature is supported starting from CM-X300 revision 1.2.

Setting the GPIO direction and output level

In order to configure the GPIO direction and output level, the customgpio environment variable must be set.
The syntax is a list of GPIO settings separated by commas. Each setting includes GPIO number, direction and output level (optional):

<GPIO number> <in|out> [0|1][,<GPIO number> <in|out> [0|1][,...]]

For example, to set GPIO 1 to input, GPIO 48 to output high and GPIO 67 to output low, use the following command:

> setenv customgpio "1 in,48 out 1,67 out 0"
> saveenv

Maximal customgpio variable length should not exceed 256 characters.
New GPIO settings take effect after system reset.

Admolition note.png Re-configuring GPIOs that are utilized for CM-X300 on-board peripherals may result in unpredictable behavior.

Disabling custom GPIO settings

In order to disable the custom GPIO settings, customgpio environment variable must be cleared:

> setenv customgpio
> saveenv
> reset

Advanced power mode

When CM-X300 is powered from a battery, it is crucial to reduce the system power consumption.
U-Boot advanced power mode allows to lower the system power consumption by disabling peripherals that are not required for system boot: Wi-Fi, USB, BlueTooth, AC97 audio.

Admolition note.png The operating system will be responsible for enabling the peripherals, disabled by U-Boot.

Enabling the advanced power mode

In order to enable the advanced power mode, the adv_pwr_mode environment variable must be set:

> setenv adv_pwr_mode 1
> saveenv
> reset

Disabling the advanced power mode

In order to disable the advanced power mode, the adv_pwr_mode environment variable must be cleared:

> setenv adv_pwr_mode
> saveenv
> reset


Admolition note.png Advanced power mode setting take effect after system reset.
Admolition note.png The USB sub-system will be automatically powered by U-Boot USB control commands even when the system is operated in advanced power mode.

Alternative boot

U-Boot for CM-X300 supports running an alternative boot sequence. For example launch a script/executable from network or storage device, which will perform a S/W update process.
The feature is supported starting from U-Boot version 2009.03-cm-x300-6. The Alternative Boot (SW2) button is available starting from SB-X300 revision 1.2.

Using the alternative boot command

To enable the alternative boot command, the alt_bootcmd environment variable must be set as following:

> setenv alt_bootcmd "<user defined command>"
> saveenv

To run the alternative boot command, on the next reset/power-up sequence, press and hold the Alternative Boot (SW2) button until the alternative boot starts.
The alternative boot command will be executed if the Alternative Boot (SW2) is pressed and hold during reset/power-up sequence. To disable completely the alternative boot command, remove the alt_bootcmd environment variable:

> setenv alt_bootcmd
> saveenv

See also