这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » STM32 » 开发STM32G0,用哪个版本的J-Link合适些?

共8条 1/1 1 跳转至

开发STM32G0,用哪个版本的J-Link合适些?

工程师
2020-01-27 21:15:11     打赏

如题,f系列一直用jlink_ob,貌似无法用在G系列,如果用jlink,哪个版本好?V9?




关键词: STM32G0     J-Link     stm32    

工程师
2020-01-27 21:31:38     打赏
2楼

我在用G0,手头直接Jlink V9可用,V8没试过。


工程师
2020-01-27 21:34:48     打赏
3楼

用标准的jlink,就是很大个头那个。


工程师
2020-01-28 20:43:18     打赏
4楼

路过,借题顺便问下大家:

我用cubemx生成嘀嗒时钟,定时器都跑不起来,是咋回事?
是还需要使能全局中断吗?


我的源码如下:

/* USER CODE BEGIN Header */

/**

  ******************************************************************************

  * @file           : main.c

  * @brief          : Main program body

  ******************************************************************************

  * @attention

  *

  * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.

  * All rights reserved.</center></h2>

  *

  * This software component is licensed by ST under BSD 3-Clause license,

  * the "License"; You may not use this file except in compliance with the

  * License. You may obtain a copy of the License at:

  *                        opensource.org/licenses/BSD-3-Clause

  *

  ******************************************************************************

  */

/* USER CODE END Header */


/* Includes ------------------------------------------------------------------*/

#include "main.h"


/* Private includes ----------------------------------------------------------*/

/* USER CODE BEGIN Includes */


/* USER CODE END Includes */


/* Private typedef -----------------------------------------------------------*/

/* USER CODE BEGIN PTD */


/* USER CODE END PTD */


/* Private define ------------------------------------------------------------*/

/* USER CODE BEGIN PD */

/* USER CODE END PD */


/* Private macro -------------------------------------------------------------*/

/* USER CODE BEGIN PM */


/* USER CODE END PM */


/* Private variables ---------------------------------------------------------*/


/* USER CODE BEGIN PV */


/* USER CODE END PV */


/* Private function prototypes -----------------------------------------------*/

void SystemClock_Config(void);

static void MX_GPIO_Init(void);

static void MX_TIM3_Init(void);

static void MX_TIM16_Init(void);

/* USER CODE BEGIN PFP */


/* USER CODE END PFP */


/* Private user code ---------------------------------------------------------*/

/* USER CODE BEGIN 0 */


/* USER CODE END 0 */


/**

  * @brief  The application entry point.

  * @retval int

  */

int main(void)

{

  /* USER CODE BEGIN 1 */


  /* USER CODE END 1 */

  


  /* MCU Configuration--------------------------------------------------------*/


  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */

  


  LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SYSCFG);

  LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);


  /* System interrupt init*/


  /* USER CODE BEGIN Init */


  /* USER CODE END Init */


  /* Configure the system clock */

  SystemClock_Config();

  

    NVIC_SetPriority(SysTick_IRQn, 2);

  NVIC_EnableIRQ(SysTick_IRQn);


  /* USER CODE BEGIN SysInit */


  /* USER CODE END SysInit */


  /* Initialize all configured peripherals */

  MX_GPIO_Init();

  MX_TIM3_Init();

  MX_TIM16_Init();

  /* USER CODE BEGIN 2 */


  /* USER CODE END 2 */

 

 


  /* Infinite loop */

  /* USER CODE BEGIN WHILE */

  while (1)

  {

    /* USER CODE END WHILE */


    /* USER CODE BEGIN 3 */

  }

  /* USER CODE END 3 */

}


/**

  * @brief System Clock Configuration

  * @retval None

  */

void SystemClock_Config(void)

{

  /* HSE configuration and activation */

  LL_RCC_HSE_Enable();

  while(LL_RCC_HSE_IsReady() != 1)

  {

  };


  /* Main PLL configuration and activation */

  LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_2, 12, LL_RCC_PLLR_DIV_4);

  LL_RCC_PLL_Enable();

  LL_RCC_PLL_EnableDomain_SYS();

  while(LL_RCC_PLL_IsReady() != 1)

  {

  };


  /* Set AHB prescaler*/

  LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);


  /* Sysclk activation on the main PLL */

  LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);

  while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)

  {

  };


  /* Set APB1 prescaler*/

  LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);

  LL_Init1msTick(24000000);

  LL_SYSTICK_SetClkSource(LL_SYSTICK_CLKSOURCE_HCLK);

  LL_SetSystemCoreClock(24000000);

  /* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */

  LL_SetSystemCoreClock(24000000);

}


/**

  * @brief TIM3 Initialization Function

  * @param None

  * @retval None

  */

static void MX_TIM3_Init(void)

{


  /* USER CODE BEGIN TIM3_Init 0 */


  /* USER CODE END TIM3_Init 0 */


  LL_TIM_InitTypeDef TIM_InitStruct = {0};

  LL_TIM_OC_InitTypeDef TIM_OC_InitStruct = {0};


  LL_GPIO_InitTypeDef GPIO_InitStruct = {0};


  /* Peripheral clock enable */

  LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM3);


  /* TIM3 interrupt Init */

  NVIC_SetPriority(TIM3_IRQn, 0);

  NVIC_EnableIRQ(TIM3_IRQn);


  /* USER CODE BEGIN TIM3_Init 1 */


  /* USER CODE END TIM3_Init 1 */

  TIM_InitStruct.Prescaler = 0;

  TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;

  TIM_InitStruct.Autoreload = 0;

  TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;

  LL_TIM_Init(TIM3, &TIM_InitStruct);

  LL_TIM_DisableARRPreload(TIM3);

  TIM_OC_InitStruct.OCMode = LL_TIM_OCMODE_FROZEN;

  TIM_OC_InitStruct.OCState = LL_TIM_OCSTATE_DISABLE;

  TIM_OC_InitStruct.OCNState = LL_TIM_OCSTATE_DISABLE;

  TIM_OC_InitStruct.CompareValue = 0;

  TIM_OC_InitStruct.OCPolarity = LL_TIM_OCPOLARITY_HIGH;

  LL_TIM_OC_Init(TIM3, LL_TIM_CHANNEL_CH3, &TIM_OC_InitStruct);

  LL_TIM_OC_DisableFast(TIM3, LL_TIM_CHANNEL_CH3);

  LL_TIM_SetTriggerOutput(TIM3, LL_TIM_TRGO_RESET);

  LL_TIM_DisableMasterSlaveMode(TIM3);

  /* USER CODE BEGIN TIM3_Init 2 */


  /* USER CODE END TIM3_Init 2 */

  LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOB);

  /**TIM3 GPIO Configuration  

  PB0   ------> TIM3_CH3 

  */

  GPIO_InitStruct.Pin = LL_GPIO_PIN_0;

  GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;

  GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;

  GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;

  GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;

  GPIO_InitStruct.Alternate = LL_GPIO_AF_1;

  LL_GPIO_Init(GPIOB, &GPIO_InitStruct);


}


/**

  * @brief TIM16 Initialization Function

  * @param None

  * @retval None

  */

static void MX_TIM16_Init(void)

{


  /* USER CODE BEGIN TIM16_Init 0 */


  /* USER CODE END TIM16_Init 0 */


  LL_TIM_InitTypeDef TIM_InitStruct = {0};


  /* Peripheral clock enable */

  LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM16);


  /* TIM16 interrupt Init */

  NVIC_SetPriority(TIM16_IRQn, 0);

  NVIC_EnableIRQ(TIM16_IRQn);


  /* USER CODE BEGIN TIM16_Init 1 */


  /* USER CODE END TIM16_Init 1 */

  TIM_InitStruct.Prescaler = 0;

  TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;

  TIM_InitStruct.Autoreload = 0xFFFF;

  TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;

  TIM_InitStruct.RepetitionCounter = 0;

  LL_TIM_Init(TIM16, &TIM_InitStruct);

  LL_TIM_DisableARRPreload(TIM16);

  /* USER CODE BEGIN TIM16_Init 2 */

LL_TIM_EnableCounter(TIM16);

  /* USER CODE END TIM16_Init 2 */


  

  

}


/**

  * @brief GPIO Initialization Function

  * @param None

  * @retval None

  */

static void MX_GPIO_Init(void)

{

  LL_EXTI_InitTypeDef EXTI_InitStruct = {0};


  /* GPIO Ports Clock Enable */

  LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOF);

  LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOB);


  /**/

  LL_EXTI_SetEXTISource(LL_EXTI_CONFIG_PORTB, LL_EXTI_CONFIG_LINE1);


  /**/

  EXTI_InitStruct.Line_0_31 = LL_EXTI_LINE_1;

  EXTI_InitStruct.LineCommand = ENABLE;

  EXTI_InitStruct.Mode = LL_EXTI_MODE_IT;

  EXTI_InitStruct.Trigger = LL_EXTI_TRIGGER_RISING;

  LL_EXTI_Init(&EXTI_InitStruct);


  /**/

  LL_GPIO_SetPinPull(GPIOB, LL_GPIO_PIN_1, LL_GPIO_PULL_NO);


  /**/

  LL_GPIO_SetPinMode(GPIOB, LL_GPIO_PIN_1, LL_GPIO_MODE_INPUT);


  /* EXTI interrupt init*/

  NVIC_SetPriority(EXTI0_1_IRQn, 0);

  NVIC_EnableIRQ(EXTI0_1_IRQn);


}


/* USER CODE BEGIN 4 */


/* USER CODE END 4 */


/**

  * @brief  This function is executed in case of error occurrence.

  * @retval None

  */

void Error_Handler(void)

{

  /* USER CODE BEGIN Error_Handler_Debug */

  /* User can add his own implementation to report the HAL error return state */


  /* USER CODE END Error_Handler_Debug */

}


#ifdef  USE_FULL_ASSERT

/**

  * @brief  Reports the name of the source file and the source line number

  *         where the assert_param error has occurred.

  * @param  file: pointer to the source file name

  * @param  line: assert_param error line source number

  * @retval None

  */

void assert_failed(uint8_t *file, uint32_t line)

  /* USER CODE BEGIN 6 */

  /* User can add his own implementation to report the file name and line number,

     tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  /* USER CODE END 6 */

}

#endif /* USE_FULL_ASSERT */


/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/




工程师
2020-01-30 14:01:22     打赏
5楼

V9很不错的


工程师
2020-01-31 19:47:26     打赏
6楼

用最新版本,不香吗?


工程师
2020-01-31 19:57:05     打赏
7楼

建议看官方的文档和意见呗! 我个人觉得V8或V8版本以上即可


工程师
2020-02-10 21:23:56     打赏
8楼

有问题就看官方 的文档 比较靠谱一点


共8条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]