hello,
Recently,I use mpc5748g dev kit.I want to use emios_0 port 6(PA[6]--E0UC_6_G)as single output compare and
emios _1 port 28 (PC[6]--E1UC_28Y)as single input capture.And ,config the interrupt for port 28 . It does not work.But,it can work normally when the port config PWM output mode.How should I do?b55689
Ok,my config program below:
init_saic_saoc
{
eMIOS_0.MCR.B.GPREN = 0; /* Disable global pre-scaler (reset default) */
eMIOS_0.MCR.B.GPRE = 79; /* Divide 80 MHz clock to module by 80 */
eMIOS_0.MCR.B.FRZ = 0; /* No Freeze channel registers in debug mode if channel FREN=0 */
eMIOS_1.MCR.B.GPREN = 0; /* Disable global pre-scaler (reset default) */
eMIOS_1.MCR.B.GPRE = 79; /* Divide 80 MHz clock to module by 80 */
eMIOS_1.MCR.B.FRZ = 0; /* No Freeze channel registers in debug mode if channel FREN=0 */
eMIOS_UC_0.UC[23].C.R = 0x0; /* Disable channel pre-scaler (reset default) */
eMIOS_UC_0.UC[23].C.B.UCPRE = 0; /* Pre-scale channel clock by 0+1=1 */
eMIOS_UC_0.UC[23].C.B.UCPREN= 1; /* Enable pre-scaler */
eMIOS_UC_0.UC[6].C.B.BSL = 0;
eMIOS_UC_0.UC[6].C.B.EDPOL = 1;
eMIOS_UC_0.UC[6].C.B.EDSEL = 1;
eMIOS_UC_0.UC[6].C.B.MODE = 0x02;/*SAOC*/
SIUL2.MSCR[PA6].B.SSS = 1; /* Pad PA6: Source signal is E0UC_23_X */
SIUL2.MSCR[PA6].B.OBE = 1; /* Pad PA6: OBE=1. */
SIUL2.MSCR[PA6].B.SRC = 3; /* Pad PA6: Full strength slew rate */
eMIOS_UC_1.UC[23].C.R = 0x0; /* Disable channel pre-scaler (reset default) */
eMIOS_UC_1.UC[23].C.B.UCPRE = 0; /* Pre-scale channel clock by 0+1=1 */
eMIOS_UC_1.UC[23].C.B.UCPREN= 1; /* Enable pre-scaler */
eMIOS_UC_1.UC[28].C.B.BSL = 0;
eMIOS_UC_1.UC[28].C.B.EDPOL = 1;
eMIOS_UC_1.UC[28].C.B.DMA = 0;
eMIOS_UC_1.UC[28].C.B.FEN = 1;
eMIOS_UC_1.UC[28].C.B.IF = 2;
eMIOS_UC_1.UC[28].C.B.FCK = 0;
eMIOS_UC_1.UC[28].C.B.MODE = 0x03;/*SAIC*/
SIUL2.MSCR[PC6].B.SSS = 2; /* Pad PC6: Source signal is E0UC_23_X */
SIUL2.MSCR[PC6].B.IBE = 1; /* Pad PC6: IBE=1. */
SIUL2.MSCR[PC6].B.SRC = 3; /* Pad PC6: Full strength slew rate */
INTC.PSR[736].B.PRC_SELN = 0x4; /* IRQ sent to Core 1 */
INTC.PSR[736].B.PRIN =0x03;
eMIOS_0.MCR.B.GPREN = 1; /* Enable global pre-scaled clocks */
eMIOS_0.MCR.B.GTBE = 1; /* Enable global time base */
eMIOS_1.MCR.B.GPREN = 1; /* Enable global pre-scaled clocks */
eMIOS_1.MCR.B.GTBE = 1; /* Enable global time base */
}
Hi,
- if you want to use ch23 as counter A bus you need to set the MCB mode for it. So use
eMIOS_UC_0.UC[23].C.B.MODE= 0x50; // set MCB mode
eMIOS_UC_1.UC[23].C.B.MODE= 0x50; // set MCB mode
- comment SIUL2.MSCR[PC6].B.SSS setting. This is used for output functionality setting. For PC6 pin setting as input you need to set IMCR register to route PC6 to eMIOS1 ch28
SIUL2.IMCR[576-512].B.SSS = 2; /* E1UC_28_Y: connected to pad PB3 */
BR, Petr