change clock to HF
This commit is contained in:
@@ -19,11 +19,11 @@ float Lowpassfilter(float Tf, float x)
|
|||||||
uint32_t Timesamp = DL_SYSTICK_getValue();
|
uint32_t Timesamp = DL_SYSTICK_getValue();
|
||||||
if(Timesamp < Last_Timesamp)
|
if(Timesamp < Last_Timesamp)
|
||||||
{
|
{
|
||||||
dt = (float)(Last_Timesamp - Timesamp) / 32 * 1e-6;
|
dt = (float)(Last_Timesamp - Timesamp) / 80 * 1e-6;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dt = (float)(0xFFFFFF - Timesamp + Last_Timesamp) / 32 * 1e-6;
|
dt = (float)(0xFFFFFF - Timesamp + Last_Timesamp) / 80 * 1e-6;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dt < 0.0 || dt == 0)
|
if(dt < 0.0 || dt == 0)
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ float PID_Controller(float Kp, float Ki, float Kd, float Error)
|
|||||||
uint32_t Timestamp = DL_SYSTICK_getValue();
|
uint32_t Timestamp = DL_SYSTICK_getValue();
|
||||||
if(Timestamp < Timestamp_Last)
|
if(Timestamp < Timestamp_Last)
|
||||||
{
|
{
|
||||||
Ts = (float)(Timestamp_Last - Timestamp) / 32 * 1e-6;
|
Ts = (float)(Timestamp_Last - Timestamp) / 80 * 1e-6;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Ts = (0xFFFFFF - Timestamp + Timestamp_Last) / 32 * 1e-6;
|
Ts = (0xFFFFFF - Timestamp + Timestamp_Last) / 80 * 1e-6;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Ts <= 0 || Ts > 0.05f)
|
if(Ts <= 0 || Ts > 0.05f)
|
||||||
|
|||||||
27
empty.syscfg
27
empty.syscfg
@@ -23,9 +23,31 @@ const UART1 = UART.addInstance();
|
|||||||
/**
|
/**
|
||||||
* Write custom configuration values to the imported modules.
|
* Write custom configuration values to the imported modules.
|
||||||
*/
|
*/
|
||||||
|
const divider7 = system.clockTree["PLL_PDIV"];
|
||||||
|
divider7.divideValue = 2;
|
||||||
|
|
||||||
|
const divider9 = system.clockTree["UDIV"];
|
||||||
|
divider9.divideValue = 2;
|
||||||
|
|
||||||
const gate7 = system.clockTree["MFCLKGATE"];
|
const gate7 = system.clockTree["MFCLKGATE"];
|
||||||
gate7.enable = true;
|
gate7.enable = true;
|
||||||
|
|
||||||
|
const multiplier2 = system.clockTree["PLL_QDIV"];
|
||||||
|
multiplier2.multiplyValue = 4;
|
||||||
|
|
||||||
|
const mux4 = system.clockTree["EXHFMUX"];
|
||||||
|
mux4.inputSelect = "EXHFMUX_XTAL";
|
||||||
|
|
||||||
|
const mux8 = system.clockTree["HSCLKMUX"];
|
||||||
|
mux8.inputSelect = "HSCLKMUX_SYSPLL2X";
|
||||||
|
|
||||||
|
const mux12 = system.clockTree["SYSPLLMUX"];
|
||||||
|
mux12.inputSelect = "zSYSPLLMUX_HFCLK";
|
||||||
|
|
||||||
|
const pinFunction4 = system.clockTree["HFXT"];
|
||||||
|
pinFunction4.enable = true;
|
||||||
|
pinFunction4.inputFreq = 40;
|
||||||
|
|
||||||
GPIO1.$name = "LED";
|
GPIO1.$name = "LED";
|
||||||
GPIO1.associatedPins[0].$name = "PA0";
|
GPIO1.associatedPins[0].$name = "PA0";
|
||||||
GPIO1.associatedPins[0].pin.$assign = "PA0";
|
GPIO1.associatedPins[0].pin.$assign = "PA0";
|
||||||
@@ -102,4 +124,7 @@ ProjectConfig.migrationCondition = true;
|
|||||||
* version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
|
* version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
|
||||||
* re-solve from scratch.
|
* re-solve from scratch.
|
||||||
*/
|
*/
|
||||||
I2C1.peripheral.$suggestSolution = "I2C1";
|
pinFunction4.peripheral.$suggestSolution = "SYSCTL";
|
||||||
|
pinFunction4.peripheral.hfxInPin.$suggestSolution = "PA5";
|
||||||
|
pinFunction4.peripheral.hfxOutPin.$suggestSolution = "PA6";
|
||||||
|
I2C1.peripheral.$suggestSolution = "I2C1";
|
||||||
|
|||||||
Reference in New Issue
Block a user