S12 / MagniV Microcontrollers Knowledge Base

cancel
Showing results for 
Search instead for 
Did you mean: 

S12 / MagniV Microcontrollers Knowledge Base

Labels

Discussions

Sort by:
Here is the example code demonstrating usage of BATS module integrated in MagniV devices such as S12ZVM, S12ZVC, S12ZVL etc. Find detailed description in the projects main.c file. The example project was created in CodeWarrior IDE v10.6.4 and tested on TRK-S12ZVL board.
View full article
Hello all, sharing the latest version of MagniV Power Dissipation Calculator started by Carlos Vazquez and Anita Maliverney. With this excel sheet is possible estimate the power dissipated for any MCU of S12ZVM, S12ZVL, S12ZC family, considering: supply voltages, digital modules, gate drive unit, charge pump, communication transceivers, etc.   A few features where added, any additional comment or suggestion is appreciated. Regards.
View full article
This short video demonstrates a path through NXP website to the CodeWarrior v5.1 download link. On the final place other downloads are available such as service packs, updates, patches etc. Login to NXP site is required.
View full article
This simple SW example is a CodeWarrior project which demonstrates the usage of Security feature on a microcontroller. Find detailed description in the main.c file. It is also shown how to use backdoor access key to put MCU in unsecured state. The CW project is made for MC9S12ZVL device and the source code can be used on any other derivative with MagniV device family.
View full article
Theory described in S12 FAMILY DEVICES COP RECOGNITION CONSIDERATIONS_v2.0.pdf
View full article
Interrupt catcher example code catches all unexpected interrupts. It can be used for debugging or directly in the application software. The Machine Exception routine is used here as example of expected interrupt.   A few notes: 1. For each expected interrupt you must remove a code line for given interrupt     from the part of the code "A Set of unimplemented interrupts" and     create your own service routine as it is, for example, made     for interrupt 5 void Machine_Exception_ISR(void)   2. All interrupt vectors have 32bit size, however, addresses have only 24bit,     therefore the most significant byte in interrupt vector is not used.     Definitions with the keyword "interrupt XX" where XX represents vector     order in the interrupt vector is used to define interrupt service function.      3. Interrupt number 0 is assigned to POR reset vector,                      1 is assigned to Unimplemented page1 op-code trap vector                      2 is assigned to Unimplemented page2 op-code trap vector                      3  ...                      4  ...     Interrupt number = (0x1FC-Vector Address)/4. See Table 1-11. Interrupt     Vector Locations at RM(page 62-65).     For Example: Interrupt number of SCI0 = (0x1FC-0x19C)/4 = 0x18 = 24.     So you can use either form                interrupt VectorNumber_Vsci0 void SCI0_isr(void)     or                interrupt 24 void SCI0_isr(void)     or                interrupt ((0x1FC-0x19C)/4) void SCI0_isr(void)       Note: VectorNumber_Vsci0 is defined in mc9s12zvl32.h      
View full article
The bold blue links below provide direct download of SW example packs for MagniV devices based on S12Z core.   S12ZVC Getting Started Exercises (REV 1.0) This file contains four hands-on exercise where you can find basic setup code to enable a quick development in different areas. The file includes CodeWarrior projects demonstrating usage of peripheral modules such as: - Digital-to-Analog Converter (DAC), - Controller Area Network (CAN), - Pulse Width Modulation (PWM), - Timer (TIM).   Getting started with S12ZVL32 - S12 MagniV Example Codes (REV 0) The MC9S12ZVC device integrates a battery level (12V) voltage regulator and supply voltage monitoring. This zipped file includes four CodeWarrior examples demonstrating - Overcurrent protection on EVDD pin, - low power STOP mode with API timer and wake-up feature, - Pulse Width Modulation (PWM) - Serial Peripheral Interface (SPI) communication.   Many of these examples can be used on various MCU families across the MagniV product line. Check the appropriate device guide for list of modules and its versions.
View full article
In the attached zip file you can find three software examples demonstrating clock module and PLL configuration on MagniV device MC9S12ZVM. The examples are made in CodeWarrior IDE v10.6 (Eclipse). The main.c source file of each project provides detailed description, comments and important notes.   The source code can be used with other devices within MagniV family based on S12Z core such as S12ZVL, S12ZVC, S12ZVH/Y, but the precaution must be considered about the max bus frequency of the device.   p.s. Revision 2: SYNR, REFDIV and POSTDIV values changed in PLL initialization to achieve highest PLL locking time.
View full article
The example code demonstrates MCU low power modes: STOP and WAIT. For detailed description see main.c file of the project. * - tested on X-VLG-S12ZVC board * - BUSCLK = 6.25MHz based on internal oscillator clock IRCCLK = 1MHz.The PLL set by default in PEI mode. * - Reference documentation: MC9S12ZVCRMV1.pdf (REV 1.9) VLG-MC9S12ZVC-SCH.pdf (Document Number SCH-28038, SPF-28038)
View full article
This presentation walks you through the features and specs of the most integrated solution for CAN node applications. Details @ http://www.freescale.com/S12magniV
View full article
The example demonstrates the COP watchdog reset on MC9S12ZVL32 microcontroller. The code can be used on any MagniV device based on S12Z core. The example project is created in CodeWarrior v10.6 (Eclipse IDE). The SW code has been tested on TRK-S12ZVL board.   * Brief description: The Phase Locked Loop (PLL) is set by default to PEI mode, so the bus clock is 6.25MHz based on 1MHz internal RC oscillator (IRC1M). The RGB LED (red) is used to indicate MCU runs after reset. When the RGB colour changes to green, the COP time-out period has started. After the period times out, the COP generates a reset and COPRF flag is set. After the reset, based on COPRF flag, the Blue LED is turned on indicating previous reset has been generated by COP watchdog. The COP time-out period is set to maximum (CPMUCOP register, bits CR[2:0]=7). The number of COPCLK cycles to time-out is 2^24 = 16777216. The COPCLK is based on IRCCLK (by default) with 1MHz clock frequency. The maximum COP time-out period in this case is approximately 16.78 seconds. - On the TRK-S12ZVL board:   Port P is used to drive RGB LED. Anode is connected to VDDX, a cathode to port  pin. Port P can be set as output (DDRP=0xFF) and logic zero on output enables LED.   - Reference documentation: MC9S12ZVL Family Reference Manual & Datasheet TRK-S12ZVL Board schematics
View full article
Have you ever wondered what is the difference between the electric motors included in those two Development Kit with S12 MagniV?     MTRCKTSBNZVM128: 3-phase Sensorless BLDC Development Kit with S12 MagniV S12ZVM MTRCKTSPNZVM128: 3-phase Sensorless PMSM Development Kit with S12 MagniV MC9S12ZVML128 MCU   Well frankly writing none. They include the same motor model 45ZWN24-90       . So the motors are same from physics perspective, only the flux distribution in an air gap is different. It is sinusoidal for PMSM whereas it is trapezoidal for BLDC motor. The powerstage is same for both but what is different however is the control strategy. The Linix motor equipped with the DevKits is in fact somewhere between PMSM and BLDC, The flux is not sinusoidal nor trapezoidal.   Further information and motor parameters can be found at manufacturer product pages:                          http://www.linixmotor.com/3-3-Tool-Motor.html
View full article
Work with pushbuttons and 7 segment display. Write assembly (ASM) and C programs for the HCS12, as well as to work with the pushbuttons and 7-segment display on the Dragon12-JR board.  The programs find the largest and smallest numbers from an arbitrary list of eight 8-bit unsigned numbers and displays them on the 7-segment display as outlined in the following.   1. Write a program to do the following, in both ASM and C. Do not use MINA, MINM, MAXA, and MAXM instructions.            a. Load an array of eight 8-bit unsigned numbers into RAM.            b. Find the largest of these numbers and store it.            c. Find the smallest of these numbers and store it.            d. Wait for the pushbuttons (S1 or S2) to be pressed.            e. The first time S1 is pressed, display the high nibble of the largest number; the second time S1 is pressed, display the low nibble of the largest number.                For example, if the largest number is 0x3F, the 7-segment display should show “3” the first time S1 is pressed and “F” the second time it is pressed.            f. Do the same for S2, except use the smallest number.  2. Explain why debouncing is used with switches. Optional: Implement software debouncing for switch used above.   Hints: These are unsigned numbers that your program will be searching through.  Make sure you are using the unsigned branch instructions in your ASM code. Your TA will be changing the numbers in your array to make sure it works for arbitrary 8-bit values. Please make sure the array is somewhere near the top of your program file. For interfacing to LEDs, 7 segment Displays, and pushbuttons see the schematic and manual of your development board. The type of the 7-segment LED on the Dragon12-JR board is common anode. All cathodes are driven individually by an output port and all anodes are internally connected together. The Dragon12-JR board uses port H to drive 7-segment cathodes. Skeleton files are provided to help you complete the asseignment. The 7-segment display communicates with the board via Port H whose address is $0260 (PTH).  Its data direction (input or output) is controlled by writing to Data Direction H register whose address is $0262 (DDRH). In order for PTH to be output (i.e. displaying something), you must set DDRH to $FF first (all bits high, all bits output).  The skeleton code does this for you this time. Almost every I/O port on the board works similarly to PTH; that is, you must set the direction of data on a corresponding data direction register before writing to or reading from it. The two pushbuttons (S1 and S2) are connected to PM6 and PM7. S1à PM6, S2à PM7 A subroutine that displays the low nibble of register A is included with the skeleton ASM code. Just store a value in register A and issue jsr seg7_out to display the low nibble of A. You are required to understand how it works and to write a similar routine for the C version of your code.   This document was generated from the following discussion: Professional Way to solve this HCS12 Dragon12-JR,Work with pushbottons and 7 segment display
View full article
Here are the two utilities which can be used to calculate the following:   - PLL filter component values on HCS12 devices such as MC9S12DP256   - PLL register values on S12(X) devices such as S12XE, S12XF, S12XS, S12P and S12HY.   Both utilities come with appropriate user manuals in PDF.
View full article
S12 FAMILY DEVICES COP RECOGNITION CONSIDERATIONS SHOULD HELP YOU TO SET HW OF THE RESET PIN TO BE COP CORRECTLY RECOGNIZED The calculator can be found at S12 FAMILY DEVICES COP RECOGNITION CONSIDERATIONS - calculator.xlsx
View full article
Since there isn't a CAN based bootloader developed for S12X device family, here are s ome useful documents that might be of help for creating such bootloader:   - The AN3312 is an application note of a BootLoader that uses CAN but it is targetted for our DSC family of devices. These devices have the FlexCAN module (the silicon that handles CAN Communications is different to the one in the MC9S08DZ60). However this document can be used as a reference on how to build a loader. https://www.nxp.com/docs/en/application-note/AN3312.pdf    - Following document explains how to use the msCAN module for communications. It provides basic examples on how to send and receive data through the port. https://www.nxp.com/docs/en/application-note/AN3034.pdf    - Next document provides the source code and documentation for an assembly-written Bootloader. This software loads the code through the serial port and burns it into flash. This document can help you understand the specific details of the bootloader implementation. This code is available for a lot of S08 families included the MC9S08DZ60 device. https://www.nxp.com/docs/en/application-note/AN2295.pdf  - Serial booloader for S12(X) family: https://www.nxp.com/docs/en/application-note/AN4258.pdf    With the information in these documents you can design your loader and plan how to solve the 5 main challenges of a loader application:   ++Memory Protection++ The Boot Loader handles the non-volatile memory of the microcontroller. The developer must plan how much memory is needed for the loader and protect it. Memory protection provides a guideline of the final system memory organization. A section of memory is used for the loader and another section for the application. Applications that will be executed with a loader are affected by how the loader manages memory and interrupt vectors.   ++Burning Flash++ Programming and Erasing non-volatile memory requires special attention as the procedure must be executed in RAM. The process of handling NVM may vary between devices. We have source code that provides routines to write Flash and that solves the problem of executing in RAM.   ++Vector Redirection+ Interrupt vectors should be shared between the application and the users code. Hardware vector redirection is supported by the microcontrollers but with some limitations. It is necessary to decide how vector redirection will be implemented. Software and hardware methods can be used to redirect vectors.   ++Data Interface++ Different applications required different interfaces to receive s-record information. Serial Ports are used widely for this purpose although the bootloader implementation should allow exchanging interfaces in a simple way. For your case you want CAN interface. CAN frames support up to 8 bytes of data per frame. This requires the developer to fully design a protocol or a data structure mounted over the CAN frames to be able to send the complete frames to the device that will be reprogrammed.   ++Mode Selection++ The Boot Loader is the owner of the reset vector. Upon startup the Boot Loader should select if the User code will be executed or if the Boot Loader mode should execute. The applicaton determines the best way to select between User/Loader mode. It might be a simple GPIO or a CAN frame or any input that can be recognized by the application and Loader to be able to set the loader mode when needed. Developing a loader is not easy, but hopefully this information will be of a great help.
View full article
TIC example code, v.1.1 * The SW: * demonstrates FLASH programming as a part of application * uses adjusted routines from AN2720 * writes a few words into FLASH locations Pages FE and E0~EF may be used for data storage.   Other pages are used for program storage (see PRM file)      * tested on: HCS12X STARTER KIT * OSCCLK = 16MHz, BUSCLK = 8MHz * Reference to documentation: MC9S12XDP512V2 Rev.2.17 Original Attachment has been moved to: XDP512-FLASH-E_W-CW47.ZIP
View full article
Example code pack for S12X contains simple code examples that show how to initialize and how to use MCU module/feature.   List of examples: S12XE_PLL - include S12XE_iPLL_Calculator XDP512 - ECT measuring of period - CW45 XDP512-CAN – pack of several example codes include CAN baud rate calculator XDT256 - ECT Pulse Width - CW47 XEP100 - ATD + GPIO - CW47 XEP100 - ATD and PIT - CW47 XEP100 - ATD Continuous conversion with interrupt - CW4 XEP100 - ATD multichannel - CW46 XEP100 - ATD Single conversion - CW46 XEP100 - CAN0 - CAN1 - CW45 XEP100 - ECT 500us interval - CW47 XEP100 - ECT 500us period - CW47 XEP100 - ECT as PWM - CW47 XEP100 - PWM 8bit - CW45 XEP100 - SCI default - CW47 XEP100-SCI_change_Baudrate-CW51 XEP100-SPI-CW51.ZIP XEP100-SPI-Master-Slave XS128 - PIT - CW47 XS128 - PIT 10ms+15ms and priority - CW47 XS128 - PWM 16bit - CW47     Note: More examples for S12XE could be downloaded here: LAMA's S12XE unofficial examples
View full article
You can find here two example codes for API timer. G240-API-CW51.ZIP contains example code for trimming API timer to 10kHz (API isn't factory trimmed). G240-API+STOP-CW51.ZIP contains example code for enter to stop mode and periodical wakeup by API interrupt
View full article