Files
aes67-ESP32-P4/main/main.c
T
bsncubed bae6a8a2f9 Step 4.2: PTP-paced AES67 RTP sender with 1 kHz test tone
- aes67_tx: TX task woken by an esp_timer every packet time; sends every
  packet whose last sample is in the past (PTP time), RTP ts =
  (sample index from PTP + clk_offset) mod 2^32, packets aligned to
  multiples of the packet size. Sends only while PTP is locked; resyncs
  on lock, clock step or > 20 ms lag. L24/L16 big-endian, TTL/DSCP/
  multicast IF from config; a config save restarts TX.
- Built-in 1 kHz tone at -18 dBFS, phase from the PTP sample index;
  aes67_tx_set_source() pull callback for later sources (underruns
  counted, padded with silence). status: tx_packets, underruns.
- Verified with a receiver script on the PC: 1 ms L24 stereo 1000/s,
  0 gaps, ts step 48, tone -18.00 dBFS within 1.2 LSB of the ideal
  PTP-phased sine; also L16 mono 0.333 ms, 0.125 ms (8000/s) and 4 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 06:43:12 +10:00

44 lines
1.2 KiB
C

#include "aes67_board.h"
#include "aes67_health.h"
#include "aes67_net.h"
#include "aes67_ota.h"
#include "aes67_ptp.h"
#include "aes67_sdp_sap.h"
#include "aes67_syslog.h"
#include "aes67_tx.h"
#include "aes67_web.h"
#include "esp_app_desc.h"
#include "esp_chip_info.h"
#include "esp_log.h"
#include "project_cfg.h"
static const char *TAG = "main";
void app_main(void)
{
const esp_app_desc_t *app = esp_app_get_description();
esp_chip_info_t chip;
esp_chip_info(&chip);
ESP_LOGI(TAG, "%s %s (IDF %s, built %s %s)",
app->project_name, app->version, app->idf_ver, app->date, app->time);
ESP_LOGI(TAG, "chip rev v%d.%d, %d cores",
chip.revision / 100, chip.revision % 100, chip.cores);
project_cfg_defaults();
esp_eth_handle_t eth;
ESP_ERROR_CHECK(aes67_board_eth_init(&eth));
ESP_ERROR_CHECK(aes67_net_init(eth));
ESP_ERROR_CHECK(aes67_health_init());
ESP_ERROR_CHECK(aes67_ptp_init());
ESP_ERROR_CHECK(aes67_ptp_start(eth));
ESP_ERROR_CHECK(aes67_tx_init());
ESP_ERROR_CHECK(aes67_syslog_init());
project_cfg_register();
ESP_ERROR_CHECK(aes67_ota_init());
ESP_ERROR_CHECK(aes67_sdp_sap_init());
ESP_ERROR_CHECK(aes67_tx_start());
ESP_ERROR_CHECK(aes67_web_start());
}