On-chip Subsystems and Peripherals

Name

On-chip Subsystems and Peripherals -- Hardware Support

Hardware support

On-chip memory

The LPC1XXX parts include on-chip SRAM, and on-chip FLASH. The RAM consists of up to 64KiB in one or two disjoint blocks, and the FLASH can be up to 512KiB in size depending on model.

Typically, an eCos platform HAL port will expect a GDB stub ROM monitor to be programmed into the LPC1XXX on-chip ROM memory for development, and the board would boot this image from reset. The stub ROM provides GDB stub functionality so it is then possible to download and debug stand-alone and eCos applications via the gdb debugger using serial interfaces or other debug channels. The JTAG interface may also be used for development if a suitable JTAG device is available. For production purposes, applications are programmed into on-chip FLASH and will be self-booting.

On-Chip FLASH

The package CYGPKG_DEVS_FLASH_LPC2XXX provides a driver for the on-chip flash. This driver conforms to the Version 2 flash driver API. It queries the microcontroller's device capabilities registers to determine the size and layout of the flash at runtime. This driver is shared with the LPC2xxx microcontroller family, and its name reflects that.

Cache Handling

The LPC1XXX does not contain any caches, however, the variant HAL supplies the cyg/hal/hal_cache.h header to satisfy generic code. This header describes zero sized caches and provides null macros for the required functions.

Serial I/O

The LPC1XXX variant HAL supports basic polled HAL diagnostic I/O over any of the on-chip serial devices. There is also a fully interrupt-driven serial device driver suitable for eCos applications for all on-chip serial devices. The serial driver consists of an eCos package: CYGPKG_IO_SERIAL_CORTEXM_LPC1XXX which provides configuration for the generic CYGPKG_IO_SERIAL_GENERIC_16X5X driver package. Using the HAL diagnostic I/O support, any of these devices can be used by the ROM monitor for communication with GDB. If a device is needed by the application, either directly or via the serial driver, then it cannot also be used for GDB communication using the HAL I/O support. An alternative serial port should be used instead.

The HAL defines CDL interfaces, CYGINT_HAL_LPC1XXX_UART0 to CYGINT_HAL_LPC1XXX_UART3 for each of the possible UARTs. The platform HAL CDL should contain an implements directive for each such UART that is available for use on the board. This will enable use of the UART for diagnostic use.

UARTs 0, 2 and 3 only support TX and RX lines, however UART1 supports the full set of modem control lines.

Interrupts

The LPC1XXX HAL relies on the architectural HAL to provide support for the interrupts directly routed to the NVIC. The cyg/hal/var_intr.h header defines the vector mapping for these.

GPIO

The variant HAL provides support for packaging the configuration of a GPIO line into a single 32-bit descriptor that can then be used with macros to configure the pin and set and read its value.

Clock Distribution

The variant HAL provides support for packaging the clock control parameters of a device into a single 32-bit descriptor that can then be used with macros to enable and disable the device's clock.

I2C Support

A separate driver, CYGPKG_DEVS_I2C_NXPI2C provides support for I2C devices. The platform HAL must define the set of devices attached to each bus and must also configure the pins used for each I2C bus.

SPI Support

The SSP device is based on the ARM PL022 SSP primecell and SPI support is provided via the separate CYGPKG_DEVS_SPI_ARM_PL022 driver. The platform HAL must define the bus instances and devices attached to them.

Profiling Support

The LPC1XXX HAL contains support for gprof-base profiling using a sampling timer. The default timer used is Timer 0. The timer used is selected by a set of #defines in src/lpc1xxx_misc.c which can be changed to refer to a different timer if required. This timer is only enabled when CYGPKG_PROFILE_GPROF is enabled, otherwise it remains available for application use.

Clock Control

The platform HAL must provide the input clock frequency (CYGHWR_HAL_LPC1XXX_INPUT_CLOCK) in its CDL file. This is then combined with the following options defined in this package to define the default system clocks:

CYGHWR_HAL_CORTEXM_LPC1XXX_CLOCK_SOURCE

This defines the source of the main system clock. It can take one of three values: IRC selects the internal ocillator, OSC selects the main ocillator, RTC selects the 32KHz internal clock. It defaults to OSC.

CYGHWR_HAL_CORTEXM_LPC1XXX_CLOCK_SYSCLK_DIV

This defines the divider applied to the 400MHz PLL output to generate the system clock. This can take values between 1 and 16. The default value is 4, giving a 50MHz system clock.

CYGHWR_HAL_CORTEXM_LPC1XXX_PLL0_MUL

This defines the multiplier applied by PLL0 to the selected clock input. It can vary between 6 and 512. The default is 6.

CYGHWR_HAL_CORTEXM_LPC1XXX_PLL0_PREDIV

This defines the pre-divider for PLL0. It may take any value betwen 1 and 32. The default is 1.

CYGHWR_HAL_CORTEXM_LPC1XXX_CCLK_SOURCE

This defines the source of the main CPU clock, CCLK. The options are PLL to select PLL0 and SYSCLK to bypass the PLL and use the system clock directly. The default is PLL.

CYGHWR_HAL_CORTEXM_LPC1XXX_CCLK_DIV

This defines the divider applied to the selected CCLK. It may range between 3 and 256. The default is 3.

The actual frequency of the system clock, in Hz, is stored in the global variable hal_lpc1xxx_sysclk. Similarly the frequency of the PLL output clock is stored in hal_lpc1xxx_pllclk and of CCLK in hal_lpc1xxx_cclk. The clock supplied to the SysTick timer, CCLK, is also assigned to hal_cortexm_systick_clock. These variables are used, rather than configuration options, in anticipation of future support for power management by varying the system clock rate.

2017-02-09
Documentation license for this page: eCosPro License