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

Can I change the clock frequency on-the-fly given a UART command?

Hi everyone

I am trying to understand if it 's possible to change the clock frequency on-the-fly, by giving a certain command to the uC via UART.

I started from the ble_app_uart example (I am working with nrf52832, SD 132). I think that the function that I should handle is the following one:

ret_code_t nrf_drv_uart_rx(uint8_t * p_data, uint8_t length)

since it is described as the function for receiving data over UART

Has someone some ideas?

Thank you for your help!

Parents
  • Hi

    You cannot change the system clock frequency at all on the nRF52. The system is running on 64 MHz and the peripherals at 16MHz. There is no way to change that.

    If you are talking about changing the UART baud rate on the other hand, it is no problem to change it on-the-fly. Just close the UART, reconfigure it, and initialize it again with new settings.

    nrf_drv_uart_rx() is used to receive data over wired UART. I.e. data received on the GPIO pins on the chip. When you receive data over BLE it is processed in the function nus_data_handler() in main.c. You can see that the incoming data is printed to the wired UART by calling app_uart_put(). You can do whatever you want with the data in the function.

    PS:

    • "nrf_drv_" signifies that the function belongs to a hardware module driver.

    • "app_" signifies that the function belongs to a library.

Reply
  • Hi

    You cannot change the system clock frequency at all on the nRF52. The system is running on 64 MHz and the peripherals at 16MHz. There is no way to change that.

    If you are talking about changing the UART baud rate on the other hand, it is no problem to change it on-the-fly. Just close the UART, reconfigure it, and initialize it again with new settings.

    nrf_drv_uart_rx() is used to receive data over wired UART. I.e. data received on the GPIO pins on the chip. When you receive data over BLE it is processed in the function nus_data_handler() in main.c. You can see that the incoming data is printed to the wired UART by calling app_uart_put(). You can do whatever you want with the data in the function.

    PS:

    • "nrf_drv_" signifies that the function belongs to a hardware module driver.

    • "app_" signifies that the function belongs to a library.

Children
No Data
Related