Исправлено Евгением Лапутиным для корректной работы с USB

This commit is contained in:
seklyuts 2024-05-24 08:48:11 +03:00
parent 9061a9aab7
commit 7a214b1304
2 changed files with 28 additions and 20 deletions

View File

@ -79,18 +79,42 @@ void Reconnect2CPU2()
ERTM; // Enable Global realtime interrupt DBGM
}
void initADC(void){
EALLOW;
/** Включение АЦП */
CpuSysRegs.PCLKCR13.bit.ADC_A = 1;
CpuSysRegs.PCLKCR13.bit.ADC_B = 1;
CpuSysRegs.PCLKCR13.bit.ADC_C = 1;
CpuSysRegs.PCLKCR13.bit.ADC_D = 1;
//
// Check if device is trimmed
//
if(*((Uint16 *)0x5D736) == 0x0000){
//
// Device is not trimmed--apply static calibration values
//
AnalogSubsysRegs.ANAREFTRIMA.all = 31709;
AnalogSubsysRegs.ANAREFTRIMB.all = 31709;
AnalogSubsysRegs.ANAREFTRIMC.all = 31709;
AnalogSubsysRegs.ANAREFTRIMD.all = 31709;
}
EDIS;
}
/*==================================
* Инициализция MOTOR на CPU2
*=================================*/
void InitMotor(void)
{
EALLOW;
ClkCfgRegs.LOSPCP.bit.LSPCLKDIV = 2;
EDIS;
InitSysCtrl(); ///< Initialization of system resources. НЕ_МЕНЯТЬ
initADC();
InitPeripheralClocks();
GpioInit();
GpioDiodInit();
@ -100,20 +124,4 @@ void InitMotor(void)
FRMGPIOInit();
Reconnect2CPU2();
//
// Bring CPU2 out of reset. Wait for CPU2 to go out of reset.
//
//SysCtl_controlCPU2Reset(SYSCTL_CORE_DEACTIVE);
//while(SysCtl_isCPU2Reset() == 0x1U);
Cpu1toCpu2IpcRegs.CPU1TOCPU2IPCBOOTMODE = 0x5A00C803; //str 716
Cpu1toCpu2IpcRegs.CPU1TOCPU2IPCSET.bit.IPC0 = 1;
EALLOW;
DevCfgRegs.CPU2RESCTL.all = 0xA5A50000;
EDIS;
while(DevCfgRegs.RSTSTAT.bit.CPU2RES == 0);
}

View File

@ -17,7 +17,7 @@
#define BOOTMODE_CPU2_CLK_FREQ(clk_freq_mhz) ((uint32_t) ((clk_freq_mhz << 8U) & 0x0000FF00U))
#define BOOTMODE_KEY 0x54000000U
#define BOOTMODE_KEY 0x5A000000U
#define BOOTMODE_BOOT_TO_FLASH_SECTOR0 0x00000003U
#define BOOTMODE_BOOT_TO_FLASH_SECTOR4 0x00000023U