brazos-trapezoidal
Macros | Functions | Variables
main.h File Reference

Header file for main.h.c. More...

#include <stdint.h>
#include "TrapSless.h"
Include dependency graph for main.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ATOD_IRQ_PRIO   1
 
#define DMA_IRQ_PRIO   2
 
#define TIM0_IRQ_PRIO   3
 
#define TIM1_IRQ_PRIO   4
 

Functions

int main (void)
 Main function. More...
 
void main_init (void)
 Main initialization function . Executes at start of main function. More...
 
void main_step (void)
 Main step function (FOR SIMULATION ONLY). Executes at control rate of 4KHz. More...
 
void SysTickCallBack ()
 Systick call back function Passed as argument of systick_initialize function at TimerInterrut.c Call rate of 250 us. More...
 
void main__Start_Motor (int16_t speed, int16_t accel)
 Main motor start function. More...
 
void main__Stop_Motor (void)
 Main motor stop function. More...
 
void * main__pointerUart0 ()
 Get the uart0 configuration pointer. Used by Serial Buffer module. More...
 

Variables

TRAPSLESS_PATTERN_TYPE TrapSlessData
 

Detailed Description

Header file for main.h.c.

Definition in file main.h.

Macro Definition Documentation

◆ ATOD_IRQ_PRIO

#define ATOD_IRQ_PRIO   1

-----------------------------— Theta Power Systems - CONFIDENTIAL --------------------------------------—

Definition at line 21 of file main.h.

◆ DMA_IRQ_PRIO

#define DMA_IRQ_PRIO   2

Definition at line 22 of file main.h.

◆ TIM0_IRQ_PRIO

#define TIM0_IRQ_PRIO   3

Definition at line 23 of file main.h.

◆ TIM1_IRQ_PRIO

#define TIM1_IRQ_PRIO   4

Definition at line 24 of file main.h.

Function Documentation

◆ main()

int main ( void  )

Main function.

Definition at line 672 of file main.c.

Here is the call graph for this function:

◆ main__pointerUart0()

void * main__pointerUart0 ( )

Get the uart0 configuration pointer. Used by Serial Buffer module.

Definition at line 1126 of file main.c.

◆ main__Start_Motor()

void main__Start_Motor ( int16_t  speed,
int16_t  accel 
)

Main motor start function.

Parameters
speed- motor speed in rpm
accel- motor ramp in rpm/s

Definition at line 1100 of file main.c.

Here is the call graph for this function:

◆ main__Stop_Motor()

void main__Stop_Motor ( void  )

Main motor stop function.

Definition at line 1117 of file main.c.

◆ main_init()

void main_init ( void  )

Main initialization function . Executes at start of main function.

< XBAR peripheral initialization

< GPIO peripheral initialization

< LSI initialization

< Microcontroller clocks initialization

< Timer Interrupt (Systick) initialization

< Calibration initialization

< Trapezoidal motor control initialization

< LEDs at off condition

< LEDs at off condition

< DMA enable request is set to true, enable it, when appropriate

< Analog to Digital converter configuration

< Dma configuration

< TIM0 is the pwm timer and its timer period is set for 40MHz clock with 16KHz operation. As it is triangular counter, the equation is divided by 2

< AdvDelay is the location of the pwm trigger, which is the peak of the triangular counter of pwm with a delay of 83 counts, or 2.1 [us], at 40MHz

< Setup the pwm (timers, pins and interrupts)

< ADC sequence is reset to get started

< Uart configuration - UART0 (PC interface) and UART1 (Jlink on board)

< API006MemoryRW module configuration

< API023MotorControl module configuration

< Tsp module configuration (Theta serial protocol)

< watchdog module initialization

< Enable write access to all other registers by writing 0x1ACCE551

< Update the value of 32-bit LOAD register - 64MHz counter targeting 150ms 64000000*0.150 = 9600000

< Reloads the counter from the value in WDOG LOAD

< Enable the interrupt event, WDOGINT. Set HIGH to Enable the counter and the interrupt

< Enable Watchdog reset output, WDOGRES. Set HIGH to enable the reset

< Disable write access by writing any other value than 0x1ACCE551

< Service the watchdog

< Tick timer for Bemf counting - free running counter

< Initialize Tick Timer as Free Runner Counter for Bemf time counting - 40MHz counter

< Set the source clock of the tick counter as HSOC = 40MHz

< Set the multiplier of clock of the tick counter as 1

Definition at line 489 of file main.c.

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

◆ main_step()

void main_step ( void  )

Main step function (FOR SIMULATION ONLY). Executes at control rate of 4KHz.

Definition at line 468 of file main.c.

Here is the call graph for this function:

◆ SysTickCallBack()

void SysTickCallBack ( )

Systick call back function Passed as argument of systick_initialize function at TimerInterrut.c Call rate of 250 us.

Definition at line 200 of file main.c.

Variable Documentation

◆ TrapSlessData

TRAPSLESS_PATTERN_TYPE TrapSlessData
extern

-----------------------------— Theta Power Systems - CONFIDENTIAL --------------------------------------—

< Struct variable carry all motor control related informatin

Definition at line 21 of file TrapSless.c.