![]() |
MKMxxZxxACxx5 Bare Metal Software Drivers
R4.1.6
Reference Manual
|
Q: Can't run device with bus clock above 1 MHz?
A: Make sure device runs in normal (RUN) mode. Check your code as well as defines in the appconfig.h
for potential entry to very low power run (VLPR) mode.
Q: How to create specific on-chip peripheral configuration?
A: Select the configuration structure with the closest functionality from peripheral's header file and copy and place it to the appconfig.h
file of your application. After renaming the structure apply SET
and CLR
macros for each register field to initialize on-chip peripheral behavior according to your needs. Use SET
macro whenever register bit or bit fields shall be set to specified value. Use CLR
macro whenever to clear register bit or bit fields. Such created specific on-chip peripheral structure can be passed as an argument to the peripheral init function. Refer to Creating Configuration Structure for more details.
Q: Can't debug IRTC driver?
A: A protection mechanism is built in to the IRTC module to protect its registers against spurious writes by any run-away code. The protection mechanism requires the CPU to unlock IRTC registers for writing. After unlocking the registers, the CPU has a window of 2 seconds for updating the register space. Any updates beyond the unlock window would terminate by Hard Fault.
Q: Software freezes in default_isr function?
A: When the device receives a fault or an on-chip peripheral interrupt event for which a service routine is not installed then the core starts executing the default_isr()
function. The default_isr()
function enters the core to an infinite loop, preserving the system state for examination by a debugger. Note that if a watchdog timer has been enabled then the device resets after watchdog timer period elapses.
Q: How to register handler for HardFault exception?
A: Program an application specific hardfault_isr()
function in your main.c
file.
Q: Is it possible to accelerate on-chip peripheral programming via Bit Manipulation Engine (BME)?
A: By default, software drivers use BME read-modify-write capability for programming all on-chip peripherals.
Q: Can I use Micro-Trace Buffer tracing capabilities?
A: Yes, you can use Micro-Trace Buffer (MTB) debugging capabilities; to enable MTB insert #define MTB_RAM_RESERVE
into appconfig.h
file. This define reserves trace buffer in RAM for use by the MTB. The trace buffer starts at address 0x1FFFF000 and it has size of 64-bytes. You can also modify size of the trace buffer for example to 256-bytes by the following definition: #define MTB_RAM_SIZE 0x100
. Note that other settings of the development tool might be necessary to activate MTB - for more details refer to user's manual of the respective tool .
Q: Can I define a variable that is not initialized by the startup function?
A: Yes, linker files support placing non-initialized variables. For example, the volatile uint16 noninit_var
variable will be non-initialized by the startup function if defined as follows:
Q: Can I define a function that executes from RAM?
A: Yes, use the following templates to place void foo(void)
function into RAM:
Q: How to register an interrupt service routine?
A: The interrupt routine for each on-chip peripheral is part of the respective bare metal driver. It is used automatically after you register an interrupt callback using either PERIPH_Init(..)
or PERIPH_InstallCallback(..)
function.