iSensor-SPI-Buffer  1.15
Firmware for the iSensor-SPI-Buffer board to enable full throughput buffered data capture on Analog Devices IMUs
Functions | Variables
main.c File Reference

iSensor-SPI-Buffer main. Contains STM init functions and application cyclic executive. More...

#include "usb.h"
#include "main.h"
#include "reg.h"
#include "imu.h"
#include "usbd_cdc_if.h"
#include "usb_device.h"
#include "sd_card.h"
#include "buffer.h"
#include "user_interrupt.h"
#include "flash.h"
#include "led.h"
#include "watchdog.h"
#include "timer.h"
#include "dio.h"
#include "adc.h"
#include "dfu.h"
#include "user_spi.h"
#include "data_capture.h"
#include "script.h"
Include dependency graph for main.c:

Functions

static void SystemClock_Config ()
 System Clock Configuration. More...
 
static void MX_GPIO_Init ()
 GPIO Initialization Function. More...
 
static void DMA_Init ()
 Init all DMA channels in use and configure DMA interrupts. More...
 
int main ()
 The application entry point. More...
 
void Main_Error_Handler ()
 This function is executed in case of error occurrence. More...
 

Variables

DMA_HandleTypeDef g_dma_spi1_rx
 
DMA_HandleTypeDef g_dma_spi1_tx
 
DMA_HandleTypeDef g_dma_spi2_tx
 
SPI_HandleTypeDef g_spi1
 
SPI_HandleTypeDef g_spi2
 
static uint32_t state
 

Detailed Description

iSensor-SPI-Buffer main. Contains STM init functions and application cyclic executive.

Copyright (c) Analog Devices Inc, 2020 All Rights Reserved.

Date
3/14/2020
Author
A. Nolan (alex..nosp@m.nola.nosp@m.n@ana.nosp@m.log..nosp@m.com)

Function Documentation

◆ DMA_Init()

static void DMA_Init ( )
static

Init all DMA channels in use and configure DMA interrupts.

Returns
void

Currently use three DMA channels, on DMA peripheral 1: DMA2/3 - IMU SPI port, used for burst reads from IMU DMA5 - User SPI port, Used for buffer burst outputs. Rx not used

All DMA channels are configured to generate interrupts upon the completion of a transfer. The user SPI DMA interrupt is used just to check for any error events which might have occurred during the burst read process.

The IMU DMA interrupts are used to determine when a burst read from the IMU has completed. Both the Tx and Rx channels must be done for a burst read to have completed (Tx should finish last).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( )

The application entry point.

Returns
main status code. Should not return.
Here is the call graph for this function:

◆ Main_Error_Handler()

void Main_Error_Handler ( )

This function is executed in case of error occurrence.

Returns
void

During init, errors are logged, then init continues. This is done to reduce potential for a fault locking the device in a reset loop.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MX_GPIO_Init()

static void MX_GPIO_Init ( )
static

GPIO Initialization Function.

Returns
void

TIM3 GPIO Configuration PA4 ---—> TIM3_CH2

Here is the caller graph for this function:

◆ SystemClock_Config()

static void SystemClock_Config ( )
static

System Clock Configuration.

Returns
void

Initializes the CPU, AHB and APB busses clocks

Initializes the CPU, AHB and APB busses clocks

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_dma_spi1_rx

DMA_HandleTypeDef g_dma_spi1_rx

IMU SPI Rx DMA handle. Global scope

◆ g_dma_spi1_tx

DMA_HandleTypeDef g_dma_spi1_tx

IMU SPI Tx DMA handle. Global scope

◆ g_dma_spi2_tx

DMA_HandleTypeDef g_dma_spi2_tx

User SPI Tx DMA handle. Global scope

◆ g_spi1

SPI_HandleTypeDef g_spi1

SPI handle for IMU master port. Global scope

◆ g_spi2

SPI_HandleTypeDef g_spi2

SPI handle for slave port (from master controller). Global scope

◆ state

uint32_t state
static

Track the cyclic executive state