Processor Expert Software Knowledge Base

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Processor Expert Software Knowledge Base

Discussions

Sort by:
The Processor Expert Driver Suite 10.4 Update 2 is available on the Freescale web and as Eclipse update. This update applies to the Driver Suite 10.4, or 3rd party IDE's with Processor Expert as Atollic TrueSTUDIO or Emprog Thunderbench. It is NOT applicable to CodeWarrior or Kinetis Design Studio: the upcoming KDS V2.0.0 release will include that update. This update features an improved new project wizard with device filtering support, alignment with the Kinetis SDK v1.0.0 and the upcoming SDK v1.1, and includes bug fixes (see release notes for details). The update is cummulative, so you can apply it to Driver Suite 10.4 with or without the Update 10.4.1. Release Notes: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=PE_DRIVER_SUITE&fpsp=1&tab=Documentation_Tab Download from the web: http://www.freescale.com/webapp/sps/site/overview.jsp?code=PEXDRV_UPDATES_10_4 Then update Eclipse with Window > Install new softeare and use the downloaded archive. Eclipse Updater: Use the following update URL to download the update 10.4.2 (menu Help > Install New Software): http://freescale.com/lgfiles/updates/Eclipse/PExDrv10_4/com.freescale.pexdrv.updatesite Best regards, Erich
View full article
Introduction The goal of this example is to read all ADC inputs of Kinetis KL25 in a row without the need of using CPU core for switching channels and pins and reading individual values. The FRDM-KL25 board features Kinetis MKL25Z128VLK4 microcontroller. This MCU contains a 16-bit AD converter with 16 inputs. In Processor Expert there is available ADC_LDD component which can be used for measuring values on these pins. However, there is a limitation that some of the input pins (e.g. ADC0_SE4a and ADC0_SE4b) are muxed to same channel and ADC_LDD doesn’t allow to measure such two pins at once without additional mux-switching code. The MCU also does not provide an option of scanning through the ADC channels and the channels need to be switched by the user. To resolve the goal of measuring all inputs in a row the Peripheral Initialization components and DMA (Direct Memory Access) peripheral can be used. Project Description Note: The archive with the example project is attached to this article. The DMA in this example is used for controlling all the channel switching, pin mux selection and reading the results for series of measurement into a memory buffer. Results are written to serial console (virtual serial port) provided by the FRDM board. The Direct Memory Access (DMA) channels are configured for writing and reading ADC registers the following way: DMA channel 0 reads converted results (ADC0_RA register) DMA channel 1 changes the ADC pin group selection multiplexer (ADC0_CFG2 register) using values from memory array ChannelsCfg DMA channel 2 selects the ADC channel and starts conversion (ADC0_SC1A register) using values from memory array ChannelsCfg2 The data for the DMA channel 1 a 2 are prepared in the ChannelsCfg and ChannelsCfg2 arrays prepared in memory and the DMA operates in the following cycle: In the beginning, the DMA channel 1 transfer is started using software trigger. This selects the pin (a/b). Then, DMA channel 2 is immediately executed because of enabled DMA channel linking. This configures the channel and starts the conversion. After the conversion is complete, the result is read by DMA channel 0 and stored to results array. Channel linking executes the Channel 1 transfer and the cycle continues. After all needed channels are measured (DMA byte counter reaches 0), the DMA Interrupt is invoked so the user code is notified. See the following figure describing the process: Component Configuration The application uses generated driver modules from the following Processor Expert components: ConsoleIO properties setup This component redirects printf command output to FRDM USB virtual serial port which is connected to UART0 pins PTA1/UART0_RX and PTA2/UART0_TX. The serial device, speed and pins are configured in inherited Serial_LDD component. Init_ADC properties setup The Init_ADC provides ADC initialization code with all channels enabled and set to single-ended. The clock can be selected according to any valid value, according to the user needs.The same with HW average settings. Compare functionality will not be used in this demo.           Pins configuration - all pins available on the board are enabled:           Interrupts,  DMA and Triggering - Interrupts are disabled, DMA request is enabled. Triggering is disabled, as it’s not used in this demo project, However, the application could be extended to use it.           Init_DMA properties setup The Init_DMA provides provides initialization code for the DMA. Clock gate and DMA multiplexor are enabled:           DMA Channel 0 16-bit results are transferred from ADC0_RA register (see proprerty Data source / Address). Transfer mode is Cycle-steal, which means that only one transaction is done per each external request. The destination address initial value is not filled in the inspector because it's filled repeatedly in the application code. Channel linking is set to trigger channel 1 after each transfer DMA mux settings for the Channel 0 are enabled and ADC0_DMA_Request is selected, which is the signal from ADC when the conversion ends. "DMA transfer done" interrupt for this channel is enabled. The ADCint ISR function will be called. External request (request from ADC) is Enabled to start the transfer. Byte count will also be changed before every sequence Property values:                     DMA Channel 1 DMA channel 1 changes the ADC pin group selection multiplexer (ADC0_CFG2 register) using values from memory array ChannelsCfg. Please note that the source address initial value is not filled, will be set in the application code along with the Byte count value. There is no HW trigger for this channel, it's set to be triggered by SW only (and by linking mechanism, which will be used). The linking from this channel is set to trigger CH2 after the transfer. No interrupt is enabled for this channel                DMA Channel 2 DMA channel 2 selects the ADC channel and starts conversion (ADC0_SC1A register) using values from memory array ChannelsCfg2. No channel is linked after the transfer ends - No link. No external channel request is selected, this channel transfer is triggered by linking from CH2.                TimerUnit_LDD It's used in the application code to provide delay to slow down console output. The TPM0 counter is used with the period of approx. 350ms. No interurpt is used. Auto initialization is enabled.                Code The channels/pins to be measured are specified in the ChannelsCfg and ChannelsCfg2 arrays. These arrays contains a list of pins to be measured, the order can be changed according to the user needs, the channels can even be measured multiple times. The special value 0x1F stops the conversion. // configuration array for channels - channel numbers. Should ends with 0x1F which stops conversion // seconcd onfiguration array coreesponding to channels selecting A/B pins // For example: 0 + PIN_A corresponds to the pin ADC0_SE0,   5 + PIN_5 selects the pin ADC0_SE5b // You can use these arrays to reorder the measurement as you need const uint8_t ChannelsCfg [ADC_CHANNELS_COUNT + 1] =  { 0,     4,     3,     7,     4,    23,    8,     9,    11,     12,    13,    14,    15,    5,     6,     7,     0x1F }; const uint8_t ChannelsCfg2[ADC_CHANNELS_COUNT + 1] =  {PIN_A, PIN_A, PIN_A, PIN_A, PIN_B, PIN_A, PIN_A, PIN_A, PIN_A, PIN_A, PIN_A, PIN_A, PIN_A, PIN_B, PIN_B, PIN_B,    0 }; In the main loop, the application first re-initializes the DMA values and strarts the sequence by software triggerring the DMA channel 1. // loop while (TRUE) {    // clear flag     Measured = FALSE;    // reset DMA0 destination pointer to beginning of the buffer    DMA_DAR0 = (uint32_t) &MeasuredValues;    // reset DMA1 source pointer (MUX switching writes)    DMA_SAR1 = (uint32_t) &ChannelsCfg2;    // reset DMA2 source pointer (channel switching and conversion start writes)    DMA_SAR2 = (uint32_t) &ChannelsCfg;    // number of total bytes to be transfered from the ADC result register A    DMA_DSR_BCR0 = ADC_CHANNELS_COUNT * 2;    // set number of total bytes to be transfered to the ADC0_CFG2    DMA_DSR_BCR1 = ADC_CHANNELS_COUNT + 1;    // set number of total bytes to be transfered to the ADC0_SC1A.     DMA_DSR_BCR2 = ADC_CHANNELS_COUNT + 1;    // start first DMA1 transfer (selects mux, then fires channel 2 to select channel which starts the conversion)    DMA_DCR1 |= DMA_DCR_START_MASK;    // wait till it's all measured   while (!Measured) {}    // print all measured values to console   for (i=0; i<ADC_CHANNELS_COUNT; i++) {     printf ("%7u", (uint16_t) MeasuredValues[i]);   }      printf ("\n");    // reset the counter   TU1_ResetCounter(TU1_DeviceData);   // wait for some time to slow down output   while (TU1_GetCounterValue(TU1_DeviceData) < 50000) {} } Running the project The project can be run usual way. import the project into CodeWarrior for MCUs V10.5. Build the project Connect the FRDM-KL25 board Start debuging and run the code Run terminal application or use the Terminal view in eclpise. Set it to use the virtual serial port created for the board. The parameters should be set to 38400,no parity, 8 bits ,1 stopbit.
View full article
Processor Expert Software is a development system to create, configure, optimize, migrate, and deliver software components that generate source code for Freescale silicon. The main features of PEx are: Extensive and comprehensive knowledgebase for all supported silicon encapsulating all pins, registers, etc. Silicon resource conflicts flagged at design time, allowing early correction Simple creation of peripheral drivers without reading silicon documentation Easy integration of an RTOS with peripheral drivers The generated drivers have a cross-platform API that allows easy migration among supported processors. The user builds an application or library using a wide range of basic building block called Embedded components covering all common tasks (for example, serial communication, timers, ADC, DAC, digital I/O etc.). These components can be configured in graphical user interface and Processor Expert generate a C source code of initialization and runtime control drivers of the processor and its peripherals. Processor Expert is available: Integrated with CodeWarrior for Microcontrollers As a standalone package called Microcontroller Driver Suite. It supports Kinetis and ColdFire+ microcontrollers. It does not include a compiler or linker and can be used with other non-CodeWarrior IDEs. Integrated with Kinetis Design Stuido (KDS) For more details, refer to the Freescale website http://www.freescale.com/processorexpert.
View full article
Hey everyone! If you are looking for concise steps to create and apply a patch in a yocto build, this article will serve you well. The reference taken in this article is of iMX93EVK yocto build. For this exercise, we are modifying a lpspi dts file in the BSP and creating a patch file but you may apply the same steps to other files in the BSP as well. Step-1 Make changes to the dts file in your directory example - arch/arm64/boot/dts/freescale/imx93-11x11-evk-lpspi.dts Step-2 In your yocto build, go to the git folder  cd imx-yocto-bsp-home/build_11x11/tmp/work/imx93_11x11_lpddr4x_evk-poky-linux/linux-imx/6.1.36+gitAUTOINC+04b05c5527-r0/git Step-3 Execute 'git diff' to check the difference between your changes and the default ones    Check the status by executing 'git status'     Step-4 Execute 'git add <file>'  , 'git commit -m <message>', and 'git format-patch -1' to add a file and create a git format patch file for your changes.   copy the generated patch file to a location which yocto build look for the patches Example- My yocto build looks for the patch in various locations, one of them is this one :- sources/meta-imx/meta-bsp/recipes-kernel/linux/files, so after creating the directory 'files', we can move the patch file to this folder    Step-5 Edit the .bb file for linux recipes-kernel for example - Open  /home/nxg06361/imx-yocto-bsp-home/sources/meta-imx/meta-bsp/recipes-kernel/linux/linux-imx_6.1.bb  for editing Append the patch file name to the SRC_URI variable     You can also verify that your patch has been successfully applied or not by doing 'git log'   Voila ! that's all you need to do in order to create and apply a git patch for your yocto build.
View full article
This document describes the manual conversion of a (CodeWarrior MCU 10.6) Processor Expert project by creating of a new project in KDS 3.0.0 for the same target MCU and copying of Processor Expert project and user source code. This options of the CodeWarrior (or Driver Suite) project conversion provide an easy way how to convert the project but all customized settings of compiler, linker and libraries must be set manually in the new KDS 3.0.0 project again (this configuration will not be migrated). The migration of the whole CodeWarrior project is described in the document CW MCU 10.6 Processor Expert projects migration into KDS 3.0.0 Steps: 1. Create a new Kinetis project for the same target MCU (navigate to menu File > New > Kinetis Project). Write a new project name (you can write the same name of the original project). Select the same target MCU (or a target board that use the same target MCU). Kinetis SDK – select None Check Processor Expert Select the compiler that is available (installed) in your KDS 3.0.0 installation (GNU C Compiler is available by default). 2. Remove all Processor Expert components from the project (delete all CPUs and components if included). All components will be imported from the original project. 3. In the Components windows, navigate to the View Menu > Import > Import Processor Expert Component Settings 4. In the Import Processor Expert Component Settings windows, click on Browse button 5. In the dialog, select *.pe file extension and select the ProcessorExpert.pe from the original CodeWarrior Processor Expert project. Click on the Open button. 6. In the Import Processor Expert Component Settings windows select the target project (the new project). 7. The window contain list of all components that can be imported (added). You can select components that can be omitted (all will be imported by default). 8. Click on the Finish button. All selected components are imported and no warnings and errors should be reported. 9. Open the folder with the original CodeWarrior project and drag-and-drop source code files (copy files) from the  CodeWarrior project into the new project created in KDS (select Copy files).   Please note, that CodeWarrior projects have the main() function in the ProcessorExpert.c file but the Kinetis Project uses the main.c (copy the content or you can rename the copied ProcessorExpert.c file) . 10. If necessary you can customize the project settings of the project by using Properties (in the Project Explorer window open the context menu of the project and select Properties). You can select the settings that are required by your application (optimization level, adding path to external libraries and so on). 11. Generate the Processor Expert code and Build the application. When all source code is copied (and customized settings and paths are properly set) the application is compiled without any errors and warnings. Debugger connection are pre-configured in the new Kinetis Project in KDS 3.0.0 by default.
View full article
Trigger Description Module implementing mini threads using timer based callbacks (triggers) Component Trigger.PEupd Dependencies LowPower License License : Open Source (LGPL) Copyright : (c) Copyright Erich Styger, 2011, all rights reserved. This an open source software implementing triggers using Processor Expert. This is a free software and is opened for education, research and commercial developments under license policy of following terms: * This is a free software and there is NO WARRANTY. * No restriction on use. You can use, modify and redistribute it for personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY. * Redistributions of source code must retain the above copyright notice.
View full article
BootLoaderUSB Description Bootloader over USB Component BootLoaderUSB.PEupd Dependencies Wait, BootLoaderUSB, S19 License This component is based on the Freescale Application Note AN3748. The copyright notice of the original file is provided below: /****************************************************************************** * * (c) copyright Freescale Semiconductor China Ltd. 2008 * ALL RIGHTS RESERVED * * File Name: SCSI_Process.C * * Description: This file is to handle SCSI command * * Assembler: Codewarrior for HC(S)08 V6.2 * * Version: 2.3 * * Author: Patrick Yang * * Location: Shanghai, P.R.China * * * UPDATED HISTORY: * * REV YYYY.MM.DD AUTHOR DESCRIPTION OF CHANGE * --- ---------- ------ --------------------- * 1.0 2008.01.02 Patrick Yang Initial version * 2.0 2008.06.10 Derek Snell Modified to work with USB MSD bootloader * 2.1 2008.08.15 Derek Snell Fixed SCSI issue to work with non-XP OSs * 2.2 2008.08.25 Derek Snell Renamed SCSI Inquiry to "Freescale USB Bootloader" * Stopped accepting write data from host after successful S19 transfer * ******************************************************************************/ /* Freescale is not obligated to provide any support, upgrades or new */ /* releases of the Software. Freescale may make changes to the Software at */ /* any time, without any obligation to notify or provide updated versions of */ /* the Software to you. Freescale expressly disclaims any warranty for the */ /* Software. The Software is provided as is, without warranty of any kind, */ /* either express or implied, including, without limitation, the implied */ /* warranties of merchantability, fitness for a particular purpose, or */ /* non-infringement. You assume the entire risk arising out of the use or */ /* performance of the Software, or any systems you design using the software */ /* (if any). Nothing may be construed as a warranty or representation by */ /* Freescale that the Software or any derivative work developed with or */ /* incorporating the Software will be free from infringement of the */ /* intellectual property rights of third parties. In no event will Freescale */ /* be liable, whether in contract, tort, or otherwise, for any incidental, */ /* special, indirect, consequential or punitive damages, including, but not */ /* limited to, damages for any loss of use, loss of time, inconvenience, */ /* commercial loss, or lost profits, savings, or revenues to the full extent */ /* such may be disclaimed by law. The Software is not fault tolerant and is */ /* not designed, manufactured or intended by Freescale for incorporation */ /* into products intended for use or resale in on-line control equipment in */ /* hazardous, dangerous to life or potentially life-threatening environments */ /* requiring fail-safe performance, such as in the operation of nuclear */ /* facilities, aircraft navigation or communication systems, air traffic */ /* control, direct life support machines or weapons systems, in which the */ /* failure of products could lead directly to death, personal injury or */ /* severe physical or environmental damage (High Risk Activities). You */ /* specifically represent and warrant that you will not use the Software or */ /* any derivative work of the Software for High Risk Activities. */ /* Freescale and the Freescale logos are registered trademarks of Freescale */ /* Semiconductor Inc. */ /*****************************************************************************/
View full article
Remember Processor Expert? Just to refresh your mind, is a development system to create, configure, optimize, migrate, and deliver software components that generate source code for Freescale silicon, supporting S08/RS08, S12(X), Coldfire, Coldfire+, Kinetis, DSC 56800/E, QorIQ and some other Power Architecture processors. And well, what's the such new great thing in it? Take a look: Microcontroller Driver Suite v10.0 is a software management system to perform Processor Expert's tasks and provide a low-cost, efficient solution for your designs. Just recently a great update has been made into it: the driver suite is delivered and installed as a comprehensive product with the Eclipse 3.7 (Indigo) IDE. It is also available as an Eclipse 3.7 plug-in. This extends Processor Expert software functionality to non-CodeWarrior IDE users for the supported platforms. The cool, useful part of all this is that Processor Expert technology packaged in the driver suite makes it much easier to optimize the low-level intricacies of a hardware platform. It also eliminates the necessity for one-size-fits-all drivers, therefore the driver suite allows you to design custom peripheral drivers ideally suited to your needs, without the need for extensive hardware knowledge! And just as aesy as that, you get a whole new set of possibilities to empower your design! You can try the software by just clicking here Microcontrollers Driver Suite v10.0 And you can also get the Driver Suite for Eclipse by clicking on here Microcontroller Driver Suite v10.0, for Eclipse 3.7 (Indigo)
View full article
FSShell Description File System Shell Component FSShell.PEupd Dependencies Utility, FAT_FileSystem, FreeRTOS, RTC_I2C_DS1307, FSL_USB_Stack, RingBufferUInt8 License License : Open Source (LGPL) Copyright : (c) Copyright Erich Styger, 2012, all rights reserved. This an open source software implementing a shell using Processor Expert. Main purpose is for a file system, but useful as well without one. This is a free software and is opened for education, research and commercial developments under license policy of following terms: * This is a free software and there is NO WARRANTY. * No restriction on use. You can use, modify and redistribute it for personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY. * Redistributions of source code must retain the above copyright notice.
View full article
This document describes the creation of the following low power demo application: When the application starts the green LED blink one time, The RTC device  alarm is set to 15 second  (external oscillator 32768Hz is used) to wakeup CPU and the CPU enters the VLLS1 mode (VLLS0 mode cannot be used with external oscillator).  The CPU wake up is possible by the following ways: - When you push the SW2 button the processor is woken up and the green LED start blinking (5 times). - When you short the pin PTB6 to ground 5 times (the pin is available on the 8 pin header connector – pin number 4; you can for example connect a button to the pin number 4 and ground) the processor is woken and the green LED start blinking (5 times). - When selected RTC timeout expired (15 seconds) the processor is woken by the alarm interrupt and the green LED start blinking (5 times). The application is initialized again and recovery from the VLLS1 mode is executed. The alarm is set to 15 second and the CPU enters the VLLS1 mode again. Preparation First of all the KDS 1.1.1 (KDS 2.0.0) and KSDK 1.0.0 for KL03Z must be installed. You can find instructions in the document How to install KL03 SDK support in KDS 1.1.1 and KDS 2.0.0. New project When you properly install and update all the software you are prepared to create the Low power demo application. Create a new Kinetis design Studio project: Select the FRDM-KL03Z board Select the Kinetis SDK path to the KSDK 1.0.0 for KL03Z and select Processor Expert The application is created but there are many warnings reported in the Problems window saying that there is a conflict: Ignored error: Selected value is in conflict with other configuration(s) property 'Pin 13', property 'CH1 - Channel 1', property 'Pin' from component gpio_pins, property 'ERCLK32K clock output' Exclusive connection required by property 'CH1 - Channel 1'; Selected value is in conflict with other configuration property 'CH1 - Channel 1', conflict in configuration of MUX bit-field of PORTB_PCR13 register. ; Selected value is in conflict with other configuration property 'Pin 13', property 'Pin' from component gpio_pins, conflict in configuration of MUX bit-field of PORTB_PCR13 register. (CLKOUT - Oscillator output), Low power demo KL03, .... To resolve all these warnings you need to select the required functionality of reported pins in the PinSettings component: Open the Component Inspector of the PinSettings component, select the Routing tab and select the Pins View mode. All pins are available on one tab and you see small exclamation icons in rows where are reported conflicts: Click on each item with warning icon (the Selected Function row) and uncheck unused function of the pin to select one function only, i.e. you need to specify which functionality of the pin is initialized by code generated by Processor Expert. You can select GPIO functionality in all case except the last pin number 24 that is used by debugger as swd_dio pin: You can see that there is not any warning now and all pins are routed according to the selection you have done. There is also necessary to change the linker settings when you have installed the new version of GCC tools (according to the document that is available in the KSDK 1.0.0 for KL03Z installation folder in KSDK_1.0.0-KL03Z\doc\Kinetis SDK Freescale Freedom FRDM-KL03Z Platform User’s Guide.pdf – chapter Appendix B: Kinetis Design Studio environment variable fix and swap tool chain) Open the context menu of the project, select Properties item and change the Other linker flags settings to “-specs=nano.specs -specs=nosys.specs”, in C/C++ Build / Settings,  Tools Settigns tab, Cross ARM C++ Linker/Miscellaneous: Tip If you want to know details of compiled code and the code size, you can use the following options to create extended list file and print code size info on the following Toolchains tab: You can generate Processor Expert code and process Build of the application without any error and warning. When the Build is finished the following information is provided in the Console window: 'Invoking: Cross ARM GNU Create Listing' arm-none-eabi-objdump --source --all-headers --demangle --line-numbers --wide "Low power demo KL03.elf" > "Low power demo KL03.lst" 'Finished building: Low power demo KL03.lst' ' ' 'Invoking: Cross ARM GNU Print Size' arm-none-eabi-size --format=berkeley "Low power demo KL03.elf"    text          data           bss           dec           hex       filename    8860           112           640          9612          258c       Low power demo KL03.elf 'Finished building: Low power demo KL03.siz' Routing of pins When you open the gpio_pins component (in Component Inspector window) you can see that there are configured pins that are already used on target board: SW2 - ADC0_SE9/PTB0/IRQ_5/LLWU_P4/EXTRG_IN/SPI0_SCK/I2C0_SCL – input pin for the SW2 button on the board SW3 - ADC0_SE1/CMP0_IN1/PTB5/IRQ_12/TPM1_CH1/NMI_b - input pin for the SW3 button on the board ACCEL_INT - ADC0_SE0/CMP0_IN0/PTA12/IRQ_13/LPTMR0_ALT2/TPM1_CH0/TPM_CLKIN0/CLKOUT – input pin of inertial sensor interrupt LED_RED - PTB10/TPM0_CH1/SPI0_SS_b – output pin that driver the red LED of the RGB LED on the board LED_GREEN - PTB11/TPM0_CH0/SPI0_MISO - output pin that driver the green LED of the RGB LED on the board LED_BLUE - PTB13/CLKOUT32K/TPM1_CH1/RTC_CLKOUT - output pin that driver the blue LED of the RGB LED on the board Note: You can see routing of all pins when you generate report of PinSettings component. Open the Component Inspector of PinSettins, Routing tab and click on the HTML Report button. We will use the SW2 button to wakeup the CPU and the green LED for indication of the CPU state. Adding Processor Expert components Now you can add all components for the low power demo application. Init_LLWU and fsl_llwu_hal components to control LLWU device Init_SRTC and fsl_rtc_hal to control RTC device Init_LPTMR and fsl_lptmr_hal to control LPTMR device fsl_smc_hal to control SMC (System Mode Controller) device CPU device We are going to use external oscillator 32768Hz and we need to configure device to allow Very Low Leakage Stop modes. There are set following properties in the Component Inspector of the CPU (switch to Advance view): Check that the Clock settings/Clock Sources/System oscillator 0 property is Enabled and set Enable in stop property to Enabled. The Clock source, clock pins and clock frequency are preset for the FRDM-KL03Z board. Go to the Clock configuration/Clock Configuration 0 and set: Internal reference clock/Slow IRC frequency to 2MHz (it is enough for our demo application and it also decreases power consumption). MCG lite settings/MCG mode set to LIRC_2M Very low power mode to Enabled (leave setting of VLP mode entry to User because the VLLS1 mode is entered after blinking; we will write the code to enter VLLS1 mode) System clocks/Core clock set to 0.5Mhz System clocks/Bus clock set to 0.5Mhz (it allow us to enter very low leakage stop modes) Set Low Power mode settings/Acknowledge isolation to Not allowed value (we will do it in the user code) LLWU (Low-Leakage Wakeup unit) device Open the Component Inspector of Init_LLWU, switch to Advance view and set following properties: Set Settings/External Source/Pin 4 to Any edge value (we will use this pin that is connected to SW2 button) Set Pins/Pin 4 to Enabled and select SW2 in the item below Set Initialization/Utilize after reset values to no We will use the LLWU to wake-up the CPU and we need not any interrupt. RTC (Real Time Clock) device Open the Component Inspector of Init_SRTC, switch to Advance view and set following properties: Set Settings/Clock gate to Enabled Set Settings/Oscillator settings/Oscillator state to Enabled (it enables external oscillator also in stop modes) Set Settings/Time settins/Alarm time [s] to 15 (15 seconds timeout to wake-up from VLLS1 mode) Set Interrupts/ RTC interrupt/Interrupt request to Enabled Set Interrupts/ RTC interrupt/Time overflow interrupt to Disabled Set Interrupts/ RTC interrupt/Time invalid interrupt to Disabled Set Initialization/Time counter to Enabled Set Initialization/Utilize after reset values to no LPTMR (Low-Power Timer) device Open the Component Inspector of Init_LPTMR, switch to Advance view and set following properties: Set  Settings/Clock gate to Enabled Set Settings/Clock settings/Clock select to Internal 1kHz LPO (this clock source is enabled in the VLLS1 mode) Set Settings/Clock settings/Prescale value/Glitch filter to Prescaler/64; Glitch Filter 32 (it will eliminates glitches on connected button that will be used for generating pulses) Set Settings/Compare value to 4 (the LPTMR interrupt is invoked when the compare value is equal to counter and the counter value is increased, i.e. 5 pulses on the input pins invoke the LPTMR interrupt) Set Settings/Timer mode to Pulse Counter (we will use the timer to count external pulses on the input pin 3) Set Settings/Pin select to Input 3 Set Settings/Pin polarity to Active Low Set Pins/Input pin 3 to Enabled and select PTB6/IRQ_2/LPTMR0_ALT3/TPM1_CH1, TPM_CLKIN1 in Pin 3 item. Set Interrupts/Interrupt request to Enabled Set Interrupts/Timer interrupt to Enabled (we will use the timer interrupt to wake-up CPU from VLLS1 mode after 5 pulses on the input 3 pin) Set Initialization/Timer enable to yes Set Initialization/Utilize after reset values to no To avoid glitches on the PTB6 pin, that is used as input pin of the LPTMR, we will also enable pull-up in the PinSettins. Open Component Inspector of the PinSettings, select Functional Properties tab and set the pin number 1 (PTB6) as follows: We have finished design time settings of Processor Expert components and we are ready to write the application code. When you generate code and Build the application there will not be any error or warning. The Processor Expert project looks as follow: Application  code During the component settings we have enabled two interrupts – RTC interrupt and LPTMR interrupt. Therefore we need to write theses interrupt service routines. If you look for example into RTC.h file, you can find the declaration of the RTC_IRQHandler interrupt routine. So we can use the declaration to write the definition of the routine in the main.c program module: #define RTC_ALARM_TIMEOUT_SEC 15 #define LED_BLINK 5 /* RTC interrupt service routine */ PE_ISR(RTC_IRQHandler) { if (RTC_HAL_HasAlarmOccured(RTC_BASE)) { // set the next alarm in RTC_ALARM_TIMEOUT_SEC seconds (clear also the TAF flag) RTC_HAL_SetAlarmReg(RTC_BASE,RTC_HAL_GetAlarmReg(RTC_BASE) + RTC_ALARM_TIMEOUT_SEC); } if (RTC_HAL_IsTimeInvalid(RTC_BASE)) {        /* clear TIF (Time Invalid Flag) by stop of the counter and setting TSR reg */        RTC_HAL_EnableCounter(RTC_BASE, false);        RTC_HAL_SetSecsReg(RTC_BASE, 0);        /* enable counter */        RTC_HAL_EnableCounter(RTC_BASE, true); } } This interrupt routine services the Alarm interrupt in case that it is invoked during blinking of the green LED in the run mode (clear the flag and set the new Alarm time) and also it services the Invalid Time interrupt that can occur during recovering from the VLLS1 mode. Please note, that RTC module is little bit special, it runs in all run, wait and stop modes and the reset enables the Time Invalid interrupt bit (TIIE bit in RTC_IER) and invoke the Time Invalid interrupt on reset (POR or software reset). Therefore we need to clear the Invalid Time flag otherwise the application remain invoking RTC interrupt in an infinite cycle and the application does not work at all (it is also one of the issue that has not a straight forward solution). The RTC interrupt routine (defined above) shall properly serve all case we need in our application. Please note, that RTC interrupt always cause the wake-up from low-leakage stops modes (it is not configurable by LLWU on KL03 derivatives – see the chip-specific LLWU information). In addition, the after reset value of RTC_SR register is 0x01 (TIF flag is set). Therefore when the RTC is not initialized and a low-leakage stop mode is entered the CPU is immediately woken-up due to the RTC module interrupt flag (TIF flag is set). I.e. you must always properly initialize RTC module and clear all flags before you enter a low-leakage stop mode. We need also a service routine for the LPTMR device that is used for waking up from VLSS1 mode. This is a simple interrupt service routine that just clear the LPTMR interrupt flag: /* LPTMR interrupt service routine */ PE_ISR(LPTMR0_IRQHandler) { /* clear LPTMR interrupt flag */ LPTMR_HAL_ClearIntFlag(LPTMR0_BASE); } Now we can write the main() function. We will need a temporary count variables for blinking: /* Write your local variable definition here */ volatile uint32_t i; // for waiting uint8_t blink_count; After devices initialization in PE_low_level_init() we need to check the reason of reset (POR reset or VLLS1 recovery). Thus we can write following code: /* Write your code here */   if (RCM_SRS0 == 0x01) { /* test the reason of reset - wakeup on VLLS */     if(PMC->REGSC &  PMC_REGSC_ACKISO_MASK) {       PMC->REGSC |= PMC_REGSC_ACKISO_MASK; /* VLLSx recovery */     }     for (blink_count = 0; blink_count < LED_BLINK; blink_count++) {         // green LED blinking         GPIO_DRV_ClearPinOutput(kGpioLED2);         //GPIOB_PCOR = (GPIOB_PCOR & (~GPIOB_PSOR_MASK)) | GPIOB_PSOR_VALUE;         for (i = 0; i<40000; i++);         GPIO_DRV_SetPinOutput(kGpioLED2);         //GPIOB_PSOR = (GPIOB_PSOR & (~GPIOB_PSOR_MASK)) | GPIOB_PSOR_VALUE;         for (i = 0; i<40000; i++);     }     // set the next alarm in "RTC_ALARM_TIMEOUT_SEC" seconds (clear also the TAF flag)    RTC_HAL_SetAlarmReg(RTC_BASE,RTC_HAL_GetAlarmReg(RTC_BASE)+RTC_ALARM_TIMEOUT_SEC);   } else {     /* power-on reset */     /* switch the green LED on */     GPIO_DRV_ClearPinOutput(kGpioLED2);     /* wait a while */     for (i = 0; i<40000; i++);     /* switch the green LED off */     GPIO_DRV_SetPinOutput(kGpioLED2);   } In case of VLLS1 recovery we acknowledge the pin isolation ACKISO bit in the PMC_REGSC register. This bit must be cleared to allow normal run mode of all pins. Then five blinking of the green LED follows (it is just a simple code for demo purposes only; you can write your own more sophisticated code for blinking by TPMx device with Init_TPM component if you want). In case of POR reset one blink of the green LED is processed. When the reset/wake-up state is served by our application code the VLLS1 mode can be entered. As the first step, we need to be sure that there are not any interrupt flags set to wake-up the CPU from VLLS1 mode so we clear LLWU and SW2 pin (PTB0) interrupt flags and then we enter VLLS1 mode by using enter_vllsx function: /* clear LLWU flag for the selected pin 4 - PTB0 */ LLWU_F1 |= LLWU_F1_WUF4_MASK;   /* clear interrupt flag of the SW2 pin - PTB0 */ PORTB_PCR0 |= PORT_PCR_ISF_MASK; // enter the VLLS3 //enter_vllsx((smc_por_option_t)NULL,kSmcStopSub3); // enter the VLLS0 - RTC and LPTMR do not work becuase of external crystal clock source does not work in the VLLS0 mode //enter_vllsx(kSmcPorEnabled, kSmcStopSub0); // enter the VLLS1 enter_vllsx((smc_por_option_t)NULL,kSmcStopSub1); // switch the green LED on - error state when the VLLSx mode is not entered GPIO_DRV_ClearPinOutput(kGpioLED2); There is also code for switching on the green LED in case the VLLS1 mode is not entered (indication of the error state). The enter_vllsx function is defined by the following way (it is used existing function from a demo KSDK demo example): /* * VLLSx mode entry routinue */ static void enter_vllsx(smc_por_option_t PORPOValue, smc_stop_submode_t VLLSValue) {        smc_power_mode_config_t smcConfig;        /* set power mode to specific VLLSx mode */        smcConfig.porOption = true;        smcConfig.porOptionValue = (smc_por_option_t) PORPOValue;        smcConfig.powerModeName = kPowerModeVlls;        smcConfig.stopSubMode = (smc_stop_submode_t) VLLSValue;        SMC_HAL_SetMode(SMC_BASE, &smcConfig); } It is all code we need for our low power demo application. The application can be built and run now. Debugging The application does not contain any debug connection by default in KDS 1.1.1. The KDS 2.0.0 contains debug configurations but the settings must be updated according to following description. We just need to add (modify) a debug configuration for our FRDM-KL03Z board and Open SDA Segger j-link debugger. Open the context menu of the Low power demo KL03 project in the Project Explorer window and select Debug As > Debug Configurations .... In the Debug Configuration window double click on the GDB SEGGER J-Link Debugger item and a new Low power demo KL03 Debug configuration is created. Select the Debugger tab and enter the Device name: MKL03Z32xxx4 (you can find the correct CPU name in list when you open Support device names link that is located to right of this item). Uncheck Allocate console for semihosting and SWO (SWO is not support by OpenSDA SEGGER J-link). Go to on Startup tab and uncheck the Enable SWO option (SWO is not supported by OpenSDA SEGGER J-link). Click on the Apply and Debug button and the debugger starts (you must have the FRDM-KL03Z board connected to the workstation). You can now start the application (click on the Resume button) and check the functionality. The debugger is disconnected due to VLLS1 mode entry. But the application run and can be used. If you want to connect a button for the LPTMR pulses generating you can connect one pin of the button to the PTB6 on pin #4 of 8-pins connector J1 and the second pin of the button to the GND to the pin #7 of the 10-pins connector J2, see below: You can use this demo application as a start point of your real low power application. I hope it will help you and save your time of your first low power application implementation in the Processor Expert. There is also possible to measure power consumption of the CPU in VLLS1 mode. It is described in the FRDM-KL03 User Guide. Just unsolder R27 and R28 and solder a header pins to J10 position of the board. You must use jumper for J10 now to connect power supply for the CPU and when the jumper is removed you can use these two pins to measure the energy consumption of the CPU (e.g. by a multimeter).
View full article
FreeRTOSTrace Description Implements FreeRTOS hook API for tracing. See this blog post. Component FreeRTOSTrace.PEupd Dependencies FreeRTOS, PercepioTrace License License : Open Source (LGPL) Copyright : (c) Copyright Erich Styger/Martin Bucher, 2012, all rights reserved. This an open source software implementation with Processor Expert. This is a free software and is opened for education, research and commercial developments under license policy of following terms: * This is a free software and there is NO WARRANTY. * No restriction on use. You can use, modify and redistribute it for personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY. * Redistributions of source code must retain the above copyright notice.
View full article
Step by step instructions for how to use Processor Expert inside CodeWarrior to create a bare board (no RTOS) application to use GPIO and Timers to blink LEDs on the TWR-K60N512 board, from scratch.
View full article
BootLoaderDisk Description File System for Bootloader Component BootLoaderDisk.PEupd Dependencies S19 License This component is based on the Freescale Application Note AN3748. The copyright notice of the original file is provided below: /****************************************************************************** * * (c) copyright Freescale Semiconductor 2008 * ALL RIGHTS RESERVED * * File Name: FAT16.c * * Purpose: This file is for a USB Mass-Storage Device bootloader. This file * mimics a FAT16 drive in order to enumerate as a disk drive * * Assembler: Codewarrior for Microcontrollers V6.2 * * Version: 1.0 * * * Author: Derek Snell * * Location: Indianapolis, IN. USA * * UPDATED HISTORY: * * REV YYYY.MM.DD AUTHOR DESCRIPTION OF CHANGE * --- ---------- ------ --------------------- * 1.0 2008.06.10 Derek Snell Initial version * * ******************************************************************************/ /* Freescale is not obligated to provide any support, upgrades or new */ /* releases of the Software. Freescale may make changes to the Software at */ /* any time, without any obligation to notify or provide updated versions of */ /* the Software to you. Freescale expressly disclaims any warranty for the */ /* Software. The Software is provided as is, without warranty of any kind, */ /* either express or implied, including, without limitation, the implied */ /* warranties of merchantability, fitness for a particular purpose, or */ /* non-infringement. You assume the entire risk arising out of the use or */ /* performance of the Software, or any systems you design using the software */ /* (if any). Nothing may be construed as a warranty or representation by */ /* Freescale that the Software or any derivative work developed with or */ /* incorporating the Software will be free from infringement of the */ /* intellectual property rights of third parties. In no event will Freescale */ /* be liable, whether in contract, tort, or otherwise, for any incidental, */ /* special, indirect, consequential or punitive damages, including, but not */ /* limited to, damages for any loss of use, loss of time, inconvenience, */ /* commercial loss, or lost profits, savings, or revenues to the full extent */ /* such may be disclaimed by law. The Software is not fault tolerant and is */ /* not designed, manufactured or intended by Freescale for incorporation */ /* into products intended for use or resale in on-line control equipment in */ /* hazardous, dangerous to life or potentially life-threatening environments */ /* requiring fail-safe performance, such as in the operation of nuclear */ /* facilities, aircraft navigation or communication systems, air traffic */ /* control, direct life support machines or weapons systems, in which the */ /* failure of products could lead directly to death, personal injury or */ /* severe physical or environmental damage (High Risk Activities). You */ /* specifically represent and warrant that you will not use the Software or */ /* any derivative work of the Software for High Risk Activities. */ /* Freescale and the Freescale logos are registered trademarks of Freescale */ /* Semiconductor Inc. */
View full article
Utility Description Different utility methods, mainly around strings Component Utility.PEupd Dependencies none License License : Open Source (LGPL) Copyright : (c) Copyright Erich Styger, 2012, all rights reserved. xatoi(): Copyright (C) 2010, ChaN, all right reserved. (see copyright notice and license at the function implementation). This an open source software implementing utility functions using Processor Expert. This is a free software and is opened for education, research and commercial developments under license policy of following terms: * This is a free software and there is NO WARRANTY. * No restriction on use. You can use, modify and redistribute it for personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY. * Redistributions of source code must retain the above copyright notice.
View full article
Using Microcontroller Driver Suite, learn how to add, configure, and remove a component, and how to generate code.
View full article
The new NXP Pins Tool for i.MX Applications Processors which has been showcased at FTF 2016 in Austin is now available as desktop application: The Pins Tool makes configuring, muxing and routing of pins very easy and fast. It provides real-time feedback of conflicts and provides an intuitive graphical interface with several views. The tool generates device tree (.dtsi) and sources files which can be directly integrated into C/C++ applications. The following devices are supported: - i.MX 6Dual/Quad - i.MX 6DualPlus/QuadPlus - i.MX 6DualLite - i.MX 6Solo - i.MX 6SoloLite - i.MX 6SoloX - i.MX 6UltraLite - i.MX 7Dual - i.MX 7Solo The Pins Tool is available as download from http://www.nxp.com/pinsimx (Windows, Mac OS X and Linux 64bit) under the 'Software' category. There are two different installer types: 'offline' is a 140 MByte download. This method is recommended for slower internet connections or for installation on multiple machines. 'online' is a smaller download, all the other installation data will be loaded from the internet during installation. Mac OS X and Linux installers are 64bit. For Windows there are both 32bit and 64bit installers available. It is recommended to download the additional header files if not already installed/provided by your BSP because they are referenced by the initialization code. The header files are available in the following download under 'Headers': Documentation is available under the documentation section, as well attached to this article: For installation, check out the installation guide. For first steps, use the Getting started document. We hope you find this tool useful! i.MX Community | NXP Community: http://www.imxcommunity.org
View full article
FatFsMemSDHC Description SD Card low level driver for FatFs using SDHC_LDD. Component FatFsMemSDHC.PEupd Dependencies Timeout License License : Open Source (LGPL) Copyright : (c) Copyright Erich Styger, 2012, all rights reserved. This an open source software implementing an SD card low level driver useful for the the ChaN FatFS, using Processor Expert. This is a free software and is opened for education, research and commercial developments under license policy of following terms: * This is a free software and there is NO WARRANTY. * No restriction on use. You can use, modify and redistribute it for personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY. * Redistributions of source code must retain the above copyright notice.
View full article
FAT_FileSystem Description Implements a wrapper for the FAT FS File System implemented by ChaN (see: http://elm-chan.org/fsw/ff/00index_e.html) Component FAT_FileSystem.PEupd Dependencies FreeRTOS, SD_Card License License : Open Source (LGPL) Copyright : (c) Copyright Erich Styger, 2012, all rights reserved. FatFS: Copyright (C) 2011, ChaN, all right reserved. (see copyright notice and license in the FatFS implementation). This an open source software implementing an interface to the ChaN FatFS using Processor Expert. This is a free software and is opened for education, research and commercial developments under license policy of following terms: * This is a free software and there is NO WARRANTY. * No restriction on use. You can use, modify and redistribute it for personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY. * Redistributions of source code must retain the above copyright notice.
View full article
GenericSWI2C Description Implements a software I2C driver using general purpose I/O pins (bit banging). The driver has been re-implemented using an existing Processor Expert component for the Freescale HCS08. Component GenericSWI2C.PEupd Dependencies Wait License (c) Copyright Freescale Semiconductor, 2010 http : www.freescale.com
View full article
Tacho Description Driver for a Tachometer. Component Tacho.PEupd Dependencies QuadCounter License License : Open Source (LGPL) Copyright : (c) Copyright Erich Styger, 2012, all rights reserved. This an open source software using Processor Expert. This is a free software and is opened for education, research and commercial developments under license policy of following terms: * This is a free software and there is NO WARRANTY. * No restriction on use. You can use, modify and redistribute it for personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY. * Redistributions of source code must retain the above copyright notice.
View full article