changed to HF; test open loop with 2204; issue uart receiving failed sometime; motor jitter;

This commit is contained in:
2025-11-19 10:45:40 +08:00
parent 77b61cb90e
commit dd8f7c006f
3 changed files with 59 additions and 42 deletions

View File

@@ -26,20 +26,40 @@ const UART1 = UART.addInstance();
/**
* Write custom configuration values to the imported modules.
*/
const divider2 = system.clockTree["HFCLK4MFPCLKDIV"];
divider2.divideValue = 10;
const divider7 = system.clockTree["PLL_PDIV"];
divider7.divideValue = 2;
const divider9 = system.clockTree["UDIV"];
divider9.divideValue = 2;
const gate7 = system.clockTree["MFCLKGATE"];
gate7.enable = true;
const gate8 = system.clockTree["MFPCLKGATE"];
gate8.enable = true;
const multiplier2 = system.clockTree["PLL_QDIV"];
multiplier2.multiplyValue = 4;
const mux4 = system.clockTree["EXHFMUX"];
mux4.inputSelect = "EXHFMUX_XTAL";
const pinFunction4 = system.clockTree["HFXT"];
pinFunction4.inputFreq = 40;
const mux8 = system.clockTree["HSCLKMUX"];
mux8.inputSelect = "HSCLKMUX_SYSPLL2X";
const mux10 = system.clockTree["MFPCLKMUX"];
mux10.inputSelect = "MFPCLKMUX_HFCLK";
const mux12 = system.clockTree["SYSPLLMUX"];
mux12.inputSelect = "zSYSPLLMUX_HFCLK";
const pinFunction4 = system.clockTree["HFXT"];
pinFunction4.inputFreq = 40;
pinFunction4.enable = true;
pinFunction4.HFXTStartup = 20;
GPIO1.$name = "LED";
GPIO1.associatedPins[0].$name = "PA0";
@@ -73,8 +93,9 @@ I2C1.sclPinConfig.$name = "ti_driverlib_gpio_GPIOPinGeneric3";
PWM1.$name = "PWM_0";
PWM1.ccIndex = [0,1,2];
PWM1.clockDivider = 2;
PWM1.pwmMode = "CENTER_ALIGN";
PWM1.clockDivider = 4;
PWM1.timerCount = 2000;
PWM1.PWM_CHANNEL_0.$name = "ti_driverlib_pwm_PWMTimerCC0";
PWM1.PWM_CHANNEL_1.$name = "ti_driverlib_pwm_PWMTimerCC1";
PWM1.ccp0PinConfig.$name = "ti_driverlib_gpio_GPIOPinGeneric4";
@@ -87,7 +108,7 @@ PWM1.PWM_CHANNEL_2.$name = "ti_driverlib_pwm_PWMTimerCC2";
PWM1.ccp2PinConfig.$name = "ti_driverlib_gpio_GPIOPinGeneric6";
SYSCTL.forceDefaultClkConfig = true;
SYSCTL.peripheral.$assign = "SYSCTL";
SYSCTL.clockTreeEn = true;
SYSTICK.periodEnable = true;
SYSTICK.systickEnable = true;
@@ -105,13 +126,13 @@ TIMER1.peripheral.$assign = "TIMG0";
UART1.$name = "UART_0";
UART1.rxFifoThreshold = "DL_UART_RX_FIFO_LEVEL_ONE_ENTRY";
UART1.targetBaudRate = 115200;
UART1.uartClkDiv = "8";
UART1.enableFIFO = true;
UART1.txFifoThreshold = "DL_UART_TX_FIFO_LEVEL_ONE_ENTRY";
UART1.enabledDMATXTriggers = "DL_UART_DMA_INTERRUPT_TX";
UART1.enabledInterrupts = ["DMA_DONE_RX"];
UART1.enabledDMARXTriggers = "DL_UART_DMA_INTERRUPT_RX";
UART1.interruptPriority = "1";
UART1.uartClkDiv = "3";
UART1.peripheral.$assign = "UART0";
UART1.peripheral.rxPin.$assign = "PA11";
UART1.peripheral.txPin.$assign = "PA10";
@@ -136,5 +157,8 @@ ProjectConfig.migrationCondition = true;
* 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.
*/
I2C1.peripheral.$suggestSolution = "I2C1";
UART1.DMA_CHANNEL_RX.peripheral.$suggestSolution = "DMA_CH1";
pinFunction4.peripheral.$suggestSolution = "SYSCTL";
pinFunction4.peripheral.hfxInPin.$suggestSolution = "PA5";
pinFunction4.peripheral.hfxOutPin.$suggestSolution = "PA6";
I2C1.peripheral.$suggestSolution = "I2C1";
UART1.DMA_CHANNEL_RX.peripheral.$suggestSolution = "DMA_CH1";