From 6108b0007c7e1919fc773985bd57eeba7b574e34 Mon Sep 17 00:00:00 2001 From: Steve Markgraf Date: Sun, 9 Feb 2025 00:29:48 +0100 Subject: [PATCH] dual_external_adc: correct PIO program name --- README.md | 3 +++ apps/dual_external_adc/adc_24bit_input.pio | 6 +++--- apps/dual_external_adc/dual_external_adc.c | 12 +++++++----- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6cb7aa9..1b6a920 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,9 @@ For the vhsdecode use-case, there is also an [adapter PCB](https://github.com/Se ### dual_external_adc Similar to the external_adc app, but samples two 12 bit ADCs connected to a RP2350B, as well as two PCM1802 modules. Intended for use with vhs-decode, see [this PCB](https://github.com/Sev5000/RP2350B_DualADC_DualPCM) for the matching hardware. +This example needs to be built with an RP2350B-board in order to work correctly: + + cmake -DPICO_PLATFORM=rp2350 -DPICO_BOARD=solderparty_rp2350_stamp_xl ../ ## Credits diff --git a/apps/dual_external_adc/adc_24bit_input.pio b/apps/dual_external_adc/adc_24bit_input.pio index 8279a18..0963840 100644 --- a/apps/dual_external_adc/adc_24bit_input.pio +++ b/apps/dual_external_adc/adc_24bit_input.pio @@ -13,7 +13,7 @@ ; Third word: D23 D22 D21 D20 D19 D18 D17 D16 D15 D14 D13 D12 D11 D10 D09 D08 D07 D06 D05 D04 D03 D02 D01 D00 C23 C22 C21 C20 C19 C18 C17 C16 .pio_version 1 -.program adc_12bit_input +.program adc_24bit_input .side_set 3 public entry_point: @@ -60,9 +60,9 @@ public entry_point: .wrap % c-sdk { -static inline void adc_12bit_input_program_init(PIO pio, uint sm, uint offset, uint pin, uint clk_pin) +static inline void adc_24bit_input_program_init(PIO pio, uint sm, uint offset, uint pin, uint clk_pin) { - pio_sm_config c = adc_12bit_input_program_get_default_config(offset); + pio_sm_config c = adc_24bit_input_program_get_default_config(offset); // Set the IN base pin to the provided `pin` parameter. sm_config_set_in_pins(&c, pin); diff --git a/apps/dual_external_adc/dual_external_adc.c b/apps/dual_external_adc/dual_external_adc.c index faef7ed..39c632b 100644 --- a/apps/dual_external_adc/dual_external_adc.c +++ b/apps/dual_external_adc/dual_external_adc.c @@ -2,7 +2,7 @@ * hsdaoh - High Speed Data Acquisition over MS213x USB3 HDMI capture sticks * Implementation for the Raspberry Pi RP2350 HSTX peripheral * - * External 12-bit ADC example, connected to the PIO + * Dual External 12-bit ADC example, connected to the PIO * * Copyright (c) 2024-2025 by Steve Markgraf * @@ -45,6 +45,10 @@ #include "adc_24bit_input.pio.h" #include "pcm1802_fmt00.pio.h" +#if (PICO_PIO_USE_GPIO_BASE != 1) +#warning "PICO_PIO_USE_GPIO_BASE is not set to 1, this application will not work correctly!" +#endif + /* The PIO is running with sys_clk/2, and needs 4 cycles per sample, * so the ADC clock is sys_clk/8 */ #define SYS_CLK 320000 // 40 MHz ADC clock @@ -88,12 +92,10 @@ void init_pio_input(void) /* move up GPIO base of PIO to access all ADC pins */ pio_set_gpio_base(pio, 16); - uint offset = pio_add_program(pio, &adc_12bit_input_program); + uint offset = pio_add_program(pio, &adc_24bit_input_program); uint sm_data = pio_claim_unused_sm(pio, true); - - adc_12bit_input_program_init(pio, sm_data, offset, PIO_INPUT_PIN_BASE, PIO_OUTPUT_CLK_PIN); - + adc_24bit_input_program_init(pio, sm_data, offset, PIO_INPUT_PIN_BASE, PIO_OUTPUT_CLK_PIN); dma_channel_config c; c = dma_channel_get_default_config(DMACH_PIO_PING);