S32M Knowledge Base

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32M Knowledge Base

ディスカッション

ソート順:
Example Description This application demonstrates the usage FlexTimer Module in Center-Aligned PWM (CPWM) mode. The application includes S32 Design Studio projects for both devices, that uses configurations for for the IP layer only (Clocks, Port_Ip_1 and Ftm_Pwm). For more details please refer to FlexTimer Module (FTM) Usage on S32M24x and S32K14x Series.   Installation steps Software installation      S32 Design Studio for S32 Platform v.3.5      RTD for S32K1 and S32M24x version 2.0.0 including patch P01 Hardware installation      Supported boards:           - S32M24xEVB-C064           - S32K144EVK      Connections to the scope in S32M24xEVB-C064/S32K144EVK:           - ftm0_ch0 -> PTD15 (J21-2/J2-2)           - ftm0_ch1  -> PTD16 (J21-1/J2-4)           - ftm0_ch2 -> PTD0  (J60-2/J2-6)           - ftm0_ch3 -> PTD1   (J60-3/J6-2)      Debugger in S32M24xEVB-C064/S32K144EVK           - Use the On-board Debug Interface in J32/J7 Open SDA connector.   S32 Configurations Tool      Clocks Tool S32M244 and S32K144 features a complex clocking sourcing, distribution. To run a core of the S32M244/S32K144 as well as some MCU peripherals at maximum frequency 80 MHz in normal RUN mode, S32M244 is supplied externally by 16 MHz crystal (meanwhile S32K144 is supplied externally by 8 MHz crystal). This clock source supplies Phase-lock-loop (PLL), which circuit multiplies frequency by 20 in S32M244 (and by 40 in S32K144) and divides by 2 resulting 160 MHz frequency on output for both devices. PLL output is then divided by 2 to supply core and system (80 MHz), further divided by 2 and 4 to supply bus clock (40 MHz) and flash clock (20 MHz), respectively (See next Figure). Figure 1. S32M244 Clocks Configuration        Pins Tool In Pins Tool are selected the signals to use the FTM0 module as follows: Figure 2. S32M244 Pins Configuration        Peripherals Tool Below is the FTM0 configuration (the default configuration of the tabs that are not shown is used): Figure 3: FTM Hardware instance Figure 4: FTM Clock Configuration Figure 5: FTM Global Channel Configuration Figure 6: FTM PwmFtmCh   Software implementation The application software functionality perform the following instructions (see Example 1): - Initialize Clock driver. - Initialize Port driver - Initialize PWM driver - Update period for FTM0 - Update duty cycle to PWM signals Example 1. S32M244 FTM0 configured by S32 SDK int main(void) { /* Init clock */ Clock_Ip_Init(&Clock_Ip_aClockConfig[0]); /* Initialize all pins using the Port driver */ Port_Ci_Port_Ip_Init(NUM_OF_CONFIGURED_PINS_BOARD_InitPins, g_pin_mux_InitConfigArr_BOARD_InitPins); /* Initialize PWM driver */ Ftm_Pwm_Ip_Init(FTM_INSTANCE_0, &Ftm_Pwm_Ip_UserCfg0); /* Set new period for PWM Signals*/ Ftm_Pwm_Ip_UpdatePwmPeriod(FTM_INSTANCE_0, 0x5000, TRUE); /* Setup new duty cycle to PWM signals */ Ftm_Pwm_Ip_UpdatePwmChannel(FTM_INSTANCE_0, FTM_CH_0, 0x4000, 0x000, TRUE); Ftm_Pwm_Ip_UpdatePwmChannel(FTM_INSTANCE_0, FTM_CH_1, 0x3000, 0x000, TRUE); Ftm_Pwm_Ip_UpdatePwmChannel(FTM_INSTANCE_0, FTM_CH_2, 0x2000, 0x000, TRUE); Ftm_Pwm_Ip_UpdatePwmChannel(FTM_INSTANCE_0, FTM_CH_3, 0x1000, 0x000, TRUE); … }   On the oscilloscope Figure 7 shows that the ftm0_ch0 (D0), ftm0_ch1 (D1), ftm0_ch2 (D2) and ftm0_ch3 (D3) signals on the oscilloscope. Such signals have the same period aligned in the center and with different duty cycle. Figure 7: Center-Aligned PWM (CPWM) mode
記事全体を表示
Abstract This document describes how to use the FlexTimer Module on S32M24x and S32K14x series. It introduces several operational modes, including the corresponding implementation to provide reference for different applications.   Introduction S32M24x builds on the broad family of S32K14x MCUs, their tools and software by taking select MCUs from that portfolio and co-packaging them with an analog die that supports 12V power management, communications at the physical layer (CAN FD, LIN or CXPI) and the MOSFET gate drivers (6 channels). Based on the above, the FlexTimer Module (FTM) Usage on S32M24x and S32K1xx series can be addressed in same context. Therefore SW and configuration will be quite similar (if not the same) for both devices. However text will be focus on S32M24x implementation. Talking now about the FlexTimer module (FTM), it is built upon a timer with a 16-bit counter. It contains an extended set of features that meet the demands of motor control, including the signed up-counter, dead time insertion hardware, fault control inputs, enhanced triggering functionality, and initialization and polarity control.   Software implementation To simplify and accelerate an application development, embedded part of the FTM examples have been created using S32 Design studio, RTD drivers (low level part) and S32K14x/S32M24x is configured using S32 Configuration Tools, see the following figure: Figure 1: S32 Configuration Tools Regarding Peripherals Tool, it allows to configure FTM functionalities though different drivers as follows: Figure 2: FTM Drivers Once you have selected a driver, you could refer for more details to its respective User Manual in the top corner of the FTM Driver Tab: Figure 3: User Manuals for S32K1_S32M24X FTM Drivers     Project structure Project structure using S32 Design Studio and RTD for S32K14x and S32M24x version 2.0.0 contains the following components: Figure 4: Project structure     Implementation differences between S32M244 and S32K144 devices      Clocking S32M24x and S32K1xx have some spec differences regarding clocking. Additionally, S32M24xEVB-C064 is supplied externally by 16 MHz crystal, meanwhile S32K144EVK is supplied externally by 8 MHz crystal. In Clocks Tool of FTM examples both devices will be configured in Run mode and using PLL as system clock source, the same frequencies will be used for simplicity purposes as follows:      - System and Core clock -> 80MHz      - Bus clock -> 40MHz      - Flash Clock -> 20MHz Figure 5: Clocking in S32M24x devices Figure 6: Clocking in S32K1xx devices        Pinout S32K144EVK contains a S32K144HFT0VLLT MCU with LQFP 100 package and all its FTM channels are routable to at least to an external pin. Meanwhile S32M24xEVB-C064 contains a S32M244CCABWKHST MCU with LQFP 64 package and not all its FTM channels are routable to an external pin. Such is the case of the following signals: - ftm1_ch1 - ftm1_ch5 Particularly, ftm1_ch1 configuration is required to perform PWM Modulation on FTM0, but even though such channel is not routed to an external pin, such feature on FTM0 can be archived (Please refer to S32M24x/S32K14x-> PWM Modulation Implementation example).     FTM examples The FTM examples provided for S32M24x and S32K14x are listed below: • S32M24x/S32K14x -> FTM: Edge-align PWM (EPWM) mode • S32M24x/S32K14x -> FTM: Center-align PWM (CPWM) mode • S32M24x/S32K14x -> FTM: Complementary mode and dead-time insertion • S32M24x/S32K14x -> FTM: Modified Combine PWM Mode for Phase Shift • S32M24x/S32K14x -> FTM: Input capture (In progress) • S32M24x/S32K14x -> FTM: PWM Modulation Implementation • S32M24x/S32K14x -> FTM: Global time base • S32M24x/S32K14x -> FTM: Output compare (In progress)   Conclusion This document, together with the linked FTM examples, shows the simplicity and efficiency in using the S32K1xx and S32M24x MCUs for different timing applications. It allows a better understanding of the implementation of FTM functionalities, making it easy, friendly and intuitive for users as well as to properly use this module in their projects.   References S32 Design Studio for S32 Platform Real-Time Drivers (RTD) S32M2xx Data Sheet S32M24x Reference Manual S32M24XEVB S32K1xx MCU Family - Data Sheet S32K1xx MCU Family - Reference Manual S32K144EVB AN5303: Features and Operation Modes of FlexTimer Module on S32K
記事全体を表示