Presentation is loading. Please wait.

Presentation is loading. Please wait.

Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All.

Similar presentations


Presentation on theme: "Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All."— Presentation transcript:

1 Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005. TM AW60 Low Level Driver Design Training Freescale Semiconductor Inc

2 TM Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005. Slide 1 Agenda Timer/PWM Module (TPM)  TPM Block Diagram  Overview of TPM Functionality  Architectural Components  Modes of Operation  Architectural Components Interface Demo Code  Implement PWM and CPWM on the AW60 EVB.

3 Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005. TM Timer/PWM Module (TPM)

4 TM Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005. Slide 3 TPM Block Diagram

5 TM Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005. Slide 4 TPM Function Overview

6 TM Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005. Slide 5 Architectural Components

7 TM Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005. Slide 6 Modes of Operation Mode, Edge and Level Selection

8 TM Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005. Slide 7 Architectural Components Interface Operation LevelFunction Name Module Levelchar TPM_Init(TPMConfig* TPMCfg); Module Events 1.void isr_TMR1_OV(void); 2.void isr_TMR2_OV(void); Channel Level 1. char TPMChnl_Init(TPMChnlConfig* TPMChnlCfg); 2. char InputCapture(UCHAR IC_Chnl,UCHAR IC_Mode,void (*CaptureEvent)(void)); 3. char OutputCompare(UCHAR OC_Chnl,UCHAR OC_Mode,UINT ChnlVal,void (*CompareEvent)(void)); 4. char PWM(UCHAR PWM_Chnl,UCHAR PWM_Mode,UINT ChnlVal,void (*PWMEvent)(void)); 5. char CPWM(UCHAR CPWM_Chnl,UCHAR CPWM_Mode,UINT ChnlVal,void (*CPWMEvent)(void)); Channel Events 1.void isr_TMR1_Chnl0(void); 2.void isr_TMR1_Chnl1(void); 3.void isr_TMR1_Chnl2(void); 4.void isr_TMR1_Chnl3(void); 5.void isr_TMR1_Chnl4(void); 6.void isr_TMR1_Chnl5(void); 7.void isr_TMR2_Chnl0(void); 8.void isr_TMR2_Chnl1(void);

9 TM Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005. Slide 8 TPM module configuration structure typedef struct TPMConfig_t { UCHAR TPM; UCHAR CPWMS; UCHAR ClkSrc; UCHAR Prescaler; UINT reg_TPMMOD; void (*TPMEvent)(void); }TPMConfig; Note: void (*TPMEvent)(void) is the function pointer pointing to user application space associated to the TPM interruption. Structure MembersDescription UCHAR TPMTPM module selection bit, 1: TPM1, 2 : TPM2 UCHAR CPWMSCPWM select bit, 1:CPWMS,0:other functions UCHAR ClkSrcTPM clock source select UCHAR Prescalerprescaler of TPM UINT reg_TPMMODthe variable in flash to store the configuration of TPMMODH:L void (*TPMEvent)(void) the function pointer points to the events invoked upon the interruption of TPM

10 TM Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005. Slide 9 TPM channel configuration structure typedef struct TPMChnlConfig_t { UCHAR Channel; UCHAR Mode; UINT reg_TPMCnV; void (*ChnlEvent)(void); }TPMChnlConfig; Structure MembersDescription UCHAR ChannelTPM channel selection, refer to the tpm_drv.h UCHAR ModeChannel mode selection, refer to the tpm_drv.h UINT reg_TPMCnVChannel value will pass to the register of TPMCnV void (*ChnlEvent)(void) Function pointer points to the events invoked upon the interruption of corresponding channel Note: void (*ChnlEvent)(void) is the function pointer pointing to user application associated to the corresponding TPM channel interruption.

11 TM Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005. Slide 10 Demo Code of TPM void main(void) { UCHAR icgmode,pt,re; EnableInterrupts; //enable interrupts /* include your code here */ /*GPIO test code */ pt = GPIO_InitPort(PORTA,&paconfig); pt = PTAD; pt = GPIO_SetPin(PORTA,PIN4); pt = PTAD; /*ICG test code*/ ICG_Init(&icgconfig); icgmode = Get_ICG_Mode(); /*TPM test code*/ re = TPM_Init(&tpm1cfg); //tpm1 module initialization re = PWM(CHNL10,CPWM_CO,200,NULL); //edge-aligned pwm,clear output on compare for(;;) { __RESET_WATCHDOG(); /* feeds the dog */ } /* loop forever */ /* please make sure that you never leave this function */ }

12 TM Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005. Slide 11 PWM Wave Capture

13 TM Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005. Slide 12 CPWM Wave Capture

14 TM Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005. Slide 13 Thanks

15 TM Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005. Slide 14 Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005.


Download ppt "Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All."

Similar presentations


Ads by Google