Getting Started with the S12ZVC Platform S12 MagniV Mixed-Signal MCU for CAN Applications TM External Use Agenda • Introduction • Features • Block diagram • Device pinouts • Special modules/peripherals − VREG, HSCAN − SENT − 16-bit timer, 16-bit PWM − DAC, ACMP • Security • Resets TM External Use | 1 Agenda • There are hands-on exercises for CAN, Timer, PWM, and DAC modules • For executing the hands-on exercises you will need: − An S12ZVC evaluation board − PC with CodeWarrior 10.5 or newer − Oscilloscope • (optional) Please refer to the companion folder “S12ZVC_Getting_Started_exercises” for access to the files needed for the CodeWarrior exercises TM External Use | 2 Introduction • The MC9S12ZVC family is a new member of the S12 MagniV product line integrating a battery level (12 V) voltage regulator, supply voltage monitoring, high voltage inputs and a CAN physical interface • Primarily targeted at CAN nodes like sensors, switch panels or small actuators • ffers various low-power modes and wake up management to address state of the art power consumption requirements • The S12ZVC integration and features can also address high-reliability industrial applications • Offered for high temperature applications • AEC-Q100 Grade 0 (-40 °C to +150 °C ambient operating temperature range) • Enhanced performance, linear address space S12Z core • Integrates several key system components into a single device • Optimizes system architecture, achieves significant space and BOM savings TM External Use | 3 Features • 64 or 48 pin LQFP-EP • S12Z core • 192, 128, or 64 • 32 MHz bus frequency under 150°C, 2MHz over 150°C • 1 to 2 kB of ECC EEPROM • 4 to 8 kB of ECC RAM • Physical layer for HSCAN • 2x high voltage inputs • Up to 2x SCI, 2x SPI, 1 IIC, SENT transmitter • 4 to 8 16-bit timer channels (20 ns resolution) TM External Use | 4 Features (cont.) • Four 16-bit PWM channels (20 ns resolution) • 10 to 16 ADC channels • 8-bit DAC • 2x Analog comparator • 5 to 10 open drain 5V GPIO • 4 pins with 25 mA sink capability • 28 to 42 GPIO TM External Use | 5 Block diagram TM External Use | 6 Device pinouts TM External Use | 7 Device pinouts (cont.) TM External Use | 8 Special modules/peripherals • The S12VC device is perfect for functioning as a general purpose CAN node, and it maximizes cost and space savings by having integrated several system components such as: − 12 V voltage regulator − CAN physical interface − SENT transmitter − 16-bit timers and PWM − Digital to analog converter (DAC) − Analog comparator (ACMP) TM External Use | 9 S12ZVC VREG Automotive voltage regulator TM External Use | 10 VREG • Allows the designer to connect the automotive battery directly to the device voltage regulator • VSUP pin can be routed via an internal divider to the internal ADC for monitoring • VSUP can also be routed to a comparator to generate high or low voltage interrupts to the MCU TM External Use | 11 S12ZVC CAN physical layer TM External Use | 12 CAN physical layer • • • • The CAN physical layer provides a physical layer for high-speed CAN area network communication in automotive applications It serves as an integrated interface to the CAN bus lines for the internally connected MSCAN controller through the pins CANH, CANL and SPLIT The CAN Physical Layer is designed to meet the CAN physical layer ISO 11898-2 and ISO 11898-5 standards It provides these distinctive features: − High-speed CAN interface (up to 1 Mbit/s baud rate) − ISO 11898-2 and ISO 11898-5 compliant for 12V battery systems − SPLIT pin driver for bus recessive level stabilization − Low-power mode with remote CAN wake up − Configurable wake up pulse filtering − Over current shutdown − Voltage monitoring TM External Use | 13 CAN physical layer (cont.) TM External Use | 14 CAN hands-on exercise S12ZVC_Getting_Started_exercise/CAN TM External Use | 15 CAN hands-on exercise • An oscilloscope or a CAN tool is needed for this exercise: 1. Create a new project in CodeWarrior 2. Add the CAN code 3. Download / debug the code 4. Run the code 5. Use an oscilloscope or a CAN tool to verify the CAN message frame is being sent 6. Modify the CAN message and the CAN ID of the frame being sent; verify them on an oscilloscope or CAN tool TM External Use | 16 CAN hands-on exercise (step 1) • Create a new project in CodeWarrior 1. File -> New -> Bareboard Project 2. Name the project, click next 3. Select device: S12Z -> S12ZVC Family -> MC9S12ZVC192 4. Debug connection: Select “Open Source BDM” 5. Build options are left as default, click next 6. Rappid is not used, click Finish TM External Use | 17 CAN hands-on exercise (step 1) TM External Use | 18 CAN hands-on exercise (step 1) TM External Use | 19 CAN hands-on exercise (step 1) TM External Use | 20 CAN hands-on exercise (step 1) TM External Use | 21 CAN hands-on exercise (step 1) TM External Use | 22 CAN hands-on exercise (step 1) TM External Use | 23 CAN hands-on exercise (step 2) • Add the CAN code 1. Open “S12ZVC_Getting_Started_exercises/Labs/CAN” 2. Open “CAN.c” 3. Copy all the code 4. Go back to CodeWarrior 5. Open “main.c” 6. Replace all the code TM External Use | 24 CAN hands-on exercise (step 3, 4) • Download/debug the code and run it TM External Use | 25 CAN hands-on exercise (step 5) • Use an oscilloscope or a CAN tool to verify the CAN message frame is being sent TM External Use | 26 CAN hands-on exercise (step 6) • Modify the CAN message and the CAN ID of the frame being sent; verify them on an oscilloscope or CAN tool TM External Use | 27 S12ZVC Timer module TM External Use | 28 16-bit timer • The basic scalable timer consists of a 16-bit, software-programmable counter driven by a flexible programmable prescaler • This timer can be used for many purposes, including input waveform measurements while simultaneously generating an output waveform • Pulse widths can vary from microseconds to many seconds • Up to five channels available • All channels have input capture and output compare functionality • Clock pre-scaling • 16-bit counter • 16-bit pulse accumulator on channel 7 TM External Use | 29 16-bit timer (cont.) TM External Use | 30 Timer hands-on exercise S12ZVC_Getting_Started_exercises/Timer TM External Use | 31 Timer hands-on exercise 1. Create a new project in CodeWarrior 2. Add the timer code 3. Download / Debug the code 4. Notice the LED blinks about once per second; modify the prescaler so that the LED blinks faster TM External Use | 32 Timer hands-on exercise (step 1) • Create a new project in CodeWarrior 1. File -> New -> Bareboard Project 2. Name the project, click next 3. Select device: S12Z -> S12ZVC Family -> MC9S12ZVC192 4. Debug connection: Select “Open Source BDM” 5. Build options are left as default, click next 6. Rappid is not used, click Finish TM External Use | 33 Timer hands-on exercise (step 2) • Add the timer code 1. Open “S12ZVC_Getting_Started_exercises/Labs/TIM” 2. Open “TIM.c” 3. Copy all the code 4. Go back to CodeWarrior 5. Open “main.c” 6. Replace all the code TM External Use | 34 Timer hands-on exercise (step 3) • Download/debug the code TM External Use | 35 Timer hands-on exercise (step 4) • Notice the LED blinks about once per second; modify the prescaler so that the LED blinks at a different period TM External Use | 36 S12ZVC PWM module Pulse Width Modulation TM External Use | 37 16-bit PWM • Up to eight independent PWM channels scalable in pairs • Programmable period and duty cycle independently for each channel • Dedicated counter for each PWM channel • Programmable enable/disable PWM for each channel • Selection of pulse polarity for each channel • Double buffered period and duty cycle changes • Option of center or left aligned output for each individual channel • Choose eight 8-bit channels or four 16-bit channels TM External Use | 38 16-bit PWM (cont.) TM External Use | 39 PWM hands-on exercise S12ZVC_Getting_Started_exercises/PWM TM External Use | 40 16-bit PWM hands-on exercise 1. Create a new project in CodeWarrior 2. Add the PWM code 3. Download/debug the code 4. Notice the LED brightness 5. Change the code so that the LED brightness is: − Fully on (100% duty cycle) − Very low (20% duty cycle) − About half (50% duty cycle) TM External Use | 41 16-bit PWM hands-on exercise (step 1) • Create a new project in CodeWarrior 1. File -> New -> Bareboard Project 2. Name the project, click next 3. Select device: S12Z -> S12ZVC Family -> MC9S12ZVC192 4. Debug connection: Select “Open Source BDM” 5. Build options are left as default, click next 6. Rappid is not used, click Finish TM External Use | 42 16-bit PWM hands-on exercise (step 2) • Add the PWM code 1. Open “S12ZVC_Getting_Started_exercises/Labs/PWM” 2. Open “PWM.c” 3. Copy all the code 4. Go back to CodeWarrior 5. Open “main.c” 6. Replace all the code TM External Use | 43 16-bit PWM hands-on exercise (step 3) • Download/debug the code TM External Use | 44 16-bit PWM hands-on exercise (step 4, 5) • Notice the LED brightness; change the code so that the LED brightness is different TM External Use | 45 S12ZVC DAC module Digital to analog converter TM External Use | 46 DAC • Digital to analog converter with: −8 bit resolution − Full or reduced output voltage range options − Buffered or unbuffered analog output voltage options − Operational amplifier can also be used standalone TM External Use | 47 DAC TM External Use | 48 DAC hands-on exercise S12ZVC_Getting_Started_exercises/DAC TM External Use | 49 DAC hands-on exercise • An oscilloscope is needed for this exercise 1. Create a new project in CodeWarrior 2. Add the DAC code 3. Download/debug the code 4. Monitor the DAC output in an oscilloscope; notice the ramp signal 5. Change the code so that the output signal is: A faster ramp signal A ramp down signal A pyramid signal (ramp up then down periodically) TM External Use | 50 DAC hands-on exercise (step 1) • Create a new project in CodeWarrior 1. File -> New -> Bareboard Project 2. Name the project, click next 3. Select device: S12Z -> S12ZVC Family -> MC9S12ZVC192 4. Debug connection: Select “Open Source BDM” 5. Build options are left as default, click next 6. Rappid is not used, click Finish TM External Use | 51 DAC hands-on exercise (step 2) • Add the DAC code 1. Open “S12ZVC_Getting_Started_exercises/Labs/DAC” 2. Open “DAC.c” 3. Copy all the code 4. Go back to CodeWarrior 5. Open “main.c” 6. Replace all the code TM External Use | 52 DAC hands-on exercise (step 3) • Download/debug code TM External Use | 53 DAC hands-on exercise (step 4) • Monitor the DAC output in an oscilloscope; notice the ramp signal DAC output is PAD9 (alternate function). Remove PAD9 jumper and connect an oscilloscope to the pin on the left. TM External Use | 54 DAC hands-on exercise (step 5) • Change the code so that the output signal is a different type of signal TM External Use | 55 S12ZVC ACMP module Analog comparator TM External Use | 56 ACMP • The ACMP offers the following features: −0 V to VDDA rail to rail inputs − Low offset − Inputs to the comparator can be internal or external − Selectable hysteresis − Selectable interrupt on rising, falling or both edges − Output − Can can be made external with selectable polarity be used to trigger input capture events TM External Use | 57 ACMP TM External Use | 58 Security • The security features of the S12Z chip family are: − Prevent external access of the non-volatile memories content − Restrict execution of NVM commands TM External Use | 59 Resets • The following resets sources are available: − Power − Low on reset (POR) voltage reset (LVR) − External − Clock − COP pin reset monitor reset watchdog reset TM External Use | 60 More S12ZVC resources • Product summary page − www.freescale.com/S12ZVC • Application notes: − AN4975: Using MSCAN on the MagniV Family − AN4851: Using the Timer and PWM in the S12ZVC − AN4852: Using the SEND transmitter module in the S12ZVC TM External Use | 61 TM www.Freescale.com © 2015 Freescale Semiconductor, Inc. | External Use