In our circuit diagram, PIN0_2 and PIN0_3 are used as serial ports. PIN0_2 and PIN0_3 are configured as USART3.But can not output messages.What should I pay attention to when configuring as usart3.Thanks.
Hi,
I think you can refer to the following code to configure the pin as uart3:
#define IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
#define IOCON_PIO_FUNC1 0x01u /*!<@brief Selects pin function 1 */
#define IOCON_PIO_INPFILT_OFF 0x0200u /*!<@brief Input filter disabled */
#define IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
#define IOCON_PIO_MODE_INACT 0x00u /*!<@brief No addition pin function */
#define IOCON_PIO_MODE_PULLUP 0x20u /*!<@brief Selects pull-up function */
#define IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
#define IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
void uart3PinAssignment(void)
{
uint32_t pin_config;
//PINs Configuration for Master
CLOCK_EnableClock(kCLOCK_Iocon);
CLOCK_EnableClock(kCLOCK_Gpio0);
// P0_2/FC3_TXD,
pin_config = (/* Pin is configured as FC3_TXD */
IOCON_PIO_FUNC1 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Input filter disabled */
IOCON_PIO_INPFILT_OFF |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
IOCON_PinMuxSet(IOCON, 0, 2, pin_config);
// P0_3/FC3_RXD,
pin_config = (/* Pin is configured as FC3_RXD */
IOCON_PIO_FUNC1 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Input filter disabled */
IOCON_PIO_INPFILT_OFF |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
IOCON_PinMuxSet(IOCON, 0, 3, pin_config);
//Reset FC3
SYSCON->PRESETCTRL[1]|=1<<14;
SYSCON->PRESETCTRL[1]&=~(1<<14);
//set gated clock of FC3
SYSCON->AHBCLKCTRL[1]|=1<<14;
//set the FC3 as spi
FLEXCOMM3->PSELID=0x01;
//set uart3 clock divider
//select 12MHz FRO_12M
SYSCON->FCLKSEL[3]=0x00;
}
Hope it can help you
BR
XiangJun Rong
Hi XiangJun Rong:
Thanks!
BR
Aifei Zhang
发件人: xiangjun.rong
发送时间: 2019年12月9日 14:01
收件人: Aifei Zhang
主题: Re: - Re: LPC54016JET100 USART3 OUTPUT PROBLEM
NXP Community <https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>
Re: LPC54016JET100 USART3 OUTPUT PROBLEM
reply from xiangjun.rong <https://community.nxp.com/people/xiangjun.rong?et=watches.email.thread> in LPC Microcontrollers - View the full discussion <https://community.nxp.com/message/1242844?commentID=1242844&et=watches.email.thread#comment-1242844>