This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Time multiplexing UART nrf52832

Hi

I am using nRF52832 Soft device S132 sdk 15 and interfaced it with two peripherals over UART.  However I dont want to use them simultaneously. Since nrf42832 can support only one UART peripheral at a time, I would like to know how I can reconfigure the pins to establish a time mux based UART communication. Any examples related to internal pin crossbar would be highly appreciated.

Regards

Vignesh

Parents
  • You just need to change the pin numbers in PSEL.TXD and PSEL.RXD, and optionally PSEL.RTS and PSEL.CTS, at any time the UARTE is not in a transfer. 

    See f.ex. the UARTE HAL's nrf_uarte_txrx_pins_set function. 

    The pins you intend to switch to needs to be configured first:

    // Configure Tx and Rx pins:
    nrf_gpio_pin_set(NEW_TX_PIN);
    nrf_gpio_cfg_output(NEW_TX_PIN);
    nrf_gpio_cfg_input(NEW_RX_PIN, NRF_GPIO_PIN_NOPULL);
    
    nrf_uarte_txrx_pins_set(NRF_DRV_UART_INSTANCE(0), NEW_TX_PIN, NEW_RX_PIN);
    
    //If you indent to use HW Flow Control:
    nrf_gpio_pin_set(NEW_RTS_PIN);
    nrf_gpio_cfg_output(NEW_RTS_PIN);
    nrf_gpio_cfg_input(NEW_CTS_PIN, NRF_GPIO_PIN_NOPULL);
    
    nrf_uarte_hwfc_pins_set(NRF_DRV_UART_INSTANCE(0), NEW_RTS_PIN, NEW_CTS_PIN);

Reply
  • You just need to change the pin numbers in PSEL.TXD and PSEL.RXD, and optionally PSEL.RTS and PSEL.CTS, at any time the UARTE is not in a transfer. 

    See f.ex. the UARTE HAL's nrf_uarte_txrx_pins_set function. 

    The pins you intend to switch to needs to be configured first:

    // Configure Tx and Rx pins:
    nrf_gpio_pin_set(NEW_TX_PIN);
    nrf_gpio_cfg_output(NEW_TX_PIN);
    nrf_gpio_cfg_input(NEW_RX_PIN, NRF_GPIO_PIN_NOPULL);
    
    nrf_uarte_txrx_pins_set(NRF_DRV_UART_INSTANCE(0), NEW_TX_PIN, NEW_RX_PIN);
    
    //If you indent to use HW Flow Control:
    nrf_gpio_pin_set(NEW_RTS_PIN);
    nrf_gpio_cfg_output(NEW_RTS_PIN);
    nrf_gpio_cfg_input(NEW_CTS_PIN, NRF_GPIO_PIN_NOPULL);
    
    nrf_uarte_hwfc_pins_set(NRF_DRV_UART_INSTANCE(0), NEW_RTS_PIN, NEW_CTS_PIN);

Children
Related