I want use Ctimer2 cap function to calculate PWM frequency.
I find the similar introduction, eg
[2] https://www.freesion.com/article/4997763456/ the pin is P1_9, I configure it as following code, but it can not work if I press SW3(P1_9), no Ctimer2 IRQ is trigger.
const uint32_t port1_pin9_config = (/* Pin is configured as CTIMER_INP4 */
IOCON_PIO_FUNC3 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
IOCON_PinMuxSet(IOCON, 1U, 9U, port1_pin9_config);
can anyone show a demo on LPC55S69? or fingure out what's wrong in demo2.
Solved! Go to Solution.
Hello @qingyunliu,
Demo 2 is using MCUXpresso IDE's ConfigTools, to use and routing the pin INPUTCAPTURE0; updating the code trough ConfigTools gives the following code:
if (Chip_GetVersion()==1)
{
IOCON->PIO[1][9] = ((IOCON->PIO[1][9] &
/* Mask bits to zero which are setting */
(~(IOCON_PIO_FUNC_MASK | IOCON_PIO_DIGIMODE_MASK)))
/* Selects pin function.
* : PORT19 (pin 10) is configured as CT_INP4. */
| IOCON_PIO_FUNC(PIO1_9_FUNC_ALT3)
/* Select Digital mode.
* : Enable Digital mode.
* Digital input is enabled. */
| IOCON_PIO_DIGIMODE(PIO1_9_DIGIMODE_DIGITAL));
}
else
{
IOCON->PIO[1][9] = ((IOCON->PIO[1][9] &
/* Mask bits to zero which are setting */
(~(IOCON_PIO_FUNC_MASK | IOCON_PIO_DIGIMODE_MASK)))
/* Selects pin function.
* : PORT19 (pin 10) is configured as CT_INP4. */
| IOCON_PIO_FUNC(PIO1_9_FUNC_ALT3)
/* Select Digital mode.
* : Enable Digital mode.
* Digital input is enabled. */
| IOCON_PIO_DIGIMODE(PIO1_9_DIGIMODE_DIGITAL));
}
Could you please try out modifying your pin_mux.c with the previous code?
Do not forget to modify the pin_mux.h with:
#define PIO1_9_DIGIMODE_DIGITAL 0x01u
#define PIO1_9_FUNC_ALT3 0x03u
If you are using MCUXpresso IDE, you could try using ConfigTools to do the same routing scheme than Demo 2, as follows:
Best regards, Raul.
Hello @qingyunliu,
Demo 2 is using MCUXpresso IDE's ConfigTools, to use and routing the pin INPUTCAPTURE0; updating the code trough ConfigTools gives the following code:
if (Chip_GetVersion()==1)
{
IOCON->PIO[1][9] = ((IOCON->PIO[1][9] &
/* Mask bits to zero which are setting */
(~(IOCON_PIO_FUNC_MASK | IOCON_PIO_DIGIMODE_MASK)))
/* Selects pin function.
* : PORT19 (pin 10) is configured as CT_INP4. */
| IOCON_PIO_FUNC(PIO1_9_FUNC_ALT3)
/* Select Digital mode.
* : Enable Digital mode.
* Digital input is enabled. */
| IOCON_PIO_DIGIMODE(PIO1_9_DIGIMODE_DIGITAL));
}
else
{
IOCON->PIO[1][9] = ((IOCON->PIO[1][9] &
/* Mask bits to zero which are setting */
(~(IOCON_PIO_FUNC_MASK | IOCON_PIO_DIGIMODE_MASK)))
/* Selects pin function.
* : PORT19 (pin 10) is configured as CT_INP4. */
| IOCON_PIO_FUNC(PIO1_9_FUNC_ALT3)
/* Select Digital mode.
* : Enable Digital mode.
* Digital input is enabled. */
| IOCON_PIO_DIGIMODE(PIO1_9_DIGIMODE_DIGITAL));
}
Could you please try out modifying your pin_mux.c with the previous code?
Do not forget to modify the pin_mux.h with:
#define PIO1_9_DIGIMODE_DIGITAL 0x01u
#define PIO1_9_FUNC_ALT3 0x03u
If you are using MCUXpresso IDE, you could try using ConfigTools to do the same routing scheme than Demo 2, as follows:
Best regards, Raul.