

Hi,
1.I can use UART_init() or nrf_drv_uart_uninit() in nRF52-SDK to enable or disable UART. How can I do that in NCS?
The serial component does not have a uninit API unfortunately.
You can use the power management API, like mentioned in this thread:
https://devzone.nordicsemi.com/f/nordic-q-a/68857/low-power-mode-in-zephyr/282929#282929
Or you can disable the peripheral on a register level.
This must currently be done by stopping the TX/RX, then disable the peripheral on a register level (similar to what is shown here)
2.I changed the baud rate to 921600bps. An error occurred that caused the system to reset. I found that it is caused by k_free (buf) in ble_write_thread (). How can I solve it?
It sounds like the thread needs a bit more memory. Could you try adjusting CONFIG_BT_NUS_THREAD_STACK_SIZE and see if this helps?
3.Can I use firmware to configure an external or internal 32.768k crystal oscillator?
You can set this in kconfig, as a static parameter:
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/choice_327.html#choice-327
Kind regards,
Håkon
1.Now I can use the power management API to turn the UART on and off.
2.I set CONFIG_BT_NUS_THREAD_STACK_SIZE to 4096, but the problem still exists.
3.I want to save the setting value in flash memory and load it at startup to decide whether to use the internal or external crystal oscillator. What should I do?
1.Now I can use the power management API to turn the UART on and off.
2.I set CONFIG_BT_NUS_THREAD_STACK_SIZE to 4096, but the problem still exists.
3.I want to save the setting value in flash memory and load it at startup to decide whether to use the internal or external crystal oscillator. What should I do?
Hi,
Stanley said:2.I set CONFIG_BT_NUS_THREAD_STACK_SIZE to 4096, but the problem still exists.
Could you use arm-none-eabi-addr2line to resolv the addresses to actual functions in the faulting output?
arm-none-eabi-addr2line -e build/zephyr/zephyr.elf 0xFAULTING_ADDR
In your initial screenshot, it would be 0x1410, 0x270f0, 0x16549.
You could also check the .map file and see which thread is running at 0x20001e48.
Note that addresses change for each time you change your program.
Stanley said:3.I want to save the setting value in flash memory and load it at startup to decide whether to use the internal or external crystal oscillator. What should I do?
Unfortunately, this configuration isnt dynamic. It must be set in kconfig.
Kind regards,
Håkon