Support time sync on nRF52833 DK

This commit is contained in:
Matthias Ringwald
2025-01-10 17:47:28 +01:00
parent 066fe6201b
commit dd84f76b59
4 changed files with 49 additions and 6 deletions

View File

@@ -10,9 +10,9 @@ set(SRCS
)
if (CONFIG_SOC_COMPATIBLE_NRF52X)
MESSAGE(FATAL_ERROR "nRF52 SoC series not supported yet")
target_sources(app PRIVATE src/controller_time_nrf52.c)
elseif (CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP)
target_sources(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/audio_sync_timer_rtc.c)
target_sources(app PRIVATE src/audio_sync_timer_rtc.c)
elseif (CONFIG_SOC_SERIES_NRF54LX OR CONFIG_SOC_SERIES_NRF54HX)
target_sources(app PRIVATE src/controller_time_nrf54.c)
else()

View File

@@ -15,6 +15,39 @@ It has been tested on the nRF5340 Audio DK, but it should work with any nRF5340
- Response: HCI Command Complete Event with status and 4 bytes timestamp in microseconds
## nRF58233 Development Kit
The first Virtual UART (UART1, ...) is Zephyr UART 0
The second Virtual UART (UART2, ...) is Zephyr UART 1
### Pinout
Signal direction as seen from the nRF52833.
| PIN | Arduino | MCU | Direction |
|----------|---------|-------|-----------|
| TX | D0 | P0.05 | out |
| RX | D1 | P0.06 | in |
| RTS | D7 | P0.07 | out |
| CTS | D8 | P0.08 | in |
| Time Sync| D10 | P1.01 | out |
### HCI over UART 0 connected to first Virtual UART in J-Link Probe
Release build:
```sh
west build --pristine -b nrf52833dk/nrf52833
```
Debug build:
```sh
west build --pristine -b nrf52833dk/nrf52833 -- -DOVERLAY_CONFIG=debug.conf
```
To use UART 0 via Arduino headers, the virtual UART of the J-Link probe needs to be disabled, e.g. with the JLink Configuration Tool.
## nRF5340 Development Kit
The first Virtual UART (UART1, ...) is Zephyr UART 1
@@ -32,8 +65,6 @@ Signal direction as seen from the nRF5340.
| CTS | D8 | P1.10 | in |
| Time Sync| D10 | P1.06 | out |
### HCI over USB CDC
```sh
@@ -104,6 +135,7 @@ west build --pristine -b nrf5340_audio_dk/nrf5340/cpuapp -- -DEXTRA_DTC_OVERLAY_
To use UART 1 via Arduino headers, the virtual UART of the J-Link probe needs to be disabled, e.g. with the JLink Configuration Tool.
## nRF54L15
### HCI over UART 0 connected to second Virtual UART in J-Link Probe
@@ -133,7 +165,7 @@ Signal direction as seen from the nRF54L15.
## Maintainer Notes
- nRF5340 use Controller configuration in `sybuild/ipc_radio/prj.conf`, while other, e.g. nRF54L15, use configuration in `prj.conf`. Please update both at the same time.
- nRF5340 use Controller configuration in `sybuild/ipc_radio/prj.conf`, while others, e.g. nRF54L15, use configuration from `prj.conf`. Please update both at the same time.
- We can detect nRF5340 SoC in CMake with `if(CONFIG_SOC STREQUAL "nrf5340")` after find_package zephyr.

View File

@@ -4,6 +4,17 @@
* SPDX-License-Identifier: Apache-2.0
*/
/ {
host_interface {
compatible = "gpio-outputs";
status = "okay";
timesync: pin_0 {
gpios = <&gpio1 01 GPIO_ACTIVE_HIGH>;
label = "Controller to host timesync pin";
};
};
};
&uart0 {
compatible = "nordic,nrf-uarte";
current-speed = <1000000>;

View File

@@ -412,7 +412,7 @@ uint8_t hci_cmd_iso_timesync_cb(struct net_buf *buf)
}
#endif
#ifdef CONFIG_SOC_NRF54L15_CPUAPP
#if defined(CONFIG_SOC_NRF54L15_CPUAPP) || defined(CONFIG_SOC_NRF52833)
timestamp_second_us = (uint32_t) controller_time_us_get();
#endif