JN5189

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

JN5189

712 Views
qianchihuang
Contributor III

Hello, now I want to use serial port 1 to transmit data, how should I connect the computer and JN5189 development board? The routine gives serial port 0, now I want to use serial port 1 how to use it?

0 Kudos
4 Replies

691 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

Hello @qianchihuang

Hope you are doing well.

Are you using any of the USART demo applications from the JN5189 SDK as base for your development?

Could you please confirm if you are planning to connect your device as the following picture?

EduardoZamora_0-1692057527012.png

Regards,
Eduardo.

0 Kudos

675 Views
qianchihuang
Contributor III

Hello,Eduardo

I am using USART demo applications for example. In the demo applications, USART0 is used for serial communication via FTDI USB.
Now I want TO use USART1, I do not know which pin of the TXD and RXD of USB TO UART should be connected to JN5189, and what changes should be made in the demo application to initialize USART1.

qianchihuang_0-1692068387828.jpeg

 

0 Kudos

667 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

Hi,

JN5189 USART1_TX should be routed to PIO0 and USART1_RX should be routed to PIO1. You can try the following connections:
 

EduardoZamora_0-1692135402996.png

 

You can use usart_interrupt demo application as base, and you can change the instance of USART from 0 to 1 in the macro definitions:

EduardoZamora_1-1692135402998.png

#define DEMO_USART USART1
#define DEMO_USART_IRQn USART1_IRQn
#define DEMO_USART_IRQHandler FLEXCOMM1_IRQHandler

Also, you may need to configure PIO0 as USART1_RX and PIO1 as USART1_TX in board > pin_mux.c file, inside void BOARD_InitPins() function. For example:

    const uint32_t port0_pin0_config = (/* Pin is configured as USART1_TXD */
                                        IOCON_PIO_FUNC2 |
                                        /* Selects pull-up function */
                                        IOCON_PIO_MODE_PULLUP |
                                        /* Standard mode, output slew rate control is disabled */
                                        IOCON_PIO_SLEW0_STANDARD |
                                        /* 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 disabled */
                                        IOCON_PIO_SLEW1_STANDARD |
                                        /* Open drain is disabled */
                                        IOCON_PIO_OPENDRAIN_DI |
                                        /* SSEL is disabled */
                                        IOCON_PIO_SSEL_DI);
    /* PORT0 PIN8 (coords: 11) is configured as USART1_TXD */
    IOCON_PinMuxSet(IOCON, 0U, 0U, port0_pin0_config);

    const uint32_t port0_pin1_config = (/* Pin is configured as USART1_RXD */
                                        IOCON_PIO_FUNC2 |
                                        /* Selects pull-up function */
                                        IOCON_PIO_MODE_PULLUP |
                                        /* Standard mode, output slew rate control is disabled */
                                        IOCON_PIO_SLEW0_STANDARD |
                                        /* 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 disabled */
                                        IOCON_PIO_SLEW1_STANDARD |
                                        /* Open drain is disabled */
                                        IOCON_PIO_OPENDRAIN_DI |
                                        /* SSEL is disabled */
                                        IOCON_PIO_SSEL_DI);
    /* PORT0 PIN9 (coords: 12) is configured as USART1_RXD */
    IOCON_PinMuxSet(IOCON, 0U, 1U, port0_pin1_config);

Regards,
Eduardo.

645 Views
qianchihuang
Contributor III

Hi,Eduardi

I have successfully solved this problem with the method you provided, and I now know that the pin can be configured with pin_mux.c.
With best wishes