power down/disable uart0 that is being used by the Peripheral UART sample

Hi, 

for device power managment, i want to power down/disable uart0 that is being used by the Peripheral UART sample.
it is giving errors when doing it via the .conf and overlay file as it is being used by the NUS functions? 

pm_device_state_set(dev_uart, PM_DEVICE_STATE_SUSPENDED) also does not work as it give an ASSERTION FAIL error.

any suggestions ?

Thank you

Parents
  • Hi Paul

    Are you planning to respond to the question from Vidar in the similar private case?

    for device power managment, i want to power down/disable uart0 that is being used by the Peripheral UART sample.
    it is giving errors when doing it via the .conf and overlay file as it is being used by the NUS functions? 

    If you disable the UART permanently then it will probably fail, yes, as the UART is referenced by the sample. 

    If I understand you correctly you want to use the UART occasionally, but then disable it when it is not being used in order to reduce current consumption?

    Best regards
    Torbjørn

  • @Torbjørn 

    Yes, you are correct. objective is to to reduce power/current consumption. problem maybe beacuse the BLE NUS of the peripheral uart sample is using the "uart0" in which i am having issues disabling. uart0 seems to always have to be enabled. 

    but i can disable other uart's (uart2 and uart1) easily using the PM comands: 

    rc = pm_device_state_set(dev_uart, PM_DEVICE_STATE_SUSPENDED)
    rc = pm_device_state_set(dev_uart, PM_DEVICE_STATE_OFF)
    rc = pm_device_action_run(dev_uart, PM_DEVICE_ACTION_TURN_OFF)
    but not for uart0 
    Thank you 
    Paul 
  • Hi Paul

    Have you considered using the LPUART driver?
    This is a good option if you want a low power UART driver to communicate between two Nordic devices, but if you want to communicate with a non Nordic device then it might not be compatible since it uses some additional control pins that are not a part of the UART standard. 

    As for your issue I think the problem could be related to the fact that the UART RX is enabled while you try to disable the driver. 

    I was able to disable uart0 if I made sure to disable the UART RX first. 

    I also had to comment out the handling of the UART_RX_DISABLED event, since this event simply tries to enable the RX again when the disabled event occurs. 

    With these two changes I can disable and re-enable uart0 without any crashes. 

    Best regards
    Torbjørn

Reply
  • Hi Paul

    Have you considered using the LPUART driver?
    This is a good option if you want a low power UART driver to communicate between two Nordic devices, but if you want to communicate with a non Nordic device then it might not be compatible since it uses some additional control pins that are not a part of the UART standard. 

    As for your issue I think the problem could be related to the fact that the UART RX is enabled while you try to disable the driver. 

    I was able to disable uart0 if I made sure to disable the UART RX first. 

    I also had to comment out the handling of the UART_RX_DISABLED event, since this event simply tries to enable the RX again when the disabled event occurs. 

    With these two changes I can disable and re-enable uart0 without any crashes. 

    Best regards
    Torbjørn

Children
  • @Torbjørn  

    i appreciate the support. i will try the LPUART driver and try to disable uart0 rx first. 

    another option i can think of is to totally disable/enable the Bluetooth via the application

    bt_disable/bt_enable. any thoughts on this ? 

    Thank you 

    Paul 

     

  • Hi Paul

    paul_B said:

    another option i can think of is to totally disable/enable the Bluetooth via the application

    bt_disable/bt_enable. any thoughts on this ? 

    For what purpose? To save power? 

    In later versions of the nRF Connect SDK you can use the bt_disable() function to disable the Bluetooth stack completely, yes, but this shouldn't really be necessary in order to keep power consumption low. 

    As long as you are not in an active Bluetooth connection or in advertise mode the Bluetooth stack should not draw any power. 

    Best regards
    Torbjørn

Related