ECE 486 Support Libraries
init486.h File Reference

STM32L476-Discovery configuration routines to support ECE 486. More...

#include <stdint.h>

Go to the source code of this file.

Macros

#define ERROR_LED   LED4
 Red LED, STM32L476G-Discovery. More...
 
#define NORMAL_LED   LED5
 Green LED, STM32L476G-Discovery. More...
 
#define FS_2K   40000
 2 ksamples/sec More...
 
#define FS_4K   20000
 4 ksamples/sec More...
 
#define FS_5K   16000
 5 ksamples/sec More...
 
#define FS_8K   10000
 8 ksamples/sec More...
 
#define FS_10K   8000
 10 ksamples/sec More...
 
#define FS_16K   5000
 16 ksamples/sec More...
 
#define FS_20K   4000
 20 ksamples/sec More...
 
#define FS_24K   3333
 24.0024 ksamples/sec More...
 
#define FS_25K   3200
 25 ksamples/sec More...
 
#define FS_32K   2500
 32 ksamples/sec More...
 
#define FS_40K   2000
 40 ksamples/sec More...
 
#define FS_48K   1667
 47.9904 ksamples/sec More...
 
#define FS_50K   1600
 50 ksamples/sec More...
 
#define FS_64K   1250
 64 ksamples/sec More...
 
#define FS_80K   1000
 80 ksamples/sec More...
 
#define FS_96K   833
 96.0384 ksamples/sec More...
 
#define FS_100K   800
 100 ksamples/sec More...
 
#define FS_125K   640
 125 ksamples/sec More...
 
#define FS_128K   625
 128 ksamples/sec More...
 
#define FS_160K   500
 160 ksamples/sec More...
 
#define FS_200K   400
 200 ksamples/sec More...
 
#define FS_250K   320
 250 ksamples/sec More...
 
#define FS_320K   250
 320 ksamples/sec More...
 
#define FS_400K   200
 400 ksamples/sec More...
 
#define FS_500K   160
 500 ksamples/sec More...
 
#define FS_625K   128
 625 ksamples/sec More...
 
#define FS_640K   125
 640 ksamples/sec More...
 
#define FS_800K   100
 800 ksamples/sec More...
 
#define FS_1000K   80
 1000 ksamples/sec More...
 
#define DIGITAL_IO_SET()   HAL_GPIO_WritePin(DIGITAL_IO_PORT, DIGITAL_IO_PIN, GPIO_PIN_SET)
 
#define DIGITAL_IO_RESET()   HAL_GPIO_WritePin(DIGITAL_IO_PORT, DIGITAL_IO_PIN, GPIO_PIN_RESET)
 
#define DIGITAL_IO_TOGGLE()   HAL_GPIO_TogglePin(DIGITAL_IO_PORT, DIGITAL_IO_PIN)
 

Enumerations

enum  Num_Channels_In { MONO_IN, STEREO_IN }
 Number of input audio channels. More...
 
enum  Num_Channels_Out { MONO_OUT, STEREO_OUT }
 Number of output audio channels. More...
 
enum  Clock_Reference { MSI_INTERNAL_RC, HSE_EXTERNAL_8MHz }
 Clock Reference Source. More...
 

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...
 

Variables

enum Num_Channels_Out Output_Configuration
 
enum Num_Channels_In Input_Configuration
 

Detailed Description

STM32L476-Discovery configuration routines to support ECE 486.

!

Author
Don Hummels
Date
Jan 2016

Contains all of the subroutines to configure various peripherals of the stm32L476 RCC, GPIO ports, DMAs, ADCs, DACs, etc.

Definition in file init486.h.

Enumeration Type Documentation

Clock Reference Source.

By default, the STM32L476G-Discovery board uses the MSI internal RC Oscillator as its clock source. Specify MSI_INTERNAL_RC for an unmodified board (SB18 Opened, SB21 and SB22 closed).

By modifying jumpers on the board, an external clock reference driving the high speed external (HSE) OSC_IN pin can be used. The external clock can be provided by the ST-LINK MCU, or driven externally through the PH0 pin on the P2 header (pin 9). Specify HSE_EXTERNAL_8MHz to use this improved clock source if your board has been modified.

  • 8 MHz XTAL Ref from ST-LINK MCU: SB18 closed, SB22 opened, R89 not fitted.
  • External 8MHz signal on PH0 on P2 header: SB18 opened, SB22 closed, R89 not fitted.
Enumerator
MSI_INTERNAL_RC 

Internal MSI RC Oscillator.

HSE_EXTERNAL_8MHz 

External 8MHz reference.

Definition at line 176 of file init486.h.

Number of input audio channels.

Enumerator
MONO_IN 

Mono Input: Only configure ADC1, single DMA Transfer.

STEREO_IN 

Stereo Input: Configure ADC1 and ADC2, dual DMA Transfer.

Definition at line 144 of file init486.h.

Number of output audio channels.

Enumerator
MONO_OUT 

Mono Output: Only configure DAC1, single DMA Transfer.

STEREO_OUT 

Stereo Output: Configure DAC1 and DAC2, dual DMA Transfer.

Definition at line 153 of file init486.h.

Variable Documentation

enum Num_Channels_In Input_Configuration

Definition at line 88 of file init486.c.

enum Num_Channels_Out Output_Configuration

Definition at line 87 of file init486.c.