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

uart usable after softdevice disabled?

SDK v12, SD130 on 51822.

I init uart through APP_UART_FIFO_INIT, and installed uart_event_handler. UART rx/tx with an external MCU works OK while softdevice running.

then i tried to use sd_softdevice_disable() to disable softdevice. I expect uart to work as the same. However the uart turns out not responding anymore, either not receiving or sending anything.

Is it normal? Is uart related API and event handler still usable after softdevice disabled? any specific thing need to do to keep uart running?

thank you.

  • You should be able to use the UART peripheral without having the SoftDevice enabled. DO you get any error codes from the app_uart API calls after you have disabled the SD?

  • @Daniel Wang I actually combined the ble_cscs example and the ble_uart example in SDK. The uart part of code is taken from ble_uart demo.

    And then i added some code to do uart communication with an external MCU. Why i try to disable softdevice is though the UART works OK most of time, it sometimes gives uart overrun error. I guess it has something to do with softdevice activities so i would like to disable it and see if it improves.

    @Bjørn Spockeli

    I did not get any error codes after disable the SD, as the CPU then seems to get into sleep mode, no advertising, and no log on console (i am using RTT log) and not responding anymore.

  • If the CPU was put in SYSTEM ON IDLE then as I am sure that external MCU is keeping sending data so the uart interrupt should wake CPU up? I also tried only stop advertising, instead of disable SD. the result is the same.

    So i guess the CPU was actually put into SYSTEM OFF mode some how? But i do not know why that could happen.

    PS: I forgot to mention i was running the code on custom board.

  • Yes, if you're using the UART without any flow control, then you risk overflowing the RX buffer of the UART peripheral when there is a lot of BLE activity, i.e. the SD is using the CPU and blocking the application from emptying the buffer. The CPU wont go to sleep after you have disabled the SD unless you explicitly tell it to by calling __WFI(). The CPU will also not enter SYSTEM OFF mode unless explicitly told to do so, i.e. write to the SYSTEMOFF register. Are you able to perform a logic trace with a logic analyzer or oscilloscope of the UART lines after you have disabled the SD?

Related