запустилось... но симуляцию периферии надо переделывать, работает непойми как
This commit is contained in:
		
							parent
							
								
									0f3ac734bf
								
							
						
					
					
						commit
						e7e0884c09
					
				@ -28,9 +28,12 @@ extern "C" {
 | 
			
		||||
 | 
			
		||||
/* Includes ------------------------------------------------------------------*/
 | 
			
		||||
#include "stm32f1xx.h"
 | 
			
		||||
#include "stm32_defs.h"
 | 
			
		||||
#include "Legacy/stm32_hal_legacy.h"
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
//#include "mcu_wrapper_conf.h"
 | 
			
		||||
#include "stm32f1xx_matlab_rcc.h"
 | 
			
		||||
#include "stm32f1xx_matlab_gpio.h"
 | 
			
		||||
#include "stm32f1xx_matlab_tim.h"
 | 
			
		||||
 | 
			
		||||
/* Exported types ------------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,8 @@
 | 
			
		||||
#define _MATLAB_GPIO_H_
 | 
			
		||||
 | 
			
		||||
#include "simstruc.h"
 | 
			
		||||
#include "mcu_wrapper_conf.h"
 | 
			
		||||
#include "stm32f1xx_matlab_conf.h"
 | 
			
		||||
//#include "mcu_wrapper_conf.h"
 | 
			
		||||
 | 
			
		||||
/* äåôàéíû äëÿ ïðîâåðêè êîíôèãóðàöèè GPIO) */
 | 
			
		||||
#define GET_GPIO_CONF(_reg_, _pos_)         ((_pos_ < 8)?                                                                                                   \
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
#ifndef _MATLAB_RCC_H_
 | 
			
		||||
#define _MATLAB_RCC_H_
 | 
			
		||||
 | 
			
		||||
#include "mcu_wrapper_conf.h"
 | 
			
		||||
#include "stm32f1xx_matlab_conf.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -6,7 +6,8 @@
 | 
			
		||||
#define _MATLAB_TIM_H_
 | 
			
		||||
 | 
			
		||||
#include "stm32f1xx_it.h"
 | 
			
		||||
#include "mcu_wrapper_conf.h"
 | 
			
		||||
#include "stm32f1xx_matlab_conf.h"
 | 
			
		||||
//#include "mcu_wrapper_conf.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -86,7 +86,7 @@ void Init_TIM_SIM(void)
 | 
			
		||||
{
 | 
			
		||||
#ifdef USE_TIM1    
 | 
			
		||||
	tim1s.tx_cnt = TIM1->CNT;
 | 
			
		||||
	tim1s.tx_step = hmcu.SIM_Sample_Time * ABP2_TIMS_Value;
 | 
			
		||||
	tim1s.tx_step = hmcu.sSimSampleTime * ABP2_TIMS_Value;
 | 
			
		||||
 | 
			
		||||
	tim1s.Channels.OC1_GPIOx = GPIOA;
 | 
			
		||||
	tim1s.Channels.OC1_PIN_SHIFT = 8;
 | 
			
		||||
@ -99,7 +99,7 @@ void Init_TIM_SIM(void)
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef USE_TIM2
 | 
			
		||||
	tim2s.tx_cnt = TIM2->CNT;
 | 
			
		||||
	tim2s.tx_step = hmcu.SIM_Sample_Time * ABP1_TIMS_Value;
 | 
			
		||||
	tim2s.tx_step = hmcu.sSimSampleTime * ABP1_TIMS_Value;
 | 
			
		||||
 | 
			
		||||
	tim2s.Channels.OC1_GPIOx = GPIOA;
 | 
			
		||||
	tim2s.Channels.OC1_PIN_SHIFT = 5;
 | 
			
		||||
@ -112,7 +112,7 @@ void Init_TIM_SIM(void)
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef USE_TIM3
 | 
			
		||||
	tim3s.tx_cnt = TIM3->CNT;
 | 
			
		||||
	tim3s.tx_step = hmcu.SIM_Sample_Time * ABP1_TIMS_Value;
 | 
			
		||||
	tim3s.tx_step = hmcu.sSimSampleTime * ABP1_TIMS_Value;
 | 
			
		||||
 | 
			
		||||
	tim3s.Channels.OC1_GPIOx = GPIOB;
 | 
			
		||||
	tim3s.Channels.OC1_PIN_SHIFT = 4;
 | 
			
		||||
@ -125,7 +125,7 @@ void Init_TIM_SIM(void)
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef USE_TIM4	
 | 
			
		||||
	tim4s.tx_cnt = TIM4->CNT;
 | 
			
		||||
	tim4s.tx_step = hmcu.SIM_Sample_Time * ABP1_TIMS_Value;
 | 
			
		||||
	tim4s.tx_step = hmcu.sSimSampleTime * ABP1_TIMS_Value;
 | 
			
		||||
 | 
			
		||||
	tim4s.Channels.OC1_GPIOx = GPIOD;
 | 
			
		||||
	tim4s.Channels.OC1_PIN_SHIFT = 12;
 | 
			
		||||
@ -138,7 +138,7 @@ void Init_TIM_SIM(void)
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef USE_TIM5
 | 
			
		||||
	tim5s.tx_cnt = TIM5->CNT;
 | 
			
		||||
	tim5s.tx_step = hmcu.SIM_Sample_Time * ABP1_TIMS_Value;
 | 
			
		||||
	tim5s.tx_step = hmcu.sSimSampleTime * ABP1_TIMS_Value;
 | 
			
		||||
 | 
			
		||||
	tim5s.Channels.OC1_GPIOx = GPIOA;
 | 
			
		||||
	tim5s.Channels.OC1_PIN_SHIFT = 0;
 | 
			
		||||
@ -151,7 +151,7 @@ void Init_TIM_SIM(void)
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef USE_TIMx
 | 
			
		||||
	tim6s.tx_cnt = TIMx->CNT;
 | 
			
		||||
	tim6s.tx_step = hmcu.SIM_Sample_Time * ABP1_TIMS_Value;
 | 
			
		||||
	tim6s.tx_step = hmcu.sSimSampleTime * ABP1_TIMS_Value;
 | 
			
		||||
 | 
			
		||||
	tim6s.Channels.OC1_GPIOx = GPIOA;
 | 
			
		||||
	tim6s.Channels.OC1_PIN_SHIFT = 0;
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,6 @@
 | 
			
		||||
#define _MATLAB_SETUP_H_
 | 
			
		||||
#include "stm32_defs.h"
 | 
			
		||||
#include "stm32f1xx_hal.h"
 | 
			
		||||
#include "mcu_wrapper_conf.h"
 | 
			
		||||
 | 
			
		||||
// DEFINES (UNCOMMENT WHAT YOU WILL SIMULATE)
 | 
			
		||||
// TIMS
 | 
			
		||||
 | 
			
		||||
@ -70,7 +70,7 @@ set includes_PERIPH=-I".\MCU_STM32F1xx_Matlab"^
 | 
			
		||||
:: ---------------------SET PARAMS FOR MEX COMPILING-----------------------
 | 
			
		||||
:: -------------ALL------------
 | 
			
		||||
set includes= %includes_WRAPPER% %includes_PERIPH% %includes_USER%
 | 
			
		||||
set codes= %code_WRAPPER% %code_USER% %code_PERIPH%
 | 
			
		||||
set codes= %code_WRAPPER% %code_PERIPH% %code_USER%
 | 
			
		||||
set defines= %defines_WRAPPER% %defines_CONFIG% %defines_USER%
 | 
			
		||||
:: -------OUTPUT FOLDER--------
 | 
			
		||||
set output= -outdir "." -output %filename%
 | 
			
		||||
 | 
			
		||||
@ -10,6 +10,7 @@
 | 
			
		||||
 | 
			
		||||
// INCLUDES START
 | 
			
		||||
// Инклюды для доступа к коду МК в коде оболочке
 | 
			
		||||
//#include "stm32f1xx_matlab_conf.h"
 | 
			
		||||
#include "upp.h"
 | 
			
		||||
#include "main.h"
 | 
			
		||||
// INCLUDES END
 | 
			
		||||
 | 
			
		||||
@ -99,11 +99,19 @@ void app_writeOutputBuffer(real_T* Buffer) {
 | 
			
		||||
        {
 | 
			
		||||
            WriteOutputArray(1, 0, i);
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            WriteOutputArray(0, 0, i);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (GPIOB->ODR & (1 << i))
 | 
			
		||||
        {
 | 
			
		||||
            WriteOutputArray(1, 1, i);
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            WriteOutputArray(0, 1, i);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
int var = phase_A.ctrl.angle.delay_us;
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,9 @@ void app_step(void)
 | 
			
		||||
//
 | 
			
		||||
// Вызов разных функций на шаге симуляции в случае, 
 | 
			
		||||
// если не используется отдельный поток для main().
 | 
			
		||||
//upp_main();
 | 
			
		||||
uwTick = hmcu.SystemClock / (MCU_CORE_CLOCK / 1000);
 | 
			
		||||
 | 
			
		||||
upp_main();
 | 
			
		||||
// USER APP STEP END
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								mcu_test_r2023.slx.autosave
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								mcu_test_r2023.slx.autosave
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user