sys_config.h File Reference

This file provides the configurable parameters for your project. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TERMINAL_USE_NRF_WIRELESS   0
 Terminal command can be sent through nordic wireless. More...
 
#define TERMINAL_END_CHARS   {3, 3, 4, 4}
 The last characters sent after processing a terminal command. More...
 
#define TERMINAL_USE_CAN_BUS_HANDLER   0
 CAN bus terminal command. More...
 
#define SYS_CFG_SPI1_CLK_MHZ   24
 Max speed of SPI1 for SD Card and Flash memory. More...
 
#define SYS_CFG_SPI0_CLK_MHZ   8
 Nordic wireless requires 1-8Mhz max. More...
 
#define SYS_CFG_I2C2_CLK_KHZ   100
 100Khz is standard I2C speed More...
 
#define SYS_CFG_STARTUP_DELAY_MS   2000
 If defined, a boot message is logged to this file. More...
 
#define SYS_CFG_CRASH_STARTUP_DELAY_MS   5000
 Start-up delay in milliseconds if a crash occurred previously. More...
 
#define SYS_CFG_INITIALIZE_LOGGER   1
 If non-zero, the logger is initialized (. More...
 
#define SYS_CFG_LOGGER_TASK_PRIORITY   1
 The priority of the logger task (do not use 0, logger will run into issues while writing the file) More...
 
#define SYS_CFG_ENABLE_TLM   1
 Enable telemetry system. C_FILE_IO forced enabled if enabled. More...
 
#define SYS_CFG_DISK_TLM_NAME   "disk"
 Filename to save "disk" telemetry variables. More...
 
#define SYS_CFG_DEBUG_TLM_NAME   "debug"
 Name of the debug telemetry component. More...
 
#define SYS_CFG_ENABLE_CFILE_IO   0
 Allow stdio fopen() fclose() to redirect to ff.h. More...
 
#define SYS_CFG_MAX_FILES_OPENED   3
 Maximum files that can be opened at once. More...
 
#define SYS_CFG_SYS_TIMER   1
 
#define SYS_CFG_WATCHDOG_TIMEOUT_MS   (3 * 1000)
 
#define INTERNAL_CLOCK   (4 * 1000 * 1000UL)
 Do not change, this is the same on all LPC17XX. More...
 
#define EXTERNAL_CLOCK   (12 * 1000 * 1000UL)
 Change according to your board specification. More...
 
#define RTC_CLOCK   (32768UL)
 Do not change, this is the typical RTC crystal value. More...
 
#define SYS_CFG_DESIRED_CPU_CLK   (48 * 1000 * 1000UL)
 Define the CPU speed you desire, must be between 1-100Mhz. More...
 
#define SYS_CFG_DEFAULT_CPU_CLK   (24 * 1000 * 1000UL)
 Do not change. This is the fall-back CPU speed if SYS_CFG_DESIRED_CPU_CLK cannot be attained. More...
 
#define SYS_CFG_RTC_VALID_YEARS_RANGE   {2010, 2025}
 
#define SYS_CFG_ENABLE_CFILE_IO   1
 Allow stdio fopen() fclose() to redirect to ff.h. More...
 
#define WIRELESS_NODE_ADDR   106
 Any value from 1-254. More...
 
#define WIRELESS_CHANNEL_NUM   2499
 2402 - 2500 to avoid collisions among 2+ mesh networks More...
 
#define WIRELESS_AIR_DATARATE_KBPS   2000
 Air data rate, can only be 250, 1000, or 2000 kbps. More...
 
#define WIRELESS_NODE_NAME   "node"
 Wireless node name (ping response contains this name) More...
 
#define WIRELESS_RX_QUEUE_SIZE   3
 Number of payloads we can queue. More...
 
#define WIRELESS_NODE_ADDR_FILE   "naddr"
 Node address can be read from this file and this can override WIRELESS_NODE_ADDR. More...
 
#define CLOCK_SOURCE_INTERNAL   0
 Just a constant, do not change. More...
 
#define CLOCK_SOURCE_EXTERNAL   1
 Just a constant, do not change. More...
 
#define CLOCK_SOURCE_RTC   2
 Just a constant, do not change. More...
 
#define SYS_CFG_CLOCK_SOURCE   CLOCK_SOURCE_INTERNAL
 Select the clock source from above. More...
 
#define SYS_CFG_REDUCED_PRINTF   0
 If non-zero, floating-point printf() and scanf() is not supported. More...
 
#define SYS_CFG_UART0_BPS   38400
 UART0 is configured at this BPS by start-up code - before main() More...
 
#define SYS_CFG_UART0_TXQ_SIZE   256
 UART0 transmit queue size before blocking starts to occur. More...
 

Functions

unsigned int sys_get_cpu_clock ()
 

Detailed Description

This file provides the configurable parameters for your project.

Macro Definition Documentation

#define CLOCK_SOURCE_EXTERNAL   1

Just a constant, do not change.

#define CLOCK_SOURCE_INTERNAL   0

Just a constant, do not change.

Select the clock source:

  • Internal Clock: 4Mhz 1% Tolerance
  • External Clock: External Crystal
  • RTC Clock : 32.768Khz

If the RTC clock is chosen as an input, then sys_clock.cpp will use the closest PLL settings to get you the desired clock rate. Due to PLL calculations, the RTC PLL setting may delay your startup time so be patient. 36864000 (36.864Mhz) is a good frequency to derive from RTC PLL since it offers a perfect UART divider.

#define CLOCK_SOURCE_RTC   2

Just a constant, do not change.

#define EXTERNAL_CLOCK   (12 * 1000 * 1000UL)

Change according to your board specification.

#define INTERNAL_CLOCK   (4 * 1000 * 1000UL)

Do not change, this is the same on all LPC17XX.

#define RTC_CLOCK   (32768UL)

Do not change, this is the typical RTC crystal value.

#define SYS_CFG_CLOCK_SOURCE   CLOCK_SOURCE_INTERNAL

Select the clock source from above.

#define SYS_CFG_CRASH_STARTUP_DELAY_MS   5000

Start-up delay in milliseconds if a crash occurred previously.

#define SYS_CFG_DEBUG_TLM_NAME   "debug"

Name of the debug telemetry component.

#define SYS_CFG_DEFAULT_CPU_CLK   (24 * 1000 * 1000UL)

Do not change. This is the fall-back CPU speed if SYS_CFG_DESIRED_CPU_CLK cannot be attained.

#define SYS_CFG_DESIRED_CPU_CLK   (48 * 1000 * 1000UL)

Define the CPU speed you desire, must be between 1-100Mhz.

#define SYS_CFG_DISK_TLM_NAME   "disk"

Filename to save "disk" telemetry variables.

#define SYS_CFG_ENABLE_CFILE_IO   0

Allow stdio fopen() fclose() to redirect to ff.h.

Do not change anything here, Telemetry C-File I/O is force enabled if telemetry system is in use.

#define SYS_CFG_ENABLE_CFILE_IO   1

Allow stdio fopen() fclose() to redirect to ff.h.

Do not change anything here, Telemetry C-File I/O is force enabled if telemetry system is in use.

#define SYS_CFG_ENABLE_TLM   1

Enable telemetry system. C_FILE_IO forced enabled if enabled.

#define SYS_CFG_I2C2_CLK_KHZ   100

100Khz is standard I2C speed

#define SYS_CFG_INITIALIZE_LOGGER   1

If non-zero, the logger is initialized (.

See also
file_logger.h)
#define SYS_CFG_LOGGER_TASK_PRIORITY   1

The priority of the logger task (do not use 0, logger will run into issues while writing the file)

#define SYS_CFG_MAX_FILES_OPENED   3

Maximum files that can be opened at once.

#define SYS_CFG_REDUCED_PRINTF   0

If non-zero, floating-point printf() and scanf() is not supported.

Set printf & scanf options - Do a clean build after changing this option

  • 0 : Full printf from stdio.h –> Supports floating-point, but uses 15K more flash memory and about 300 bytes more RAM with newlib nano libraries.
  • 1 : printf from stdio.h without floating point printf/scanf
#define SYS_CFG_RTC_VALID_YEARS_RANGE   {2010, 2025}

Valid years for RTC. If RTC year is not found to be in between these, RTC will reset to 1/1/2000 00:00:00

#define SYS_CFG_SPI0_CLK_MHZ   8

Nordic wireless requires 1-8Mhz max.

#define SYS_CFG_SPI1_CLK_MHZ   24

Max speed of SPI1 for SD Card and Flash memory.

#define SYS_CFG_STARTUP_DELAY_MS   2000

If defined, a boot message is logged to this file.

Start-up delay in milliseconds

#define SYS_CFG_SYS_TIMER   1

Define the timer that will be used to run the background timer service. This drives the lpc_sys_get_uptime_ms(), lpc_sys_get_uptime_us() and periodically resets the watchdog timer along with running the mesh networking task if FreeRTOS is running.

Timer 1 is required if you wish to have an operational IR remote control decoding.

#define SYS_CFG_UART0_BPS   38400

UART0 is configured at this BPS by start-up code - before main()

#define SYS_CFG_UART0_TXQ_SIZE   256

UART0 transmit queue size before blocking starts to occur.

#define SYS_CFG_WATCHDOG_TIMEOUT_MS   (3 * 1000)

Watchdog timeout in milliseconds Value cannot be greater than 1,000,000 which is too large of a value to set for a useful watchdog timer anyway.

#define TERMINAL_END_CHARS   {3, 3, 4, 4}

The last characters sent after processing a terminal command.

#define TERMINAL_USE_CAN_BUS_HANDLER   0

CAN bus terminal command.

#define TERMINAL_USE_NRF_WIRELESS   0

Terminal command can be sent through nordic wireless.

#define WIRELESS_AIR_DATARATE_KBPS   2000

Air data rate, can only be 250, 1000, or 2000 kbps.

#define WIRELESS_CHANNEL_NUM   2499

2402 - 2500 to avoid collisions among 2+ mesh networks

#define WIRELESS_NODE_ADDR   106

Any value from 1-254.

Nordic wireless configuration More settings can be configured at mesh_config.h

Warning
The AIR data rate, and channel number must be consistent for your wireless nodes to talk to each other. It seems that 2000kbps works better than 250kbps although slower data rate is supposed to get longer range.
Go to "PROJECT" –> "Clean" if you change the settings here.
#define WIRELESS_NODE_ADDR_FILE   "naddr"

Node address can be read from this file and this can override WIRELESS_NODE_ADDR.

#define WIRELESS_NODE_NAME   "node"

Wireless node name (ping response contains this name)

#define WIRELESS_RX_QUEUE_SIZE   3

Number of payloads we can queue.

Function Documentation

unsigned int sys_get_cpu_clock ( )
Returns
actual System clock as calculated from PLL and Oscillator selection
Note
The SYS_CFG_DESIRED_CPU_CLK macro defines "Desired" CPU clock, and doesn't guarantee this clock rate. This function returns actual CPU clock of the system.