ECE 486 Support Libraries
Configuration Functions

Functions

void initialize (uint16_t timer_count_value, enum Num_Channels_In chanin, enum Num_Channels_Out chanout)
 Wrapper function to perform all processor initialization for ECE 486. More...
 
void initialize_ece486 (uint16_t timer_count_value, enum Num_Channels_In chanin, enum Num_Channels_Out chanout, enum Clock_Reference clkref)
 Wrapper function to perform all processor initialization for ECE 486. More...
 
float getsamplingfrequency (void)
 Simple function to return the best guess at the actual sampling frequency. More...
 

Detailed Description

Function Documentation

float getsamplingfrequency ( void  )

Simple function to return the best guess at the actual sampling frequency.

Returns
Estimated sampling frequency in samples/second

Definition at line 441 of file init486.c.

void initialize ( uint16_t  timer_count_value,
enum Num_Channels_In  chanin,
enum Num_Channels_Out  chanout 
)

Wrapper function to perform all processor initialization for ECE 486.

initialize() is provided for backward compatibility: It assumes that the internal (MSI) RC oscillator is to be used as the clock reference signal. To specify use of an external crystal reference, use

1 initialize_ece486()

This wrapper function is called by users at the start of ECE 486 routines to perform initialization of I/O pins, ADCs, DACs, Timers, DMAs, and Interrupts.

Input parameters determine the ADC/DAC sample rate, and the number of input and output analog channels. Sample rates are determined by specifying a timer_count_value, which determines the ultimate sample frequency. Various #define constants are provided to obtain common sample rates: Timer Count constants for determining ADC/DAC sample rates.

For example:

1 initialize( FS_50K, MONO_IN, STEREO_OUT );

is used to configure the STM32-Discovery board for sampling at a 50 ksamples/second input and output rate, with one analog input channel, and two analog output channels.

It is not possible to have different ADC and DAC sample rates using this routine.

A call to initialize() also pauses program execution until the "USER" button is pressed, (Joystic "center" on the STM32L476G-Discovery board.) This pause allows the board to be re-programmed without interference from DMA activity.

Parameters
[in]timer_count_valueNumber of timer counts required per analog sample processed.
[in]chaninNumber of input channels: MONO_IN or STEREO_IN
[in]chanoutNumber of output channels: MONO_OUT or STEREO_OUT

Definition at line 95 of file init486.c.

void initialize_ece486 ( uint16_t  timer_count_value,
enum Num_Channels_In  chanin,
enum Num_Channels_Out  chanout,
enum Clock_Reference  clkref 
)

Wrapper function to perform all processor initialization for ECE 486.

This wrapper function is called by users at the start of ECE 486 routines to perform initialization of I/O pins, ADCs, DACs, Timers, DMAs, and Interrupts.

Input parameters determine the ADC/DAC sample rate, and the number of input and output analog channels, and the source of the clock reference signal. Sample rates are determined by specifying a timer_count_value, which determines the ultimate sample frequency. Various #define constants are provided to obtain common sample rates: Timer Count constants for determining ADC/DAC sample rates.

For example:

1 initialize_ece486( FS_50K, MONO_IN, STEREO_OUT, MSI_INTERNAL_RC );

is used to configure the STM32-Discovery board for sampling at a 50 ksamples/second input and output rate, with one analog input channel, and two analog output channels. The internal RC MSI oscillator is used to provide the clock generation reference.

It is not possible to have different ADC and DAC sample rates using this routine.

A call to initialize_ece486() also pauses program execution until the "USER" button is pressed, (Joystic "center" on the STM32L476G-Discovery board.) This pause allows the board to be re-programmed without interference from DMA activity.

Parameters
[in]timer_count_valueNumber of timer counts required per analog sample processed.
[in]chaninNumber of input channels: MONO_IN or STEREO_IN
[in]chanoutNumber of output channels: MONO_OUT or STEREO_OUT
[in]clkrefClock ref source: MSI_INTERNAL_RC or HSE_EXTERNAL_8MHz

Definition at line 105 of file init486.c.