Hi,
Thanks for your response.
You need to ensure that signal lines are either disconnected
I am thinking to use a tri-state buffer IC to isolate the UART lines. The buffer IC is 74LVC126APW,118 (https://assets.nexperia.com/documents/data-sheet/74LVC126A.pdf). Will you suggest this?
put into a suitable state.
Can this be done in nrf52832 code? If yes, please share some references on this.
Thanks for the help.
Regards
Kamran
Hi,
The suitable state would be to set the pins that are connected to rx and tx as GPIO Input and disconnect the input buffer. You can do this by writing to the appropriate PIN_CNF[N] register.
regards
Jared
Hi,
I want to configure RX and TX as GPIO and then to disconnect the input buffer, I am using the following functions:
nrf_gpio_cfg_input(rx_pin, NRF_GPIO_PIN_NOPULL); -->> this is to configure as input
nrf_gpio_input_disconnect(rx_pin); -->> this is used to disconnect the buffer
nrf_gpio_cfg_watcher(rx_pin); -->> this is used to enable input again on rx and tx lines. it is used when i want to enable the UART lines.
But it does not work.
Any suggestions?
NOTE: earlier I mentioned that I am switching off nrf52832. But now I have dropped that method and the aim here is to disable UART lines after the communication is complete. And enable UART again when needed via an interrupt pin (this interrupt pin I working fine.)
Thanks
But it does not work.
Any suggestions?
Yes I suggest you explain properly what "But it does not work" means.
Yes sure.
Setup: one nrf52832 Development board.
Content of main()
int main(void)
{
log_init(); timer_init(); uart_init();
db_discovery_init(); power_management_init();
ble_stack_init(); gatt_init(); nus_c_init(); scan_init();
gpio_init();
nrf_gpio_input_disconnect(8); // disconnect RX
nrf_gpio_input_disconnect(6); // disconnect TX
app_timer_init();
app_timer_create(&testtimer,APP_TIMER_MODE_SINGLE_SHOT,timerfunction);
for (;;)
{
idle_state_handle();
}
}
I have configured an interrupt on PIN 11 and a one-shot timer (of 5 sec ) is started once interrupt is received.
Interrupt callback function:
void in_pin_handler1(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
nrf_gpio_cfg_watcher(8); // Enable RX
nrf_gpio_cfg_watcher(6); // Enable TX
printf("BLE");
scan_start();
app_timer_start(testtimer, 5*32768, NULL);
}
Timer callback function:
static void timerfunction(void * p_context)
{
UNUSED_PARAMETER(p_context);
nrf_gpio_input_disconnect(8); // Disconnect RX
nrf_gpio_input_disconnect(6); // Disconnect TX
nrf_ble_scan_stop();
printf("\r\n");
}
In the above setup: the UART lines should only active when the timer is running for 5 seconds after receiving interrupts. But the UART lines are always active.
To know the state of UART lines:
In the function :
uart_event_handle(app_uart_evt_t * p_event)
I have included a printf statement. (printf("uart_event_handle"))
The above print statement should only get executed while the timer is running but no matter if the timer is running or not, I always get the print statement if i send some data to nrf.
Hope it clarifies the issue
maybe just turn off external UART interface and set pin to low
turn off external UART interface
Do you mean NRF's UART? How to do this for NRF?
turn off external UART interface
Do you mean NRF's UART? How to do this for NRF?