FlexIO PWM

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

FlexIO PWM

705 Views
JustMet
Contributor III

Hello

I am using Simulink model-based design to generate code so I tried 2 things
1st I add the FlexIO Uart Config file(
When I am using the FLexIo Uart Config file I am unable to use my IRQ handler it gives me the error exio_common.c:347: multiple definitions of `FLEXIO_IRQHandler'
I comment out my IRQ handler the code run without any error but without the handler my code is logicless
)
2nd I removed the FlexIO UART Config and run the code I get the error for Missing header file and to copy the header file into my code folder I went to the location but I didn't find the specific header file you can see it in the images I am sharing

Best regads,

 

Link to same question with images in same community but other section - Re: FlexIO PWM - NXP Community

0 Kudos
3 Replies

630 Views
JustMet
Contributor III

Hello,

So I updated my code, TLC and Mex file 

-> in my code now instead of using

FLEXIO_IRQHandler(FlexIo_IRQN)
i am manualy calling 
FLEXIO_IRQHandler1(uint32_t DATA),
this is also updated in TLC file so in tlc ->
 
%function Outputs(block, system) Output
%if FEVAL("mbd_s32k_is_codegen_compatible", CompiledModel.Name)
FLEXIO_IRQHandler1(%<LibBlockInputSignal(0, "", "", 0)>); %%DATA
%%<LibBlockOutputSignal(0, "", "", 0)> = returnData1(%<LibBlockInputSignal(1, "", "", 0)>); %%return Data to Output
%endif
%endfunction
 
also i am attaching the simulink model ,snapshot of tlc and s function c file with this post 
 
in the model i am taking converted data from adc block and using that data for Transmiting SENT Singnal
 
The code is working in IAR Debugger (there i have ADC function ) in simulink i am using ADC block for adc conversion
 
i am initialising the clock and FLEXIO and i am getting this error and i cant seem to understand what i am missing 
 
if i include  #include "S32K144.h" file i get the error no such file or directory so i also added this file into my code folder but same error and once i remove the include i get the following error 
 
 

driver.c:61:20: error: 'SCG_SOSCCSR_SOSCEN_MASK' undeclared (first use in this function) SCG->SOSCCSR &= ~SCG_SOSCCSR_SOSCEN_MASK; /* SOSCEN=0: System OSC is disabled */ ^~~~~~~~~~~~~~~~~~~~~~~ driver.c:64:19: warning: implicit declaration of function 'SCG_SOSCCFG_RANGE' [-Wimplicit-function-declaration] SCG->SOSCCFG = SCG_SOSCCFG_RANGE(3) | /* RANGE=3: High frequency range selected for the crystal oscillator of 8 MHz to 40 MHz */ ^~~~~~~~~~~~~~~~~ driver.c:65:19: error: 'SCG_SOSCCFG_HGO_MASK' undeclared (first use in this function) SCG_SOSCCFG_HGO_MASK | /* HGO=1: Configure crystal oscillator for high-gain operation */ ^~~~~~~~~~~~~~~~~~~~ driver.c:66:19: error: 'SCG_SOSCCFG_EREFS_MASK' undeclared (first use in this function) SCG_SOSCCFG_EREFS_MASK; /* EREFS=1: Internal oscillator of OSC requested */ ^~~~~~~~~~~~~~~~~~~~~~ driver.c:67:19: error: 'SCG_SOSCCSR_SOSCCM_MASK' undeclared (first use in this function) SCG->SOSCCSR = SCG_SOSCCSR_SOSCCM_MASK | /* SOSCCM=1: System OSC Clock Monitor is enabled */ ^~~~~~~~~~~~~~~~~~~~~~~ driver.c:71:25: error: 'SCG_SOSCCSR_SOSCVLD_MASK' undeclared (first use in this function) while((SCG->SOSCCSR & SCG_SOSCCSR_SOSCVLD_MASK) == 0){} ^~~~~~~~~~~~~~~~~~~~~~~~ driver.c: In function 'SystemPLL_setup': driver.c:77:3: error: 'SCG' undeclared (first use in this function) SCG->SPLLCSR &= ~SCG_SPLLCSR_SPLLEN_MASK; /* SPLLEN=0: System PLL is disabled */ ^~~ driver.c:77:20: error: 'SCG_SPLLCSR_SPLLEN_MASK' undeclared (first use in this function) SCG->SPLLCSR &= ~SCG_SPLLCSR_SPLLEN_MASK; /* SPLLEN=0: System PLL is disabled */ ^~~~~~~~~~~~~~~~~~~~~~~ driver.c:78:19: error: 'SCG_SPLLCSR_SPLLCM_MASK' undeclared (first use in this function) SCG->SPLLCSR |= SCG_SPLLCSR_SPLLCM_MASK; /* SPLLCM=1: System PLL Clock Monitor is enabled */ ^~~~~~~~~~~~~~~~~~~~~~~ driver.c:80:18: warning: implicit declaration of function 'SCG_SPLLCFG_PREDIV' [-Wimplicit-function-declaration] SCG->SPLLCFG = SCG_SPLLCFG_PREDIV(0) | /* PREDIV=0: Divided by 1, thus PLL Reference input is 8MHz */ ^~~~~~~~~~~~~~~~~~ driver.c:81:18: warning: implicit declaration of function 'SCG_SPLLCFG_MULT' [-Wimplicit-function-declaration] SCG_SPLLCFG_MULT(0x18); /* VCO_CLK should be 180MHz ~ 320MHz */ ^~~~~~~~~~~~~~~~ driver.c:86:25: error: 'SCG_SPLLCSR_SPLLVLD_MASK' undeclared (first use in this function) while((SCG->SPLLCSR & SCG_SPLLCSR_SPLLVLD_MASK) == 0); ^~~~~~~~~~~~~~~~~~~~~~~~ driver.c: In function 'SCG_clock_dividers_setup': driver.c:91:3: error: 'SCG' undeclared (first use in this function) SCG->RCCR = SCG_RCCR_SCS(2) | /* SCS=2: System Clock Source is SIRC */ ^~~ driver.c:91:15: warning: implicit declaration of function 'SCG_RCCR_SCS' [-Wimplicit-function-declaration] SCG->RCCR = SCG_RCCR_SCS(2) | /* SCS=2: System Clock Source is SIRC */ ^~~~~~~~~~~~ driver.c:92:15: warning: implicit declaration of function 'SCG_RCCR_DIVCORE' [-Wimplicit-function-declaration] SCG_RCCR_DIVCORE(1) | /* DIVCORE=1: Divided by 2, thus CORE/SYS_CLK frequency is 8 / 1 = 8MHz */ ^~~~~~~~~~~~~~~~ driver.c:93:15: warning: implicit declaration of function 'SCG_RCCR_DIVBUS' [-Wimplicit-function-declaration] SCG_RCCR_DIVBUS(1) | /* DIVBUS=1: Divided by 2, thus BUS_CLK frequency is 8 / 2 = 4MHz */ ^~~~~~~~~~~~~~~ driver.c:94:15: warning: implicit declaration of function 'SCG_RCCR_DIVSLOW' [-Wimplicit-function-declaration] SCG_RCCR_DIVSLOW(2); /* DIVSLOW=2: Divided by 3, thus FLASH_CLK is 8 / 3 = 2.67MHz */ ^~~~~~~~~~~~~~~~ driver.c: In function 'Platform_setup': driver.c:104:3: error: 'LMEM' undeclared (first use in this function) LMEM->PCCCR = LMEM_PCCCR_GO_MASK | /* Initiate Cache Command */ ^~~~ driver.c:104:17: error: 'LMEM_PCCCR_GO_MASK' undeclared (first use in this function) LMEM->PCCCR = LMEM_PCCCR_GO_MASK | /* Initiate Cache Command */ ^~~~~~~~~~~~~~~~~~ driver.c:105:17: error: 'LMEM_PCCCR_INVW1_MASK' undeclared (first use in this function) LMEM_PCCCR_INVW1_MASK | /* Invalidate all lines in way 1 */ ^~~~~~~~~~~~~~~~~~~~~ driver.c:106:17: error: 'LMEM_PCCCR_INVW0_MASK' undeclared (first use in this function) LMEM_PCCCR_INVW0_MASK | /* Invalidate all lines in way 0 */ ^~~~~~~~~~~~~~~~~~~~~ driver.c:108:17: error: 'LMEM_PCCCR_ENCACHE_MASK' undeclared (first use in this function) LMEM_PCCCR_ENCACHE_MASK; /* Cache enabled */ ^~~~~~~~~~~~~~~~~~~~~~~ driver.c: In function 'Flexio_PWM_setup': driver.c:113:3: error: 'SCG' undeclared (first use in this function) SCG->SOSCDIV |= SCG_SOSCDIV_SOSCDIV2(4); /* SOSCDIV2=4: Divided by 8, thus 8 / 8 = 1MHz */ ^~~ driver.c:113:19: warning: implicit declaration of function 'SCG_SOSCDIV_SOSCDIV2' [-Wimplicit-function-declaration] SCG->SOSCDIV |= SCG_SOSCDIV_SOSCDIV2(4); /* SOSCDIV2=4: Divided by 8, thus 8 / 8 = 1MHz */ ^~~~~~~~~~~~~~~~~~~~ driver.c:114:3: error: 'PCC' undeclared (first use in this function) PCC->PCCn[PCC_FLEXIO_INDEX] &= ~PCC_PCCn_CGC_MASK; /* Disable clock to change PCS */ ^~~ driver.c:114:13: error: 'PCC_FLEXIO_INDEX' undeclared (first use in this function) PCC->PCCn[PCC_FLEXIO_INDEX] &= ~PCC_PCCn_CGC_MASK; /* Disable clock to change PCS */ ^~~~~~~~~~~~~~~~ driver.c:114:35: error: 'PCC_PCCn_CGC_MASK' undeclared (first use in this function) PCC->PCCn[PCC_FLEXIO_INDEX] &= ~PCC_PCCn_CGC_MASK; /* Disable clock to change PCS */ ^~~~~~~~~~~~~~~~~ driver.c:115:35: error: 'PCC_PCCn_PCS_MASK' undeclared (first use in this function) PCC->PCCn[PCC_FLEXIO_INDEX] &= ~PCC_PCCn_PCS_MASK; /* Temporarily clear PCS */ ^~~~~~~~~~~~~~~~~ driver.c:116:34: warning: implicit declaration of function 'PCC_PCCn_PCS' [-Wimplicit-function-declaration] PCC->PCCn[PCC_FLEXIO_INDEX] |= PCC_PCCn_PCS(1); /* PCS=1: Select SOSCDIV2_CLK */ ^~~~~~~~~~~~ driver.c:120:3: error: 'FLEXIO' undeclared (first use in this function) FLEXIO->SHIFTCTL[0] = FLEXIO_SHIFTCTL_SMOD(2) | /* 2: Transmit mode. Load SHIFTBUF contents into the Shifter on expiration of the Timer */ ^~~~~~ driver.c:120:25: warning: implicit declaration of function 'FLEXIO_SHIFTCTL_SMOD' [-Wimplicit-function-declaration] FLEXIO->SHIFTCTL[0] = FLEXIO_SHIFTCTL_SMOD(2) | /* 2: Transmit mode. Load SHIFTBUF contents into the Shifter on expiration of the Timer */ ^~~~~~~~~~~~~~~~~~~~ driver.c:121:25: warning: implicit declaration of function 'FLEXIO_SHIFTCTL_PINPOL' [-Wimplicit-function-declaration] FLEXIO_SHIFTCTL_PINPOL(0) | /* 0: Pin is active high */ ^~~~~~~~~~~~~~~~~~~~~~ driver.c:122:25: warning: implicit declaration of function 'FLEXIO_SHIFTCTL_PINSEL' [-Wimplicit-function-declaration] FLEXIO_SHIFTCTL_PINSEL(0) | /* 1: Select the FXIO_D0 pin */ ^~~~~~~~~~~~~~~~~~~~~~ driver.c:123:25: warning: implicit declaration of function 'FLEXIO_SHIFTCTL_PINCFG' [-Wimplicit-function-declaration] FLEXIO_SHIFTCTL_PINCFG(0) | /* 0: Shifter pin output disabled */ ^~~~~~~~~~~~~~~~~~~~~~ driver.c:124:25: warning: implicit declaration of function 'FLEXIO_SHIFTCTL_TIMPOL' [-Wimplicit-function-declaration] FLEXIO_SHIFTCTL_TIMPOL(1) | /* 1: Shift on negedge of Shift clock */ ^~~~~~~~~~~~~~~~~~~~~~ driver.c:125:25: warning: implicit declaration of function 'FLEXIO_SHIFTCTL_TIMSEL' [-Wimplicit-function-declaration] FLEXIO_SHIFTCTL_TIMSEL(0); /* 0: Select Timer 0 */ ^~~~~~~~~~~~~~~~~~~~~~ driver.c:127:25: warning: implicit declaration of function 'FLEXIO_SHIFTCFG_SSTART' [-Wimplicit-function-declaration] FLEXIO->SHIFTCFG[0] = FLEXIO_SHIFTCFG_SSTART(0) | /* 0: Start bit disabled for transmitter/receiver/match store, transmitter loads data on enable */ ^~~~~~~~~~~~~~~~~~~~~~ driver.c:128:25: warning: implicit declaration of function 'FLEXIO_SHIFTCFG_SSTOP' [-Wimplicit-function-declaration] FLEXIO_SHIFTCFG_SSTOP(0) | /* 0: Stop bit disabled for transmitter/receiver/match store */ ^~~~~~~~~~~~~~~~~~~~~ driver.c:129:25: warning: implicit declaration of function 'FLEXIO_SHIFTCFG_INSRC' [-Wimplicit-function-declaration] FLEXIO_SHIFTCFG_INSRC(0); /* 0: Pin */ ^~~~~~~~~~~~~~~~~~~~~ driver.c:133:23: warning: implicit declaration of function 'FLEXIO_TIMCFG_TSTART' [-Wimplicit-function-declaration] FLEXIO->TIMCFG[0] = FLEXIO_TIMCFG_TSTART(0) | /* 0: Start bit disabled */ ^~~~~~~~~~~~~~~~~~~~ driver.c:134:23: warning: implicit declaration of function 'FLEXIO_TIMCFG_TSTOP' [-Wimplicit-function-declaration] FLEXIO_TIMCFG_TSTOP(0) | /* 0: Stop bit disabled */ ^~~~~~~~~~~~~~~~~~~ driver.c:135:23: warning: implicit declaration of function 'FLEXIO_TIMCFG_TIMENA' [-Wimplicit-function-declaration] FLEXIO_TIMCFG_TIMENA(2) | /* 2: Timer enabled on Trigger high */ ^~~~~~~~~~~~~~~~~~~~ driver.c:136:23: warning: implicit declaration of function 'FLEXIO_TIMCFG_TIMDIS' [-Wimplicit-function-declaration] FLEXIO_TIMCFG_TIMDIS(0) | /* 0: Timer never disabled */ ^~~~~~~~~~~~~~~~~~~~ driver.c:137:23: warning: implicit declaration of function 'FLEXIO_TIMCFG_TIMRST' [-Wimplicit-function-declaration] FLEXIO_TIMCFG_TIMRST(0) | /* 0: Timer never reset */ ^~~~~~~~~~~~~~~~~~~~ driver.c:138:23: warning: implicit declaration of function 'FLEXIO_TIMCFG_TIMDEC' [-Wimplicit-function-declaration] FLEXIO_TIMCFG_TIMDEC(0) | /* 0: Decrement counter on FlexIO clock, Shift clock equals Timer output */ ^~~~~~~~~~~~~~~~~~~~ driver.c:139:23: warning: implicit declaration of function 'FLEXIO_TIMCFG_TIMOUT' [-Wimplicit-function-declaration] FLEXIO_TIMCFG_TIMOUT(2); /* 2: Timer output is logic one when enabled and on timer reset */ ^~~~~~~~~~~~~~~~~~~~ driver.c:141:23: warning: implicit declaration of function 'FLEXIO_TIMCTL_TIMOD' [-Wimplicit-function-declaration] FLEXIO->TIMCTL[0] = FLEXIO_TIMCTL_TIMOD(2) | /* 2: Dual 8-bit counters PWM mode */ ^~~~~~~~~~~~~~~~~~~ driver.c:142:23: warning: implicit declaration of function 'FLEXIO_TIMCTL_PINPOL' [-Wimplicit-function-declaration] FLEXIO_TIMCTL_PINPOL(0) | /* 0: Pin is active high */ ^~~~~~~~~~~~~~~~~~~~ driver.c:143:23: warning: implicit declaration of function 'FLEXIO_TIMCTL_PINSEL' [-Wimplicit-function-declaration] FLEXIO_TIMCTL_PINSEL(1) | /* 1: Select the FXIO_D1 pin */ ^~~~~~~~~~~~~~~~~~~~ driver.c:144:23: warning: implicit declaration of function 'FLEXIO_TIMCTL_PINCFG' [-Wimplicit-function-declaration] FLEXIO_TIMCTL_PINCFG(3) | /* 3: Timer pin output */ ^~~~~~~~~~~~~~~~~~~~ driver.c:145:23: warning: implicit declaration of function 'FLEXIO_TIMCTL_TRGSRC' [-Wimplicit-function-declaration] FLEXIO_TIMCTL_TRGSRC(1) | /* 1: Internal trigger selected */ ^~~~~~~~~~~~~~~~~~~~ driver.c:146:23: warning: implicit declaration of function 'FLEXIO_TIMCTL_TRGPOL' [-Wimplicit-function-declaration] FLEXIO_TIMCTL_TRGPOL(1) | /* 1: Trigger active low */ ^~~~~~~~~~~~~~~~~~~~ driver.c:147:23: warning: implicit declaration of function 'FLEXIO_TIMCTL_TRGSEL' [-Wimplicit-function-declaration] FLEXIO_TIMCTL_TRGSEL(1); /* 1: 4*N+1 - Shifter N(0) status flag */ ^~~~~~~~~~~~~~~~~~~~ driver.c:155:21: warning: implicit declaration of function 'FLEXIO_TIMIEN_TEIE' [-Wimplicit-function-declaration] FLEXIO->TIMIEN |= FLEXIO_TIMIEN_TEIE(1); /* Timer Status Flag interrupt is enabled */ ^~~~~~~~~~~~~~~~~~ driver.c:156:19: error: 'FLEXIO_CTRL_FLEXEN_MASK' undeclared (first use in this function) FLEXIO->CTRL |= FLEXIO_CTRL_FLEXEN_MASK; /* Enable FlexIO */ ^~~~~~~~~~~~~~~~~~~~~~~ driver.c:160:13: error: 'PCC_PORTD_INDEX' undeclared (first use in this function) PCC->PCCn[PCC_PORTD_INDEX] |= PCC_PCCn_CGC_MASK; /* CGC=1: Clock enabled for PORTD */ ^~~~~~~~~~~~~~~ driver.c:161:3: error: 'PORTD' undeclared (first use in this function) PORTD->PCR[1] &= ~PORT_PCR_MUX_MASK; /* Set MUX=0 temporarily */ ^~~~~ driver.c:161:21: error: 'PORT_PCR_MUX_MASK' undeclared (first use in this function) PORTD->PCR[1] &= ~PORT_PCR_MUX_MASK; /* Set MUX=0 temporarily */ ^~~~~~~~~~~~~~~~~ driver.c:162:20: warning: implicit declaration of function 'PORT_PCR_MUX' [-Wimplicit-function-declaration] PORTD->PCR[1] |= PORT_PCR_MUX(6); /* MUX=4: Select FXIO_D1 on PTD1 */ ^~~~~~~~~~~~ driver.c: In function 'FLEXIO_IRQHandler1': driver.c:171:7: error: 'FLEXIO' undeclared (first use in this function) if( FLEXIO->TIMSTAT & FLEXIO_TIMSTAT_TSF_MASK ) ^~~~~~ driver.c:171:25: error: 'FLEXIO_TIMSTAT_TSF_MASK' undeclared (first use in this function) if( FLEXIO->TIMSTAT & FLEXIO_TIMSTAT_TSF_MASK ) ^~~~~~~~~~~~~~~~~~~~~~~ driver.c:173:24: warning: implicit declaration of function 'FLEXIO_TIMSTAT_TSF' [-Wimplicit-function-declaration] FLEXIO->TIMSTAT |= FLEXIO_TIMSTAT_TSF(0x1); /* Write 1 to clear TSF flag */ ^~~~~~~~~~~~~~~~~~

 

MEX.pngSENT tx.pngTLC.png

0 Kudos

665 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @JustMet ,

Could you please have a look first at the examples we provide together with our toolbox related to the FlexIO UART, and try one of the examples there on your setup?

For example you could start with fxio_uart_hello_world_s32k14x example 

mariuslucianand_0-1658476388480.png

If you are still unable to build your example, and still facing errors, could you please send me your example?

Hope this helps,

Marius

0 Kudos

659 Views
JustMet
Contributor III

hello @mariuslucianand 

Yes, I can build examples on my setup I think it's my error on tlc file. I am trying to transmit SENT Signal from PTD0 PTD1 currently and later want to use multiple blocks to transmit SENT signal from all available FLEXIO Tx pins.

0 Kudos