Simulate BREAK for 1 second on UART TX line

Hello,

I'm trying to hold the TX line of UART0 low for 1 second. I'm using NCS 2.9.0 on an nRF5340.

Disabling UART and setting the pin directly works.

NRF_UARTE0->ENABLE = UARTE_ENABLE_ENABLE_Disabled << UARTE_ENABLE_ENABLE_Pos;

				// Drive TX pin low manually
				nrf_gpio_cfg_output(9);
				nrf_gpio_pin_clear(9); // Set TX low (break)
			
				k_sleep(K_MSEC(1000));
			
				// Restore TX pin control to UARTE
				nrf_gpio_cfg_default(9);
				NRF_UARTE0->ENABLE = UARTE_ENABLE_ENABLE_Enabled << UARTE_ENABLE_ENABLE_Pos;
				uart_irq_err_disable(mp_usb_->rx_dev);
				uart_irq_rx_disable(mp_usb_->rx_dev);
				uart_irq_err_enable(mp_usb_->rx_dev);
				uart_irq_rx_enable(mp_usb_->rx_dev);

But after reenabling, the reception of data does not work. 

The transmission of data still work as expected.

Is there a way to reinitialize UART0 completely.

Many thanks for your answers in advance.

Kind regards,

Christian

Parents Reply Children
No Data
Related