MotorControlModuleSDFM_TMS3.../Projects/epwm_test/src/init_perif.c
seklyuts 65f17dc051 Отлажено измерение тока и напряжение
Учтено инвертирование ШИМ в третьей фазе
Настроено масштабирование напряжение (вектор напряжения в вольтах, а не в процентах ШИМ)
Напряжение моста фильтруется
2023-12-26 13:28:58 +03:00

91 lines
1.8 KiB
C

/*
* init_perif.c
*
* Created on: 21 àâã. 2023 ã.
* Author: seklyuts
*/
#include "pwm_init.h"
#include "f28x_project.h"
#include "pwm_interrupts.h"
#include "sdfm.h"
#include "f2838x_sdfm_drivers.h"
#include "gpio_init.h"
#include "spi_init.h"
#include "i2c_init.h"
#include "frm_uart.h"
#include "BL25CM1A.h"
#include "GD25Q16ETIGR.h"
#include "ZD24C02A.h"
#include "vector.h"
#include "adc_init.h"
void InitPerif(void)
{
InitSysCtrl();
// Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
//
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the f2838x_piectrl.c file.
//
InitPieCtrl();
//
// Disable CPU interrupts and clear all CPU interrupt flags:
//
IER = 0x0000;
IFR = 0x0000;
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in f2838x_defaultisr.c.
// This function is found in f2838x_pievect.c.
//
InitPieVectTable();
GpioInit();
//
SdfmInitEnable();
SdfmInit();
SdfmGpioInit();
SdfmInitInterruptEn();
//
PWMInitEnable();
PWMAllInit();
PWMGpioInit();
PWMInitInterruptEn();
vectorInitCurrLoop();
// SpiGpioInit();
// SpiInit();
// I2CMasterGpioInit();
// I2CMasterInit(I2C_OWN_ADDRESS,I2C_SLAVE_ADDRESS);
FRMUartInit();
// vectorInitCurrLoop();
// ConfigureADC();
//
// Enable global Interrupts and higher priority real-time debug events:
//
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
}