mirror of
https://github.com/wvdv2002/SMA-SB2500-Off-Grid.git
synced 2025-01-12 18:34:03 +00:00
Doubled sinus timer speed, Enabled RS485 only reception for now, enabled float printf
This commit is contained in:
parent
cec27eb371
commit
05b05bf827
7 changed files with 26 additions and 32 deletions
|
@ -24,6 +24,8 @@
|
|||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.892750413" name="Floating-point ABI" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi" useByScannerDiscovery="true" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.value.hard" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.1726461328" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" useByScannerDiscovery="false" value="genericBoard" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.1399934884" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.4 || Debug || true || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32F405RGTx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || C:/Users/wvdv2/STM32Cube/Repository/STM32Cube_FW_F4_V1.26.1/Drivers/CMSIS/Device/ST/STM32F4xx/Include | ../Inc | C:/Users/wvdv2/STM32Cube/Repository/STM32Cube_FW_F4_V1.26.1/Middlewares/Third_Party/FreeRTOS/Source/include | C:/Users/wvdv2/STM32Cube/Repository/STM32Cube_FW_F4_V1.26.1/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS | C:/Users/wvdv2/STM32Cube/Repository/STM32Cube_FW_F4_V1.26.1/Drivers/CMSIS/Include | C:/Users/wvdv2/STM32Cube/Repository/STM32Cube_FW_F4_V1.26.1/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy | C:/Users/wvdv2/STM32Cube/Repository/STM32Cube_FW_F4_V1.26.1/Drivers/STM32F4xx_HAL_Driver/Inc | C:/Users/wvdv2/STM32Cube/Repository/STM32Cube_FW_F4_V1.26.1/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F || || || STM32F405xx | USE_HAL_DRIVER || || Drivers | Src | Middlewares | Startup || || || ${workspace_loc:/${ProjName}/STM32F405RGTX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.runtimelibrary_c.1880209072" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.runtimelibrary_c" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.runtimelibrary_c.value.nano_c" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat.1782478565" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat" value="true" valueType="boolean"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.1576380252" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
||||
<builder buildPath="${workspace_loc:/solarInv}/Debug" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.2023186970" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1296637315" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
|
||||
|
@ -206,4 +208,4 @@
|
|||
<resource resourceType="PROJECT" workspacePath="/solarInv"/>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
</cproject>
|
||||
</cproject>
|
|
@ -64,7 +64,7 @@
|
|||
/* #define HAL_SPI_MODULE_ENABLED */
|
||||
#define HAL_TIM_MODULE_ENABLED
|
||||
#define HAL_UART_MODULE_ENABLED
|
||||
#define HAL_USART_MODULE_ENABLED
|
||||
#define HAL_USART_MODULE_ENABLED
|
||||
/* #define HAL_IRDA_MODULE_ENABLED */
|
||||
/* #define HAL_SMARTCARD_MODULE_ENABLED */
|
||||
/* #define HAL_SMBUS_MODULE_ENABLED */
|
||||
|
|
|
@ -516,7 +516,7 @@ static void MX_TIM2_Init(void)
|
|||
|
||||
/* USER CODE END TIM2_Init 1 */
|
||||
htim2.Instance = TIM2;
|
||||
htim2.Init.Prescaler = 10500;
|
||||
htim2.Init.Prescaler = 5250;
|
||||
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim2.Init.Period = 16000;
|
||||
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
|
@ -608,7 +608,7 @@ static void MX_USART1_UART_Init(void)
|
|||
huart1.Init.StopBits = UART_STOPBITS_1;
|
||||
huart1.Init.Parity = UART_PARITY_NONE;
|
||||
huart1.Init.Mode = UART_MODE_TX_RX;
|
||||
huart1.Init.HwFlowCtl = UART_HWCONTROL_RTS;
|
||||
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||
huart1.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||
if (HAL_UART_Init(&huart1) != HAL_OK)
|
||||
{
|
||||
|
@ -732,7 +732,7 @@ static void MX_GPIO_Init(void)
|
|||
HAL_GPIO_WritePin(BRIDGES_SHUTDOWN_GPIO_Port, BRIDGES_SHUTDOWN_Pin, GPIO_PIN_SET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOA, IO_OUT1_Pin|IO_OUT0_Pin, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, IO_OUT1_Pin|IO_OUT0_Pin|RS485_TXENA_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pins : GRIDRELAY_1_Pin GRIDRELAY_0_Pin LED_HEARTBEAT_Pin LCD_RW_Pin
|
||||
LCD_BACKL_Pin LCD_D7_Pin LCD_D6_Pin LCD_D4_Pin */
|
||||
|
@ -771,8 +771,8 @@ static void MX_GPIO_Init(void)
|
|||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(LCD_SWB_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : IO_OUT1_Pin IO_OUT0_Pin */
|
||||
GPIO_InitStruct.Pin = IO_OUT1_Pin|IO_OUT0_Pin;
|
||||
/*Configure GPIO pins : IO_OUT1_Pin IO_OUT0_Pin RS485_TXENA_Pin */
|
||||
GPIO_InitStruct.Pin = IO_OUT1_Pin|IO_OUT0_Pin|RS485_TXENA_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
|
|
|
@ -505,20 +505,11 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
|||
/* Peripheral clock enable */
|
||||
__HAL_RCC_USART1_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**USART1 GPIO Configuration
|
||||
PA12 ------> USART1_RTS
|
||||
PB6 ------> USART1_TX
|
||||
PB7 ------> USART1_RX
|
||||
*/
|
||||
GPIO_InitStruct.Pin = RS485_TXENA_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
|
||||
HAL_GPIO_Init(RS485_TXENA_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = RS485_TX_Pin|RS485_RX_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
|
@ -614,12 +605,9 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
|
|||
__HAL_RCC_USART1_CLK_DISABLE();
|
||||
|
||||
/**USART1 GPIO Configuration
|
||||
PA12 ------> USART1_RTS
|
||||
PB6 ------> USART1_TX
|
||||
PB7 ------> USART1_RX
|
||||
*/
|
||||
HAL_GPIO_DeInit(RS485_TXENA_GPIO_Port, RS485_TXENA_Pin);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOB, RS485_TX_Pin|RS485_RX_Pin);
|
||||
|
||||
/* USART1 DMA DeInit */
|
||||
|
|
|
@ -173,7 +173,7 @@ void DebugMon_Handler(void)
|
|||
void USART1_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN USART1_IRQn 0 */
|
||||
|
||||
controlUsartHandler();
|
||||
/* USER CODE END USART1_IRQn 0 */
|
||||
HAL_UART_IRQHandler(&huart1);
|
||||
/* USER CODE BEGIN USART1_IRQn 1 */
|
||||
|
|
|
@ -27,6 +27,7 @@ static unsigned char UART_DMA_RX_BUFFER[UART_RX_BUFFER_SIZE];
|
|||
osSemaphoreId controlUartNewDataFlag_id; // message queue id
|
||||
uint32_t rxBufferReadPointer = 0;
|
||||
static TickType_t lastDataReceived;
|
||||
extern
|
||||
|
||||
LED led_table[] = {
|
||||
{{LED_HEARTBEAT_GPIO_Port,LED_HEARTBEAT_Pin},led_mode_heartbeat,0},
|
||||
|
@ -62,8 +63,9 @@ void startCommandThread(void const * argument){
|
|||
|
||||
TM_HD44780_Init(16, 2);
|
||||
TM_HD44780_Puts(0, 0, "Hello World");
|
||||
TM_HD44780_BlinkOn();
|
||||
|
||||
TM_HD44780_BlinkOff();
|
||||
HAL_GPIO_WritePin(RS485_RXENA_GPIO_Port, RS485_RXENA_Pin, 0);
|
||||
HAL_GPIO_WritePin(RS485_TXENA_GPIO_Port, RS485_TXENA_Pin, 1);
|
||||
for (;;){
|
||||
dataReceived = osSemaphoreWait(controlUartNewDataFlag_id,0);
|
||||
if(dataReceived){
|
||||
|
@ -140,9 +142,12 @@ void lcdTask(void){
|
|||
TickType_t now = HAL_GetTick();
|
||||
if ((now-lastLCDUpdate)>1000){
|
||||
lastLCDUpdate = now;
|
||||
char time[14];
|
||||
itoa(now/1000,time,10);
|
||||
TM_HD44780_Puts(0, 1, time);
|
||||
char info[25];
|
||||
sprintf(info,"%i B:%1.0f V:%1.0f ",getCopyControlState()->controlState.controlTaskState,getCopyControlState()->inputs.VDCBUS,getSetPoint()->voltage);
|
||||
TM_HD44780_Puts(0, 0, info);
|
||||
sprintf(info,"D:%i ",getSetPoint()->deadTime);
|
||||
TM_HD44780_Puts(0, 1, info);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -272,12 +272,10 @@ PA11.GPIOParameters=GPIO_Label
|
|||
PA11.GPIO_Label=IO_OUT0
|
||||
PA11.Locked=true
|
||||
PA11.Signal=GPIO_Output
|
||||
PA12.GPIOParameters=GPIO_Speed,GPIO_Label
|
||||
PA12.GPIOParameters=GPIO_Label
|
||||
PA12.GPIO_Label=RS485_TXENA
|
||||
PA12.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
||||
PA12.Locked=true
|
||||
PA12.Mode=RTS_Only
|
||||
PA12.Signal=USART1_RTS
|
||||
PA12.Signal=GPIO_Output
|
||||
PA13.Mode=Trace_Asynchronous_SW
|
||||
PA13.Signal=SYS_JTMS-SWDIO
|
||||
PA14.Mode=Trace_Asynchronous_SW
|
||||
|
@ -499,7 +497,7 @@ ProjectManager.StackSize=0x800
|
|||
ProjectManager.TargetToolchain=STM32CubeIDE
|
||||
ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UnderRoot=true
|
||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-SystemClock_Config-RCC-false-HAL-false,4-MX_ADC1_Init-ADC1-false-HAL-true,5-MX_ADC2_Init-ADC2-false-HAL-true,6-MX_ADC3_Init-ADC3-false-HAL-true,7-MX_TIM1_Init-TIM1-false-HAL-true,8-MX_TIM4_Init-TIM4-false-HAL-true,9-MX_USART1_UART_Init-USART1-false-HAL-true,10-MX_USART2_UART_Init-USART2-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-SystemClock_Config-RCC-false-HAL-false,4-MX_ADC1_Init-ADC1-false-HAL-true,5-MX_ADC2_Init-ADC2-false-HAL-true,6-MX_ADC3_Init-ADC3-false-HAL-true,7-MX_TIM1_Init-TIM1-false-HAL-true,8-MX_TIM4_Init-TIM4-false-HAL-true,9-MX_USART1_UART_Init-USART1-false-HAL-true,10-MX_USART2_UART_Init-USART2-false-HAL-true,11-MX_TIM2_Init-TIM2-false-HAL-true
|
||||
RCC.48MHZClocksFreq_Value=48000000
|
||||
RCC.AHBFreq_Value=168000000
|
||||
RCC.APB1CLKDivider=RCC_HCLK_DIV4
|
||||
|
@ -575,7 +573,8 @@ TIM1.BreakState=TIM_BREAK_DISABLE
|
|||
TIM1.Channel-PWM\ Generation2\ CH2\ CH2N=TIM_CHANNEL_2
|
||||
TIM1.Channel-PWM\ Generation3\ CH3\ CH3N=TIM_CHANNEL_3
|
||||
TIM1.CounterMode=TIM_COUNTERMODE_UP
|
||||
TIM1.IPParameters=CounterMode,BreakPolarity,AutomaticOutput,OffStateRunMode,OffStateIDLEMode,Period,OCNPolarity_3,BreakState,Channel-PWM Generation2 CH2 CH2N,Channel-PWM Generation3 CH3 CH3N,OCNPolarity_2
|
||||
TIM1.DeadTime=30
|
||||
TIM1.IPParameters=CounterMode,BreakPolarity,AutomaticOutput,OffStateRunMode,OffStateIDLEMode,Period,OCNPolarity_3,BreakState,Channel-PWM Generation2 CH2 CH2N,Channel-PWM Generation3 CH3 CH3N,OCNPolarity_2,DeadTime
|
||||
TIM1.OCNPolarity_2=TIM_OCNPOLARITY_HIGH
|
||||
TIM1.OCNPolarity_3=TIM_OCNPOLARITY_HIGH
|
||||
TIM1.OffStateIDLEMode=TIM_OSSI_ENABLE
|
||||
|
@ -584,7 +583,7 @@ TIM1.Period=10500
|
|||
TIM2.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE
|
||||
TIM2.IPParameters=Prescaler,AutoReloadPreload,Period
|
||||
TIM2.Period=16000
|
||||
TIM2.Prescaler=10500
|
||||
TIM2.Prescaler=5250
|
||||
TIM4.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_DISABLE
|
||||
TIM4.IPParameters=Prescaler,Period,AutoReloadPreload
|
||||
TIM4.Period=3281
|
||||
|
|
Loading…
Reference in a new issue